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
sequence
label_sequence
sequence
Imprecise assert
ImageEngine/gaffer/python/GafferUITest/PlaybackTest.py
[ { "content": "\tdef testAcquire( self ) :\n\n\t\tc1 = Gaffer.Context()\n\t\tc2 = Gaffer.Context()\n\n\t\tp1a = GafferUI.Playback.acquire( c1 )\n\t\tp1b = GafferUI.Playback.acquire( c1 )\n\n\t\tself.assertTrue( p1a is p1b )\n\n\t\tp2a = GafferUI.Playback.acquire( c2 )\n\t\tp2b = GafferUI.Playback.acquire( c2 )\n\n\t\tself.assertTrue( p2a is p2b )\n\t\tself.assertTrue( p2a is not p1a )\n\n\t\ts = Gaffer.ScriptNode()\n\t\tp3a = GafferUI.Playback.acquire( s.context() )\n\t\tp3b = GafferUI.Playback.acquire( s.context() )\n\n\t\tself.assertTrue( p3a is p3b )", "metadata": "root.PlaybackTest.testAcquire", "header": "['class', 'PlaybackTest', '(', 'GafferUITest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 42 } ]
[ { "span": "self.assertTrue( p1a is p1b )", "start_line": 50, "start_column": 2, "end_line": 50, "end_column": 31 }, { "span": "self.assertTrue( p2a is p2b )", "start_line": 55, "start_column": 2, "end_line": 55, "end_column": 31 }, { "span": "self.assertTrue( p2a is not p1a )", "start_line": 56, "start_column": 2, "end_line": 56, "end_column": 35 }, { "span": "self.assertTrue( p3a is p3b )", "start_line": 62, "start_column": 2, "end_line": 62, "end_column": 31 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Playb", "ack", "Test_", "(_", "Ga", "ffer", "UI", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "test", "Acquire", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "c1_", "=_", "Ga", "ffer", "_", "._", "Context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "Ga", "ffer", "_", "._", "Context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1", "a_", "=_", "Ga", "ffer", "UI_", "._", "Playb", "ack_", "._", "acquire_", "(_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1", "b_", "=_", "Ga", "ffer", "UI_", "._", "Playb", "ack_", "._", "acquire_", "(_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "p1", "a_", "is_", "p1", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p2", "a_", "=_", "Ga", "ffer", "UI_", "._", "Playb", "ack_", "._", "acquire_", "(_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2", "b_", "=_", "Ga", "ffer", "UI_", "._", "Playb", "ack_", "._", "acquire_", "(_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "p2", "a_", "is_", "p2", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "p2", "a_", "is_", "not_", "p1", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Ga", "ffer", "_", "._", "Script", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p3", "a_", "=_", "Ga", "ffer", "UI_", "._", "Playb", "ack_", "._", "acquire_", "(_", "s_", "._", "context_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p3", "b_", "=_", "Ga", "ffer", "UI_", "._", "Playb", "ack_", "._", "acquire_", "(_", "s_", "._", "context_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "p3", "a_", "is_", "p3", "b_", ")_", "\\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, 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, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unnecessary pass
radekstepan/FlaskBudget/tests_gui.py
[ { "content": " def __init__(self, test):\n self.test = test\n pass", "metadata": "root.TestStartedMessage.__init__", "header": "['class', 'TestStartedMessage', '(', ')', ':', '___EOS___']", "index": 137 }, { "content": " def __call__(self, receiver):\n receiver.executeTestStarted(self.test)\n pass", "metadata": "root.TestStartedMessage.__call__", "header": "['class', 'TestStartedMessage', '(', ')', ':', '___EOS___']", "index": 141 }, { "content": " def __init__(self, test, err):\n self.test = test\n self.err = err\n pass", "metadata": "root.TestFailedMessage.__init__", "header": "['class', 'TestFailedMessage', '(', ')', ':', '___EOS___']", "index": 147 }, { "content": " def __call__(self, receiver):\n receiver.executeTestFailed(self.test, self.err)\n pass", "metadata": "root.TestFailedMessage.__call__", "header": "['class', 'TestFailedMessage', '(', ')', ':', '___EOS___']", "index": 152 }, { "content": " def __init__(self, test, err):\n self.test = test\n self.err = err\n pass", "metadata": "root.TestErroredMessage.__init__", "header": "['class', 'TestErroredMessage', '(', ')', ':', '___EOS___']", "index": 158 }, { "content": " def __call__(self, receiver):\n receiver.executeTestErrored(self.test, self.err)\n pass", "metadata": "root.TestErroredMessage.__call__", "header": "['class', 'TestErroredMessage', '(', ')', ':', '___EOS___']", "index": 163 }, { "content": " def __init__(self, test):\n self.test = test\n pass", "metadata": "root.TestFinishedMessage.__init__", "header": "['class', 'TestFinishedMessage', '(', ')', ':', '___EOS___']", "index": 169 }, { "content": " def __call__(self, receiver):\n receiver.executeTestFinished(self.test)\n pass", "metadata": "root.TestFinishedMessage.__call__", "header": "['class', 'TestFinishedMessage', '(', ')', ':', '___EOS___']", "index": 173 }, { "content": " def __call__(self, receiver):\n receiver.executeStopped()\n pass", "metadata": "root.StoppedMessage.__call__", "header": "['class', 'StoppedMessage', '(', ')', ':', '___EOS___']", "index": 182 }, { "content": " def bgRunner(self): \n print \"start thread\"\n print \"actually running\"\n self.test.run(self.currentResult)\n print \"done running\"\n self.notifyStopped()\n pass", "metadata": "root.EnhancedGUIRunner.bgRunner", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 263 }, { "content": " def notifyStopped(self):\n self.queue.put(StoppedMessage())\n pass", "metadata": "root.EnhancedGUIRunner.notifyStopped", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 426 }, { "content": " def executeStopped(self):\n print \"got a stop\"\n self.stopGoButton.config(state=tk.ACTIVE)\n self.stopGoButton.config(command=self.runClicked, text=\"Start\")\n self.statusVar.set(\"Idle\")\n self.top.update_idletasks()\n self.running = 0\n pass", "metadata": "root.EnhancedGUIRunner.executeStopped", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 430 }, { "content": " def notifyTestStarted(self, test):\n self.queue.put(TestStartedMessage(test))\n pass", "metadata": "root.EnhancedGUIRunner.notifyTestStarted", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 439 }, { "content": " def setDisplayStatus(self, position, status):\n str = self.errorListbox.get(position)\n parts = str.split(': ', 1)\n if len(parts) == 2:\n if parts[0] == 'FAILED' or parts[0] == 'ERROR':\n return\n else:\n str = parts[1]\n str = status + ': ' + str\n self.errorListbox.insert(position, str)\n self.errorListbox.delete(position + 1)\n if status == 'RUNNING':\n self.errorListbox.itemconfig(position, fg='blue')\n elif status == 'FAILED':\n self.errorListbox.itemconfig(position, fg='red')\n elif status == 'ERROR':\n self.errorListbox.itemconfig(position, fg='red')\n elif status == 'SUCCESS':\n self.errorListbox.itemconfig(position, fg='darkgreen')\n if position > 0:\n self.errorListbox.select_clear(position-1)\n self.errorListbox.select_set(position)\n self.errorListbox.see(min(position+4, self.errorListbox.size()) )\n pass", "metadata": "root.EnhancedGUIRunner.setDisplayStatus", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 443 }, { "content": " def executeTestStarted(self, test):\n self.statusVar.set(str(test))\n self.setDisplayStatus(self.currentTestIndex, 'RUNNING')\n self.top.update_idletasks()\n pass", "metadata": "root.EnhancedGUIRunner.executeTestStarted", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 468 }, { "content": " def notifyTestFailed(self, test, err):\n if self.stopOnErrorVar.get() == 1:\n self.currentResult.stop()\n self.queue.put(TestFailedMessage(test, err))\n pass", "metadata": "root.EnhancedGUIRunner.notifyTestFailed", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 474 }, { "content": " def executeTestFailed(self, test, err):\n self.failCountVar.set(1 + self.failCountVar.get())\n #self.errorListbox.insert(tk.END, \"Failure: %s\" % test)\n self.errorInfo.append((test,err))\n self.setDisplayStatus(self.currentTestIndex, 'FAILED')\n pass", "metadata": "root.EnhancedGUIRunner.executeTestFailed", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 480 }, { "content": " def notifyTestErrored(self, test, err):\n if self.stopOnErrorVar.get() == 1:\n self.currentResult.stop()\n self.queue.put(TestErroredMessage(test, err))\n pass", "metadata": "root.EnhancedGUIRunner.notifyTestErrored", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 487 }, { "content": " def executeTestErrored(self, test, err):\n self.errorCountVar.set(1 + self.errorCountVar.get())\n #self.errorListbox.insert(tk.END, \"Error: %s\" % test)\n self.errorInfo.append((test,err))\n self.setDisplayStatus(self.currentTestIndex, 'ERROR')\n pass", "metadata": "root.EnhancedGUIRunner.executeTestErrored", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 493 }, { "content": " def notifyTestFinished(self, test):\n self.queue.put(TestFinishedMessage(test))\n pass", "metadata": "root.EnhancedGUIRunner.notifyTestFinished", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 500 }, { "content": " def executeTestFinished(self, test):\n self.remainingCountVar.set(self.remainingCountVar.get() - 1)\n self.runCountVar.set(1 + self.runCountVar.get())\n fractionDone = float(self.runCountVar.get())/float(self.totalTests)\n fillColor = (self.errorCountVar.get() > 0 or self.failCountVar.get() > 0) \\\n and \"red\" or \"darkgreen\"\n self.progressBar.setProgressFraction(fractionDone, fillColor)\n soFar = time.clock() - self.runStartTime\n self.averageVar.set(time.strftime(\"%M:%S\", \n time.localtime(soFar / self.runCountVar.get())))\n self.setDisplayStatus(self.currentTestIndex, 'SUCCESS')\n if self.currentTestIndex >= len(self.errorInfo):\n # no error, so pad the error list for this test\n self.errorInfo.append((test,None))\n self.currentTestIndex = self.currentTestIndex + 1\n pass", "metadata": "root.EnhancedGUIRunner.executeTestFinished", "header": "['class', 'EnhancedGUIRunner', '(', ')', ':', '___EOS___']", "index": 504 } ]
[ { "span": "pass", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 12 }, { "span": "pass", "start_line": 143, "start_column": 8, "end_line": 143, "end_column": 12 }, { "span": "pass", "start_line": 150, "start_column": 8, "end_line": 150, "end_column": 12 }, { "span": "pass", "start_line": 154, "start_column": 8, "end_line": 154, "end_column": 12 }, { "span": "pass", "start_line": 161, "start_column": 8, "end_line": 161, "end_column": 12 }, { "span": "pass", "start_line": 165, "start_column": 8, "end_line": 165, "end_column": 12 }, { "span": "pass", "start_line": 171, "start_column": 8, "end_line": 171, "end_column": 12 }, { "span": "pass", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 12 }, { "span": "pass", "start_line": 184, "start_column": 8, "end_line": 184, "end_column": 12 }, { "span": "pass", "start_line": 269, "start_column": 8, "end_line": 269, "end_column": 12 }, { "span": "pass", "start_line": 428, "start_column": 8, "end_line": 428, "end_column": 12 }, { "span": "pass", "start_line": 437, "start_column": 8, "end_line": 437, "end_column": 12 }, { "span": "pass", "start_line": 441, "start_column": 8, "end_line": 441, "end_column": 12 }, { "span": "pass", "start_line": 466, "start_column": 8, "end_line": 466, "end_column": 12 }, { "span": "pass", "start_line": 472, "start_column": 8, "end_line": 472, "end_column": 12 }, { "span": "pass", "start_line": 478, "start_column": 8, "end_line": 478, "end_column": 12 }, { "span": "pass", "start_line": 485, "start_column": 8, "end_line": 485, "end_column": 12 }, { "span": "pass", "start_line": 491, "start_column": 8, "end_line": 491, "end_column": 12 }, { "span": "pass", "start_line": 498, "start_column": 8, "end_line": 498, "end_column": 12 }, { "span": "pass", "start_line": 502, "start_column": 8, "end_line": 502, "end_column": 12 }, { "span": "pass", "start_line": 519, "start_column": 8, "end_line": 519, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Test", "Start", "ed", "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_", ",_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "test_", "=_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Start", "ed", "Message_", "(_", ")_", ":_", "\\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_", ",_", "receiver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receiver_", "._", "execute", "Test", "Started_", "(_", "self_", "._", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fail", "ed", "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_", ",_", "test_", ",_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "test_", "=_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "err_", "=_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fail", "ed", "Message_", "(_", ")_", ":_", "\\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_", ",_", "receiver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receiver_", "._", "execute", "Test", "Failed_", "(_", "self_", "._", "test_", ",_", "self_", "._", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Error", "ed", "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_", ",_", "test_", ",_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "test_", "=_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "err_", "=_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Error", "ed", "Message_", "(_", ")_", ":_", "\\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_", ",_", "receiver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receiver_", "._", "execute", "Test", "Error", "ed_", "(_", "self_", "._", "test_", ",_", "self_", "._", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Finish", "ed", "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_", ",_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "test_", "=_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Finish", "ed", "Message_", "(_", ")_", ":_", "\\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_", ",_", "receiver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receiver_", "._", "execute", "Test", "Finished_", "(_", "self_", "._", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stopp", "ed", "Message_", "(_", ")_", ":_", "\\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_", ",_", "receiver_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receiver_", "._", "execute", "Stopp", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\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_", "bg", "Runner_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "start", " ", "thread", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "actual", "ly", " ", "runn", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test_", "._", "run_", "(_", "self_", "._", "current", "Result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "don", "e", " ", "runn", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "Stopp", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "notif", "y", "Stopp", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "queue_", "._", "put_", "(_", "Stopp", "ed", "Message_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "Stopp", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "got", " ", "a", " ", "stop", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "Go", "Button_", "._", "config_", "(_", "state_", "=_", "tk_", "._", "ACTIVE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "Go", "Button_", "._", "config_", "(_", "command_", "=_", "self_", "._", "run", "Clicked_", ",_", "text_", "=_", "\"", "Start", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status", "Var_", "._", "set_", "(_", "\"", "Id", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "update", "\\u", "idle", "tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "running_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "notif", "y", "Test", "Started_", "(_", "self_", ",_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "queue_", "._", "put_", "(_", "Test", "Start", "ed", "Message_", "(_", "test_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Display", "Status_", "(_", "self_", ",_", "position_", ",_", "status_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "str_", "=_", "self_", "._", "error", "Listbox", "_", "._", "get_", "(_", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "str_", "._", "split_", "(_", "':", " ", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "parts_", "[_", "0_", "]_", "==_", "'", "FAIL", "ED", "'_", "or_", "parts_", "[_", "0_", "]_", "==_", "'", "ERROR", "'_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "str_", "=_", "parts_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "str_", "=_", "status_", "+_", "':", " ", "'_", "+_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "Listbox", "_", "._", "insert_", "(_", "position_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "Listbox", "_", "._", "delete_", "(_", "position_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "==_", "'", "RUNN", "ING", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "Listbox", "_", "._", "item", "config_", "(_", "position_", ",_", "fg_", "=_", "'", "blue", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "'", "FAIL", "ED", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "Listbox", "_", "._", "item", "config_", "(_", "position_", ",_", "fg_", "=_", "'", "red", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "'", "ERROR", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "Listbox", "_", "._", "item", "config_", "(_", "position_", ",_", "fg_", "=_", "'", "red", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "'", "SUCCESS", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "Listbox", "_", "._", "item", "config_", "(_", "position_", ",_", "fg_", "=_", "'", "dark", "green", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "position_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "Listbox", "_", "._", "select", "\\u", "clear_", "(_", "position_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "error", "Listbox", "_", "._", "select", "\\u", "set_", "(_", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "Listbox", "_", "._", "see", "_", "(_", "min_", "(_", "position_", "+_", "4_", ",_", "self_", "._", "error", "Listbox", "_", "._", "size_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "Test", "Started_", "(_", "self_", ",_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status", "Var_", "._", "set_", "(_", "str_", "(_", "test_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Display", "Status_", "(_", "self_", "._", "current", "Test", "Index_", ",_", "'", "RUNN", "ING", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "update", "\\u", "idle", "tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "notif", "y", "Test", "Failed_", "(_", "self_", ",_", "test_", ",_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "stop", "On", "Error", "Var_", "._", "get_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "current", "Result_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "queue_", "._", "put_", "(_", "Test", "Fail", "ed", "Message_", "(_", "test_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "Test", "Failed_", "(_", "self_", ",_", "test_", ",_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "Count", "Var_", "._", "set_", "(_", "1_", "+_", "self_", "._", "fail", "Count", "Var_", "._", "get_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "error", "Listbox", ".", "insert", "(", "tk", ".", "END", ",", " ", "\"", "Fail", "ure", ":", " ", "%", "s", "\"", " ", "%", " ", "test", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "Info_", "._", "append_", "(_", "(_", "test_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Display", "Status_", "(_", "self_", "._", "current", "Test", "Index_", ",_", "'", "FAIL", "ED", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "notif", "y", "Test", "Error", "ed_", "(_", "self_", ",_", "test_", ",_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "stop", "On", "Error", "Var_", "._", "get_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "current", "Result_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "queue_", "._", "put_", "(_", "Test", "Error", "ed", "Message_", "(_", "test_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "Test", "Error", "ed_", "(_", "self_", ",_", "test_", ",_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "Count", "Var_", "._", "set_", "(_", "1_", "+_", "self_", "._", "error", "Count", "Var_", "._", "get_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "error", "Listbox", ".", "insert", "(", "tk", ".", "END", ",", " ", "\"", "Error", ":", " ", "%", "s", "\"", " ", "%", " ", "test", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "Info_", "._", "append_", "(_", "(_", "test_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Display", "Status_", "(_", "self_", "._", "current", "Test", "Index_", ",_", "'", "ERROR", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "notif", "y", "Test", "Finished_", "(_", "self_", ",_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "queue_", "._", "put_", "(_", "Test", "Finish", "ed", "Message_", "(_", "test_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enhance", "d", "GU", "IR", "unne", "r_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "Test", "Finished_", "(_", "self_", ",_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rema", "inin", "g", "Count", "Var_", "._", "set_", "(_", "self_", "._", "rema", "inin", "g", "Count", "Var_", "._", "get_", "(_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "Count", "Var_", "._", "set_", "(_", "1_", "+_", "self_", "._", "run", "Count", "Var_", "._", "get_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fract", "ion", "Done_", "=_", "float_", "(_", "self_", "._", "run", "Count", "Var_", "._", "get_", "(_", ")_", ")_", "/_", "float_", "(_", "self_", "._", "total", "Tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fill", "Color_", "=_", "(_", "self_", "._", "error", "Count", "Var_", "._", "get_", "(_", ")_", ">_", "0_", "or_", "self_", "._", "fail", "Count", "Var_", "._", "get_", "(_", ")_", ">_", "0_", ")_", "and_", "\"", "red", "\"_", "or_", "\"", "dark", "green", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress", "Bar_", "._", "set", "Progres", "s", "Fraction_", "(_", "fract", "ion", "Done_", ",_", "fill", "Color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "so", "Far", "_", "=_", "time_", "._", "clock_", "(_", ")_", "-_", "self_", "._", "run", "Start", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "averag", "e", "Var_", "._", "set_", "(_", "time_", "._", "strftime_", "(_", "\"%", "M", ":", "%", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "localtime_", "(_", "so", "Far", "_", "/_", "self_", "._", "run", "Count", "Var_", "._", "get_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Display", "Status_", "(_", "self_", "._", "current", "Test", "Index_", ",_", "'", "SUCCESS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "current", "Test", "Index_", ">=_", "len_", "(_", "self_", "._", "error", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "error", ",", " ", "so", " ", "pad", " ", "the", " ", "error", " ", "list", " ", "for", " ", "this", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "Info_", "._", "append_", "(_", "(_", "test_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "current", "Test", "Index_", "=_", "self_", "._", "current", "Test", "Index_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\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, 0, 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, 0, 2, 4, 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, 0, 2 ]
Unused local variable
CGATOxford/cgat/obsolete/pipeline_vitaminD.py
[ { "content": "@files( \"genome.fasta\", \"genome.fa\" )\ndef indexGenome( infile, outfile ):\n '''index the genome for samtools.\n\n Samtools does not like long lines, so create a new file\n with split lines (what a waste).\n '''\n\n statement = '''fold %(infile)s > %(outfile)s'''\n P.run()\n \n pysam.faidx( outfile )", "metadata": "root.indexGenome", "header": "['module', '___EOS___']", "index": 137 }, { "content": "@files( \"genome.fasta\", \"genome_gc.bed\" )\ndef buildGenomeGCSegmentation( infile, outfile ):\n '''segment the genome into windows according to G+C content.'''\n\n to_cluster = True\n \n statement = '''\n python %(scriptsdir)s/fasta2bed.py \\\n --method=fixed-width-windows --window-size=1000 \\\n --log=%(outfile)s.log \\\n < %(genome)s.fasta > %(outfile)s'''\n\n P.run()", "metadata": "root.buildGenomeGCSegmentation", "header": "['module', '___EOS___']", "index": 171 }, { "content": "@files( ( ( PARAMS[\"filename_regions_of_interest\"], \"roi.import\" ),\n ( PARAMS[\"filename_selection\"], \"selection.import\" ) ) )\ndef importRegionsOfInterest( infile, outfile ):\n '''import regions of interest.'''\n \n table = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --dialect=excel \\\n --index=class \\\n --index=roi_id \\\n --map=roi_id:str \\\n --map=start:int \\\n --map=end:int \\\n --table=%(table)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importRegionsOfInterest", "header": "['module', '___EOS___']", "index": 310 }, { "content": "@merge( PARAMS[\"filename_snps_of_interest\"], \"snps_of_interest.import\" )\ndef importSNPsOfInterest( infile, outfile ):\n '''import regions of interest.'''\n \n table = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --dialect=excel \\\n --index=snp \\\n --map=snp:str \\\n --map=pos:int \\\n --table=%(table)s \\\n < %(infile)s \n > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importSNPsOfInterest", "header": "['module', '___EOS___']", "index": 723 }, { "content": "@files( [ (\"%s.bed\" % x, \"%s_intervals.import\" % x) for x in TRACKS_REFERENCE ] )\ndef importReferenceIntervals( infile, outfile ):\n '''import reference intervals'''\n\n ## add the bed intervals back to table\n track = infile[:-len(\".bed\")]\n\n tmpfile = tempfile.NamedTemporaryFile(delete=False)\n tmpfilename = tmpfile.name\n\n headers = (\"AvgVal\",\"DisttoStart\",\"GeneList\",\"Length\",\n \"PeakCenter\",\"PeakVal\",\"Position\",\n \"interval_id\",\"nCpGs\",\"nGenes\",\"nPeaks\",\n \"nProbes\",\"nPromoters\", \n \"contig\",\"start\",\"end\" )\n\n avgval,contig,disttostart,end,genelist,length,peakcenter,peakval,position,start,interval_id,ncpgs,ngenes,npeaks,nprobes,npromoters = \\\n 0,\"\",0,0,\"\",0,0,0,0,0,0,0,0,0,0,0,\n\n tmpfile.write( \"\\t\".join( headers ) + \"\\n\" )\n\n for line in open( infile, \"r\" ):\n contig, start, end, interval_id = line[:-1].split(\"\\t\")[:4]\n start, end = int(start), int(end)\n length = end - start\n npeaks, peakcenter = 1, start + int(length / 2)\n avgval, peakval, nprobes = 1, 1, 1\n\n tmpfile.write( \"\\t\".join( map( str, (avgval,disttostart,genelist,length,peakcenter,peakval,position,interval_id,ncpgs,ngenes,npeaks,nprobes,npromoters, contig,start,end) )) + \"\\n\" )\n\n tmpfile.close()\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=interval_id \\\n --table=%(track)s_intervals \\\n < %(tmpfilename)s > %(outfile)s\n '''\n\n P.run()\n\n os.unlink( tmpfile.name )", "metadata": "root.importReferenceIntervals", "header": "['module', '___EOS___']", "index": 773 }, { "content": " @transform( \"*.intervals\", suffix(\".intervals\"), \"_intervals.import\" )\n def importIntervals( infile, outfile ):\n\n ## add the bed intervals back to table\n track = infile[:-len(\".intervals\")]\n\n tmpfile = tempfile.NamedTemporaryFile(delete=False)\n tmpfilename = tmpfile.name\n map_id2coords = {}\n for line in open( track + \".bed\", \"r\" ):\n contig, start, end, id = line[:-1].split(\"\\t\")[:4]\n map_id2coords[id] = (contig, start, end )\n\n for line in open( infile ):\n if line.startswith( \"interval_id\"):\n tmpfile.write( \"%s\\t%s\\t%s\\t%s\\n\" % ((line[:-1],\"contig\",\"start\",\"end\") ) )\n else:\n id = line[:-1].split( \"\\t\")[0]\n try:\n tmpfile.write( \"%s\\t%s\\t%s\\t%s\\n\" % ((line[:-1],) + map_id2coords[id]))\n except KeyError:\n P.warn( \"%s -> interval %s - omitted due to mapping problems\" % (infile, id) )\n\n tmpfile.close()\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=interval_id \\\n --table=%(track)s_intervals \\\n < %(tmpfilename)s > %(outfile)s\n '''\n\n P.run()\n\n os.unlink( tmpfile.name )", "metadata": "root.importIntervals", "header": "['module', '___EOS___']", "index": 891 }, { "content": " @follows( indexGenome )\n @transform( PARAMS[\"filename_reads\"], \n regex(\"(\\S+).export.txt.gz\"), \n r\"\\1.bam\" )\n def buildBAM( infile, outfile ):\n '''re-map eland formatted reads with bowtie\n '''\n to_cluster = True\n\n # require 4Gb of free memory\n job_options = \"-l mem_free=4000M\"\n\n job_options += \" -q server_jobs.q\"\n\n tmpfilename = P.getTempFilename()\n\n prefix = outfile[:-len(\".bam\")]\n\n statement = '''\n gunzip < %(infile)s |\\\n awk '$11 != \"QC\" || $10 ~ /(\\d+):(\\d+):(\\d+)/ \\\n { if ($1 != \"\") { readname=sprintf( \"%%s_%%s:%%s:%%s:%%s:%%s\", $1,$2,$3,$4,$5,$6);}\n else { readname=sprintf( \"%%s:%%s:%%s:%%s:%%s\", $1,$3,$4,$5,$6); }\n printf(\"@%%s\\\\n%%s\\\\n+\\\\n%%s\\\\n\",readname,$9,$10);}' |\\\n bowtie --sam %(intevals_bowtie_options)s %(intervals_bowtie_index)s - 2>%(outfile)s.log |\\\n samtools import %(genome)s - %(tmpfilename)s >& %(outfile)s.log;\n samtools sort %(tmpfilename)s %(prefix)s;\n samtools index %(outfile)s;\n rm -f %(tmpfilename)s\n '''\n\n P.run()\n\n if os.path.exists( tmpfilename ):\n os.unlink( tmpfilename )", "metadata": "root.buildBAM", "header": "['module', '___EOS___']", "index": 1485 }, { "content": "@files_re( (buildBAM, normalizeBAMPerExperiment, normalizeBAMPerReplicate),\n \"(.*).bam\",\n r\"\\1.bigwig\" )\ndef buildBigwig( infile, outfile ):\n '''convert BAM to bigwig file.'''\n\n # no bedToBigBed on the 32 bit cluster\n to_cluster = True\n job_queue = \"server_jobs.q\"\n\n statement = '''python %(scriptsdir)s/bam2wiggle.py \\\n --genome-file=%(genome)s \\\n --output-format=bigwig \\\n --output-filename=%(outfile)s \\\n %(infile)s \\\n > %(outfile)s.log'''\n \n P.run()", "metadata": "root.buildBigwig", "header": "['module', '___EOS___']", "index": 2314 }, { "content": "@files( ((PARAMS[\"filename_affymetrix\"], \"affymetrix_import\" ),) )\ndef importAffymetrixAnnotation( infile, outfile):\n '''import affymetrix probe annotations.\n '''\n table = \"affymetrix\"\n\n statement = '''\n gunzip < %(infile)s |\\\n sed \"s/probeset_id/probeset/\" |\\\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --dialect=excel \\\n --index=probeset \\\n --index=mrna_id \\\n --table=%(table)s \\\n > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importAffymetrixAnnotation", "header": "['module', '___EOS___']", "index": 2338 }, { "content": "@files( importAffymetrixAnnotation, \"probeset2transcript.table\")\ndef buildProbeset2Transcript( infile, outfile):\n '''build map relating a probeset to a transcript_id, gene_id, ...\n\n 1. only take those that can be mapped to transcripts in table transcripts\n 2. check consistency of location with transcripts in table transcripts\n 3. remove those with cross hybridyzation signals\n\n '''\n\n dbhandle = sqlite3.connect( PARAMS[\"database\"] )\n\n E.debug( \"collecting exons\")\n raise NotImplementError(\"check fastgtf and gzip.\")\n with gzip.open(PARAMS[\"transcripts\"]) as inf:\n exons = GTF.readAndIndex( GTF.iterator( inf ) )\n\n E.debug( \"collecting transcripts\")\n cc = dbhandle.cursor()\n statement = \"SELECT transcript_id, gene_id, source, contig, min(start), max(end), strand FROM transcripts GROUP BY transcript_id, gene_id, source, contig\"\n cc.execute( statement )\n map_transcript2gene = {}\n for transcript_id, gene_id, source, contig, start, end, strand in cc.fetchall():\n map_transcript2gene[transcript_id] = (gene_id, source, contig, start, end, strand )\n\n counter = E.Counter()\n\n cc = dbhandle.cursor()\n statement = \"SELECT probeset, transcript_cluster_id, seqname, start, stop, mrna_assignment, crosshyb_type FROM affymetrix\"\n cc.execute( statement )\n\n outf_notfound = open( outfile + \".notfound\", \"w\")\n outf_notfound.write(\"probeset\\tcause\\tcontig\\tstart\\tend\\tmrna_assignment\\n\" )\n\n outf = open( outfile, \"w\" )\n outf.write( \"probeset\\tcluster_id\\tprobe_contig\\tprobe_start\\tprobe_end\\ttranscript_id\\tgene_id\\tsource\\tcontig\\tstart\\tend\\tstrand\\n\" )\n\n genes_found, transcripts_found = set(), set()\n\n for probeset, transcript_cluster_id, contig, start, end, mrna_assignment, crosshyb_type in cc.fetchall():\n start -= 1 \n if mrna_assignment == \"---\":\n counter.probesets_unassigned += 1\n continue\n\n data = [ x.strip().split(\" // \") for x in mrna_assignment.split(\"///\") ]\n found, mapped, mismapped, nxhyb = 0, 0, 0, 0\n\n # collect transcripts by exon overlap\n try:\n overlaps = [ x[2] for x in exons.get( contig, start, end ) ]\n except KeyError:\n overlaps = []\n\n transcripts = set( [x.transcript_id for x in overlaps ] )\n\n for transcript_id, seqname, score, direct_probes, possible_probes, xhyb in data:\n\n if xhyb != \"0\":\n nxhyb += 1\n continue\n\n # collect transcripts from annotation file\n if transcript_id.startswith(\"ENST\"):\n found += 1\n \n try:\n gene_id, other_source, other_contig, other_start, other_end, other_strand = map_transcript2gene[transcript_id]\n except KeyError:\n continue\n\n mapped += 1\n\n if transcript_id not in transcripts:\n mismapped += 1\n continue\n \n if other_contig != contig or \\\n min(other_end,end) - max(other_start, start) < 0:\n mismapped += 1\n continue\n\n outf.write(\"%s\\t%s\\t%s\\t%i\\t%i\\t%s\\t%s\\t%s\\t%s\\t%i\\t%i\\t%s\\n\" % \\\n (probeset, transcript_cluster_id, contig, start, end,\n transcript_id, gene_id, other_source,\n other_contig, other_start, other_end, other_strand))\n\n genes_found.add(gene_id)\n transcripts_found.add(transcript_id)\n\n if found == 0: \n counter.probesets_notfound += 1\n code = \"no ENSEMBL\"\n elif mapped == 0:\n counter.probesets_unmapped += 1\n code = \"not in transcripts\"\n elif mapped > 0 and mapped == mismapped:\n counter.probesets_mismapped += 1\n code = \"mismapped\"\n elif mapped > 0 and mapped == nxhyb:\n counter.probesets_crosshyb += 1\n code = \"cross-hybridized\"\n elif mapped > 0 and mapped == nxhyb + mismapped:\n counter.probesets_errors += 1\n code = \"errors\"\n else:\n counter.probesets_found += 1\n code = None\n\n if code:\n outf_notfound.write(\"%s\\t%s\\t%s\\t%i\\t%i\\t%s\\n\" % (probeset, code, contig, start, end, mrna_assignment) )\n\n outf_notfound.close()\n outf.close()\n\n E.info( \"mapping results: %s\" % str(counter))\n E.info( \"genes found: %i(%5.2f%%): transcripts found %i(%5.2f%%)\" %\\\n (len(genes_found),\n 100.0 * len(genes_found) / len( set( [x[0] for x in map_transcript2gene.values()]) ),\n len(transcripts_found),\n 100.0 * len(transcripts_found) / len( map_transcript2gene.keys() ) ) )", "metadata": "root.buildProbeset2Transcript", "header": "['module', '___EOS___']", "index": 2362 }, { "content": "@transform( buildProbeset2Transcript, suffix(\".table\"), \"_table.import\" )\ndef importProbeset2Transcript( infile, outfile):\n\n table = outfile[:-len(\"_table.import\")] \n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=probeset \\\n --index=cluster_id \\\n --index=transcript_id \\\n --index=gene_id \\\n --table=%(table)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importProbeset2Transcript", "header": "['module', '___EOS___']", "index": 2489 }, { "content": "@transform( buildExpressionTracks, suffix(\".data\"), \"_data.import\" )\ndef importExpressionTracks( infile, outfile):\n\n table = outfile[:-len(\"_data.import\")] + \"_levels\"\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=cluster_id \\\n --table=%(table)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importExpressionTracks", "header": "['module', '___EOS___']", "index": 2653 }, { "content": "@transform( (buildExpressionCorrelation, buildExpressionFullCorrelation),\n suffix(\".correlation\"), \"_correlation.import\" )\ndef importExpressionCorrelation( infile, outfile):\n\n table = outfile[:-len(\".import\")] \n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=track \\\n --table=%(table)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importExpressionCorrelation", "header": "['module', '___EOS___']", "index": 2782 }, { "content": "@transform( buildExpressionTracks, suffix(\".table\"), \"_table.import\" )\ndef importExpressionProbesets( infile, outfile):\n\n table = outfile[:-len(\"_table.import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=cluster_id \\\n --index=mrna_id \\\n --index=genesymbol \\\n --table=%(table)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importExpressionProbesets", "header": "['module', '___EOS___']", "index": 2802 }, { "content": "@transform( buildExpressionTracks, suffix(\".map\"), \"_map.import\" )\ndef importExpressionMap( infile, outfile):\n\n table = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --table=%(table)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importExpressionMap", "header": "['module', '___EOS___']", "index": 2823 }, { "content": "@files_re( [ x for x in glob.glob(\"run*.bed\") if not isReplicate( x[:-len(\"bed\")] ) ],\n \"(.*).bed\", \n (r\"\\1.bed\", TARGET_PROBESET),\n r\"\\1.assoc\" )\ndef buildIntervalProbesetAssociations( infiles, outfile ):\n '''build association between probesets and intervals.'''\n\n to_cluster = True\n infile, probeset = infiles\n statement = \"\"\"\n cat < %(infile)s |\\\n python %(scriptsdir)s/bed2gff.py --as-gtf |\\\n\tpython %(scriptsdir)s/gtf2table.py \\\n\t\t--counter=neighbours \\\n\t\t--log=%(outfile)s.log \\\n\t\t--filename-gff=%(probeset)s \\\n --proximal-distance=%(proximal_distance)s \\\n\t\t--genome-file=%(genome)s |\\\n python %(toolsdir)s\\table2graph.py \\\n --headers=id,probeset \\\n\t> %(outfile)s\"\"\"\n\n P.run()", "metadata": "root.buildIntervalProbesetAssociations", "header": "['module', '___EOS___']", "index": 2840 }, { "content": "@files_re( buildIntervalProbesetAssociations,\n \"(.*).assoc\",\n r\"\\1_assoc.import\")\ndef importIntervalProbesetAssociations( infile, outfile):\n tablename = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=id \\\n --index=probeset \\\n --table=%(tablename)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importIntervalProbesetAssociations", "header": "['module', '___EOS___']", "index": 2867 }, { "content": "@merge( (exportReferenceAsBed, exportIntervalsAsBed, \n [\"%s.bed\" % x for x in TRACKS_REFERENCE ] ),\n \"intervals.overlap\" )\ndef buildOverlap( infiles, outfile ):\n '''compute overlap between intervals.\n '''\n\n if os.path.exists(outfile): \n os.rename( outfile, outfile + \".orig\" )\n options = \"--update=%s.orig\" % outfile\n else:\n options = \"\"\n\n infiles = \" \".join(IOTools.flatten(infiles))\n\n statement = '''\n python %(scriptsdir)s/diff_bed.py \n --log=%(outfile)s.log \n %(options)s \n %(infiles)s \n > %(outfile)s\n '''\n P.run()", "metadata": "root.buildOverlap", "header": "['module', '___EOS___']", "index": 2960 }, { "content": "@transform( buildOverlap, suffix(\".overlap\"), \"_overlap.import\" )\ndef importOverlap( infile, outfile ):\n '''import overlap results.\n '''\n\n tablename = \"overlap\"\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \n --index=set1 \n --index=set2 \n --table=%(tablename)s \n < %(infile)s \n > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importOverlap", "header": "['module', '___EOS___']", "index": 2987 }, { "content": "@merge( (exportUCSCEncodeTracks, \n exportReferenceAsBed, \n [\"%s.bed\" % x for x in TRACKS_REFERENCE ],\n combineConditions,\n combineUnstim,\n combineReplicates ),\n \"ucsc.overlap\" )\ndef buildUCSCOverlap( infiles, outfile ):\n '''compute overlap between intervals and the ucsc tracks.\n '''\n\n if os.path.exists(outfile): \n os.rename( outfile, outfile + \".orig\" )\n options = \"--update=%s.orig\" % outfile\n else:\n options = \"\"\n\n to_cluster = True\n\n infiles = \" \".join(IOTools.flatten(infiles))\n statement = '''\n python %(scriptsdir)s/diff_bed.py \n --tracks \n --log=%(outfile)s.log\n %(options)s \n %(infiles)s \n > %(outfile)s\n '''\n\n P.run()", "metadata": "root.buildUCSCOverlap", "header": "['module', '___EOS___']", "index": 3008 }, { "content": "@transform( buildUCSCOverlap, suffix(\".overlap\"), \"_overlap.import\" )\ndef importUCSCOverlap( infile, outfile ):\n '''import overlap results.\n '''\n\n tablename = \"ucsc_overlap\"\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=set1 \\\n --index=set2 \\\n --table=%(tablename)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importUCSCOverlap", "header": "['module', '___EOS___']", "index": 3042 }, { "content": "@files( [( [\"%s%s.norm.bam\" % (x,y) for y in REPLICATES], \"%s.readcorrelations.gz\" % x) for x in TRACKS_EXPERIMENTS ] )\ndef makeReadCorrelation( infiles, outfile ):\n '''compute correlation between reads.\n '''\n\n to_cluster = True\n job_options = \"-l mem_free=8000M\"\n\n infiles = \" \".join(infiles)\n\n statement = '''\n python %(scriptsdir)s/bam_correlation.py \\\n --log=%(outfile)s.log \\\n --genome=%(genome)s \\\n %(infiles)s | gzip > %(outfile)s\n ''' \n\n P.run()", "metadata": "root.makeReadCorrelation", "header": "['module', '___EOS___']", "index": 3165 }, { "content": "@transform( exportMotifSequences, suffix(\".fasta\"), \".meme\")\ndef runMEME( infile, outfile ):\n '''run MEME on all intervals and motifs.\n\n In order to increase the signal/noise ratio,\n MEME is not run on all intervals but only the \n top 10% of intervals (peakval) are used. \n Also, only the segment of 200 bp around the peak\n is used and not the complete interval.\n\n * Softmasked sequence is converted to hardmasked\n sequence to avoid the detection of spurious motifs.\n\n * Sequence is run through dustmasker\n '''\n to_cluster = True\n job_queue = \"medium_jobs.q\"\n job_options = \"-l mem_free=8000M\"\n\n target_path = os.path.join( os.path.abspath(PARAMS[\"exportdir\"]), \"meme\", outfile )\n\n dbhandle = sqlite3.connect( PARAMS[\"database\"] )\n fasta = IndexedFasta.IndexedFasta( PARAMS[\"genome\"] )\n\n track = infile[:-len(\".fasta\")]\n cc = dbhandle.cursor()\n statement = \"SELECT peakcenter, interval_id, contig FROM %s_intervals ORDER BY peakval DESC\" % track\n cc.execute( statement )\n data = cc.fetchall()\n cc.close()\n\n cutoff = len(data) // 10\n # maximum size of data set (in characters)\n maxsize = int(PARAMS[\"motifs_meme_max_size\"])\n\n E.info( \"runMeme: %s: using at most %i sequences for pattern finding\" % (track, cutoff) )\n\n fasta = IndexedFasta.IndexedFasta( PARAMS[\"genome\"] )\n\n tmpdir = tempfile.mkdtemp( dir = \".\" )\n tmpfasta = os.path.join( tmpdir, \"in.fa\")\n outs = open( tmpfasta , \"w\" )\n\n masker = Masker.MaskerDustMasker()\n\n hw = int(PARAMS[\"motifs_meme_halfwidth\"])\n current_size, nseq = 0, 0\n for peakcenter, id, contig in data[:cutoff]:\n start, end = peakcenter - hw, peakcenter + hw\n id = \"%s_%s %s:%i..%i\" % (track, str(id), contig, start, end)\n seq = fasta.getSequence( contig, \"+\", start, end )\n\n if PARAMS[\"motifs_meme_masker\"] == \"repeatmasker\":\n # the genome sequence is repeat masked\n masked_seq = seq\n elif PARAMS[\"motifs_meme_masker\"] == \"dustmasker\":\n masked_seq = masker( seq.upper() )\n\n # hard mask softmasked characters\n masked_seq = re.sub( \"[a-z]\",\"N\", masked_seq )\n current_size += len(masked_seq)\n if current_size >= maxsize: \n E.info( \"runMEME: %s: maximum size (%i) reached - only %i sequences output\" % (track, maxsize, nseq))\n break\n nseq += 1\n outs.write( \">%s\\n%s\\n\" % (id, masked_seq))\n\n outs.close()\n\n statement = '''\n %(motifs_execmeme)s %(tmpfasta)s -dna -revcomp \n -mod %(motifs_meme_model)s \n -nmotifs %(motifs_meme_nmotifs)s \n -oc %(tmpdir)s \n -maxsize %(maxsize)s \n %(motifs_meme_options)s \n > %(outfile)s.log\n '''\n P.run()\n\n # copy over results\n try:\n os.makedirs( os.path.dirname( target_path ) )\n except OSError: \n # ignore \"file exists\" exception\n pass\n\n if os.path.exists( target_path ): shutil.rmtree( target_path )\n shutil.move( tmpdir, target_path )\n\n shutil.copyfile( os.path.join(target_path, \"meme.txt\"), outfile)", "metadata": "root.runMEME", "header": "['module', '___EOS___']", "index": 3299 }, { "content": "@transform( exportMotifSequences, suffix(\".fasta\"), \".glam2\")\ndef runGLAM2( infile, outfile ):\n '''run glam2 on all intervals and motifs.\n\n In order to increase the signal/noise ratio,\n MEME is not run on all intervals but only the \n top 10% of intervals (peakval) are used. \n Also, only the segment of 200 bp around the peak\n is used and not the complete interval.\n\n * Softmasked sequence is converted to hardmasked\n sequence to avoid the detection of spurious motifs.\n\n * Sequence is run through dustmasker\n '''\n to_cluster = True\n job_queue = \"server_jobs.q\"\n\n target_path = os.path.join( os.path.abspath( PARAMS[\"exportdir\"] ), \"glam2\", outfile )\n track = infile[:-len(\".fasta\")]\n\n tmpdir = tempfile.mkdtemp()\n tmpfasta = os.path.join( tmpdir, \"in.fa\")\n\n nseq = writeSequencesForIntervals( track, tmpfasta,\n full = False,\n halfwidth = int(PARAMS[\"motifs_meme_halfwidth\"]),\n maxsize = int(PARAMS[\"motifs_meme_max_size\"]),\n proportion = 0.1 )\n\n min_sequences = int(nseq / 10.0)\n statement = '''\n %(motifs_execglam2)s -2 -O %(tmpdir)s %(motifs_glam2_options)s -z %(min_sequences)i n %(tmpfasta)s > %(outfile)s.log\n '''\n P.run()\n\n # copy over results\n try:\n os.makedirs( os.path.dirname( target_path ) )\n except OSError: \n # ignore \"file exists\" exception\n pass\n\n if os.path.exists( target_path ): shutil.rmtree( target_path )\n shutil.move( tmpdir, target_path )\n\n shutil.copyfile( os.path.join(target_path, \"glam2.txt\"), outfile)", "metadata": "root.runGLAM2", "header": "['module', '___EOS___']", "index": 3517 }, { "content": " @follows( makeMotifs )\n @transform( runMEME, suffix(\".meme\"), \".tomtom\" )\n def runTomTom( infile, outfile ):\n '''compare ab-initio motifs against tomtom.'''\n to_cluster = True\n statement = '''\n %(motifs_exectomtom)s -text -query %(motifs_tomtom_master_motif)s -target %(infile)s > %(outfile)s\n '''\n P.run()", "metadata": "root.runTomTom", "header": "['module', '___EOS___']", "index": 3579 }, { "content": " @transform( runTomTom, suffix(\".tomtom\"), \"_tomtom.import\" )\n def importTomTom( infile, outfile ):\n '''compare ab-initio motifs against tomtom.'''\n\n tmpfile = P.getTempFile()\n\n tmpfile.write( \"\\t\".join( \\\n (\"query_id\", \"target_id\",\n \"optimal_offset\", \"pvalue\", \"qvalue\", \"overlap\", \"query_consensus\",\n \"target_consensus\", \"orientation\") ) + \"\\n\" )\n\n for line in open( infile, \"r\" ):\n if line.startswith( \"#Query\" ): continue\n (query_id, target_id, \n optimal_offset, pvalue, qvalue, overlap, query_consensus,\n target_consensus, orientation) = line[:-1].split(\"\\t\")\n tmpfile.write( line )\n\n tmpfile.close()\n\n tmpname = tmpfile.name\n tablename = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --allow-empty \\\n --table=%(tablename)s \\\n < %(tmpname)s > %(outfile)s\n '''\n\n P.run()\n os.unlink( tmpname )", "metadata": "root.importTomTom", "header": "['module', '___EOS___']", "index": 3592 }, { "content": "@follows( makeMotifs, filterMotifs )\n@files_re( (exportMotifSequences, exportMotifControlSequences),\n \"(\\S+).controlfasta\",\n [ r\"\\1.controlfasta\", r\"\\1.fasta\", glob.glob(\"*.motif\")],\n r\"\\1.mast.gz\" )\ndef runMAST( infiles, outfile ):\n '''run mast on all intervals and motifs.\n\n Collect all results for an E-value up to 10000 so that\n all sequences are output and MAST curves can be computed. \n\n 10000 is a heuristic.\n '''\n to_cluster = True\n job_queue = \"medium_jobs.q\"\n # only use new nodes, as /bin/csh is not installed\n # on the old ones.\n job_options = \"-l mem_free=8000M\"\n\n controlfile, dbfile, motiffiles = infiles\n controlfile = dbfile[:-len(\".fasta\")] + \".controlfasta\"\n if not os.path.exists( controlfile ):\n raise P.PipelineError( \"control file %s for %s does not exist\" % (controlfile, dbfile))\n\n if os.path.exists(outfile): os.remove( outfile )\n\n for motiffile in motiffiles:\n if IOTools.isEmpty( motiffile ):\n E.info( \"skipping empty motif file %s\" % motiffile )\n continue\n\n of = gzip.open(outfile, \"a\")\n motif, x = os.path.splitext( motiffile )\n of.write(\":: motif = %s ::\\n\" % motif )\n of.close()\n\n statement = '''\n cat %(dbfile)s %(controlfile)s \n | %(motifs_execmast)s %(motiffile)s -stdin -stdout -text -ev %(motifs_mast_evalue)f \n | gzip \n >> %(outfile)s\n '''\n P.run()", "metadata": "root.runMAST", "header": "['module', '___EOS___']", "index": 3673 }, { "content": "@transform( exportMotifSequences,\n suffix(\".fasta\"),\n \".bioprospector\")\ndef runBioProspector( infiles, outfile ):\n '''run bioprospector for motif discovery.\n\n Bioprospector is run on only the top 10% of peaks.\n '''\n to_cluster = True\n\n # only use new nodes, as /bin/csh is not installed\n # on the old ones.\n job_options = \"-l mem_free=8000M\"\n\n tmpfasta = P.getTempFilename( \".\" )\n track = outfile[:-len(\".bioprospector\")]\n nseq = writeSequencesForIntervals( track,\n tmpfasta,\n full = True,\n masker = \"dust\",\n proportion = 0.10 )\n\n statement = '''\n %(motifs_execbioprospector)s -i %(tmpfasta)s %(motifs_bioprospector_options)s -o %(outfile)s > %(outfile)s.log\n '''\n P.run()\n\n os.unlink( tmpfasta )", "metadata": "root.runBioProspector", "header": "['module', '___EOS___']", "index": 3720 }, { "content": "def _runNubiscanMotifSearch( infile, outfile, motif, mode=\"straight\" ):\n '''run NUBISCAN to find matches to nuclear receptors.\n '''\n\n to_cluster = True\n job_options = \"-l mem_free=8000M\"\n\n track = re.sub( \".nubiscan.*\", \"\", outfile )\n tmpfasta = P.getTempFilename( \".\" )\n\n if mode == \"shuffled\":\n nseq = writeSequencesForIntervals( track,\n tmpfasta,\n full = False,\n halfwidth = 100,\n shuffled = True )\n elif mode == \"shifted\":\n nseq = writeSequencesForIntervals( track,\n tmpfasta,\n full = False,\n halfwidth = 100,\n offset = -1000000)\n elif mode == \"straight\":\n nseq = writeSequencesForIntervals( track,\n tmpfasta,\n full = False,\n halfwidth = 100 )\n else:\n raise ValueError(\"invalid mode `%s`\" % mode )\n\n\n arrangements = \",\".join( PARAMS[\"motifs_nubiscan_arrangements\"] )\n\n statement = '''python %(scriptsdir)s/run_nubiscan.py \\\n --qvalue=%(motifs_nubiscan_qvalue)f \\\n --iterations=%(motifs_nubiscan_iterations)i \\\n --arrangements=%(arrangements)s \\\n --motif=%(motif)s \\\n --mask=dust \\\n --add-sequence \\\n --log=%(outfile)s.log \\\n < %(tmpfasta)s > %(outfile)s'''\n\n P.run()\n\n os.unlink( tmpfasta )", "metadata": "root._runNubiscanMotifSearch", "header": "['module', '___EOS___']", "index": 3874 }, { "content": "@files( [ (\"%s.bed\" % x, \"%s.annotations\" % x ) for x in TRACKS_ANNOTATE] )\ndef annotateIntervals( infile, outfile ):\n '''classify chipseq intervals according to their location \n with respect to the gene set.\n '''\n to_cluster = True\n statement = \"\"\"\n cat < %(infile)s \n | python %(scriptsdir)s/bed2gff.py --as-gtf \n | python %(scriptsdir)s/gtf2table.py \n --counter=position \n --counter=classifier-chipseq \n --section=exons \n --counter=length \n --log=%(outfile)s.log \n --filename-gff=%(annotation)s \n --genome-file=%(genome)s\n > %(outfile)s\"\"\"\n\n P.run()", "metadata": "root.annotateIntervals", "header": "['module', '___EOS___']", "index": 4274 }, { "content": "def straightImport( infile, outfile, options = \"\" ):\n '''straight import from gtf2table results.\n\n The table name is given by outfile without the\n \".import\" suffix.\n '''\n\n tablename = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=gene_id \\\n %(options)s \\\n --table=%(tablename)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.straightImport", "header": "['module', '___EOS___']", "index": 4298 }, { "content": "@files( [ (\"%s.bed\" % x, \"%s.tracks\" % x, \"ucsc_encode.bed\" ) for x in TRACKS_ANNOTATE] )\ndef annotateTracks( infile, outfile, trackfile ):\n '''annotate intervals by track overlap\n '''\n\n statement = \"\"\"\n python %(scriptsdir)s/bed2table.py \n --counter=overlap \n --log=%(outfile)s.log \n --filename-bed=%(trackfile)s \n --genome-file=%(genome)s\n < %(infile)s\n | perl -p -e \"s/name/gene_id/\" \n > %(outfile)s\"\"\"\n\n P.run()", "metadata": "root.annotateTracks", "header": "['module', '___EOS___']", "index": 4330 }, { "content": "@follows( buildGeneRegions )\n@files( [ (\"%s.bed\" % x, \"%s.tss\" % x ) for x in TRACKS_ANNOTATE ] )\ndef annotateTSS( infile, outfile ):\n\n to_cluster = True\n statement = \"\"\"\n cat < %(infile)s |\\\n python %(scriptsdir)s/bed2gff.py --as-gtf |\\\n python %(scriptsdir)s/gtf2table.py \\\n --counter=distance-tss \\\n --log=%(outfile)s.log \\\n --filename-gff=%(transcripts_tss)s \\\n --genome-file=%(genome)s\n > %(outfile)s\"\"\"\n\n P.run()", "metadata": "root.annotateTSS", "header": "['module', '___EOS___']", "index": 4361 }, { "content": "@files( [ (\"%s.bed\" % x, \"%s.repeats\" % x ) for x in TRACKS_ANNOTATE ] )\ndef annotateRepeats( infile, outfile ):\n '''count the overlap between intervals and repeats.'''\n\n to_cluster = True\n statement = \"\"\"\n cat < %(infile)s |\\\n python %(scriptsdir)s/bed2gff.py --as-gtf |\\\n python %(scriptsdir)s/gtf2table.py \\\n --counter=overlap \\\n --log=%(outfile)s.log \\\n --filename-gff=%(repeats)s \\\n --genome-file=%(genome)s\n > %(outfile)s\"\"\"\n\n P.run()", "metadata": "root.annotateRepeats", "header": "['module', '___EOS___']", "index": 4381 }, { "content": "@transform( importExpressionTracks, suffix(\"_data.import\"), \".sam.expdiff\" )\ndef buildExpressionDifferencesSAM( infile, outfile ):\n '''compute stats on expression differences between each set\n and the appropriate unstimulated set using SAM.\n '''\n\n nskipped = 0\n\n track = infile[:-len(\"_data.import\")]\n\n target_path = os.path.join( os.path.abspath( PARAMS[\"exportdir\"] ), \"SAM\" )\n if not os.path.exists( target_path): \n try:\n os.makedirs( target_path )\n except OSError: \n pass\n\n outs = open( outfile, \"w\" )\n outs.write( \"cluster_id\\tmean1\\tstd1\\tmean2\\tstd2\\tpvalue\\tqvalue\\tdiff\\tfold\\tcalled\\n\" )\n\n try:\n control, cluster_ids, treatments, controls = PExpression.getExpressionMeasurements( track )\n except P.PipelineError, msg:\n E.warn(\"skipped: %s\" % msg )\n outs.close()\n return\n\n E.info( \"track=%s, control=%s: computing SAM for %i probesets, %i samples, %i control\" % (track, control,\n len(cluster_ids),\n len(treatments),\n len(controls)))\n\n genes, summary, cutoffs = Expression.SAM()( cluster_ids, treatments, controls,\n pattern = os.path.join(target_path, outfile + \"%s\"),\n fdr = float(PARAMS[\"expression_sam_fdr\"]),\n ngenes = float(PARAMS[\"expression_sam_ngenes\"]),\n ndelta = float(PARAMS[\"expression_sam_ndelta\"]),\n npermutations = PARAMS[\"expression_sam_permutations\"],\n method = PARAMS[\"expression_sam_method\"],\n use_excel_sam = False )\n\n if summary == None:\n E.warn( \"no cutoff when running sam for %s\" % infile )\n\n if cutoffs:\n logs = open( outfile + \".cutoffs\", \"w\" )\n logs.write(\"\\t\".join( cutoffs[0]._fields) + \"\\n\" )\n for x in cutoffs:\n logs.write( \"\\t\".join(map(str,x) ) + \"\\n\" )\n logs.close()\n for s in genes:\n outs.write (\"%s\\t%f\\t%f\\t%f\\t%f\\t%e\\t%f\\t%f\\t%f\\t%i\\n\" % \\\n (s.probeset, \n s.mean1,\n s.stddev1,\n s.mean2,\n s.stddev2,\n s.pvalue, \n s.qvalue, \n s.difference,\n s.fold,\n s.called,\n ) )\n outs.close()", "metadata": "root.buildExpressionDifferencesSAM", "header": "['module', '___EOS___']", "index": 4473 }, { "content": "@transform( (buildExpressionDifferencesSAM, buildExpressionDifferencesTTest), \n suffix(\".expdiff\"), \n \"_expdiff.import\")\ndef importExpressionDifferences( infile, outfile ):\n '''import expression differences.\n '''\n\n track, method, control = PExpression.getExpressionMatch( infile )\n\n if track == control:\n outs = open( outfile, \"w\" )\n outs.close()\n return\n\n tablename = \"%s_vs_%s_%s\" % (track,control,method)\n \n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --allow-empty \\\n --index=cluster_id \\\n --table=%(tablename)s \\\n < %(infile)s > %(outfile)s\n '''\n\n P.run()", "metadata": "root.importExpressionDifferences", "header": "['module', '___EOS___']", "index": 4539 }, { "content": "@files( PARAMS[\"filename_t1d\"], \"t1d.bed\" )\ndef buildDiseaseIntervals( infile, outfile):\n\n reader = csv.reader( open(infile,\"rU\") )\n fasta = IndexedFasta.IndexedFasta( FILENAME_GENOME )\n\n outs = open( outfile, \"w\" )\n\n for row in reader:\n if row[0] == \"Locus\": \n headers = row\n continue\n loc, chrom, start, end = row[:4]\n if loc == \"\": continue\n start, end = int(start)-1, int(end)\n \n contig = fasta.getToken( re.sub(\"[pq]\\d[.0-9]*\", \"\", chrom) )\n\n outs.write(\"%s\\t%i\\t%i\\t%s\\n\" % (contig, start, end, loc) )\n\n outs.close()", "metadata": "root.buildDiseaseIntervals", "header": "['module', '___EOS___']", "index": 5603 }, { "content": "@files( ((PARAMS[\"filename_expression_wang\"], \"expression_wang.import\"), ) )\ndef importExpressionWang( infile, outfile ):\n '''import gene expression data from Wang et al. (2005) \n \n :pmid:`16002434`\n '''\n\n headers = (\n (\"Probe Set ID\", \"probeset\"),\n (\"Accession\", \"accession\"),\n (\"Chromosomal Location\", \"chromosome\"),\n (\"Gene Title\", \"genetitle\"),\n (\"Gene Symbol\", \"genesymbol\"),\n (\"Entrez Gene\", \"entrezgene\"),\n (\"Score\", \"score\"),\n (\"Q-value\", \"qvalue\"),\n (\"Gene Symbol (May2005)\", \"genesymbol1\"),\n (\"Entrez Gene (May 2005)\", \"entrezgene1\"),\n (\"Unigene (Release # 184)\", \"unigene\",),\n (\"DR3 cons.\",\"d3_cons\" ),\n (\"DR3 1 mism.\",\"d3_mismatch\",),\n (\"ER6 cons.\", \"er6_cons\"), )\n\n old_headers = set( [x[0] for x in headers] )\n new_headers = [x[1] for x in headers]\n take = []\n outs = P.getTempFile()\n first = True\n\n reader = csv.reader( open(infile,\"rU\") )\n for row in reader:\n if first:\n first = False\n for x, old_header in enumerate(row ):\n if old_header in old_headers: take.append( x )\n outs.write(\"\\t\".join(new_headers)+ \"\\n\")\n else:\n new_row = []\n for x in take:\n if row[x].strip() != \"---\":\n new_row.append(row[x].strip())\n else:\n new_row.append(\"\")\n outs.write(\"\\t\".join( new_row )+ \"\\n\")\n \n outs.close()\n tmpname = outs.name\n tablename = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=probeset \\\n --index=genesymbol \\\n --table=%(tablename)s \\\n < %(tmpname)s > %(outfile)s\n '''\n P.run()\n\n os.unlink( tmpname )", "metadata": "root.importExpressionWang", "header": "['module', '___EOS___']", "index": 5630 }, { "content": "@files( ((PARAMS[\"filename_expression_kovalenko\"], \"expression_kovalenko.import\"), ) )\ndef importExpressionKovalenko( infile, outfile ):\n '''import gene expression data from Kovalenko et al. (2010) \n\n Converts negative fold change into ratios and % qvalues\n into qvalues.\n '''\n\n dbhandle = sqlite3.connect( PARAMS[\"database\"] )\n cc = dbhandle.cursor()\n map_name2id = dict( cc.execute( \"SELECT UPPER(gene_name), gene_id FROM gene_info\" ).fetchall() )\n\n headers = (\n (\"affy_id\", \"probeset\"),\n (\"gene_name\", \"gene_id\"),\n (\"fold_6\", \"fold_6\"),\n (\"qvalue_6\", \"qvalue_6\"),\n (\"fold_24\", \"fold_24\"),\n (\"qvalue_24\", \"qvalue_24\"),\n (\"fold_48\", \"fold_48\"),\n (\"qvalue_48\", \"qvalue_48\"),\n )\n\n old_headers = set( [x[0] for x in headers] )\n new_headers = [x[1] for x in headers]\n take = []\n outs = P.getTempFile()\n first = True\n\n counts = E.Counter()\n\n reader = csv.reader( open(infile,\"rU\") )\n notfound = set()\n for row in reader:\n if first:\n first = False\n for x, old_header in enumerate(row ):\n if old_header in old_headers: take.append( x )\n outs.write(\"\\t\".join(new_headers)+ \"\\n\")\n else:\n skip = False\n new_row = []\n for x in take:\n if headers[x][0].startswith(\"fold\"):\n foldval = float( row[x] )\n if foldval < 0: \n row[x] = str( -1.0 / foldval )\n elif headers[x][0].startswith(\"qvalue\"):\n qvalue = float( row[x] )\n row[x] = str(qvalue / 100.0)\n elif headers[x][0].startswith(\"gene_name\"):\n parts = [ c.upper().strip() for c in row[x].split(\"//\") ]\n\n for part in parts:\n if part in map_name2id:\n row[x] = map_name2id[part].upper()\n counts.found += 1\n break\n else:\n counts.notfound += 1\n notfound.add( row[x] )\n skip = True\n break\n\n\n if row[x].strip() != \"---\":\n new_row.append(row[x].strip())\n else:\n new_row.append(\"\")\n \n if skip: continue\n outs.write(\"\\t\".join( new_row )+ \"\\n\")\n\n outs.close()\n tmpname = outs.name\n tablename = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --index=probeset \\\n --index=gene_id \\\n --table=%(tablename)s \\\n < %(tmpname)s > %(outfile)s\n '''\n P.run()\n\n os.unlink( tmpname )\n\n E.info( \"%s\" % str(counts))\n if notfound:\n E.warn(\"not found: %s\" % str(notfound) )", "metadata": "root.importExpressionKovalenko", "header": "['module', '___EOS___']", "index": 5695 }, { "content": "@transform( buildGeneSet, suffix(\".gtf\"), \"_roi.import\" )\ndef importOverlapRegionsOfInterestEnsembl( infile, outfile ):\n '''compute overlap of intervals with regions of interest.'''\n\n tmpfilename = P.getTempFilename( \".\" )\n \n PGeneset.buildOverlapWithEnsembl( infile, \n tmpfilename,\n \"roi.bed\" )\n\n tablename = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --allow-empty \\\n --index=interval_id \\\n --index=roi_id \\\n --table=%(tablename)s \\\n < %(tmpfilename)s > %(outfile)s\n '''\n\n P.run()\n \n os.unlink( tmpfilename )\n os.unlink( tmpfilename+\".log\" )", "metadata": "root.importOverlapRegionsOfInterestEnsembl", "header": "['module', '___EOS___']", "index": 5826 }, { "content": "@transform( buildGeneSet, suffix(\".gtf\"), \"_gwas.import\" )\ndef importGWASEnsembl( infile, outfile ):\n '''compute overlap of intervals with regions of interest.'''\n\n tmpfilename = P.getTempFilename( \".\" )\n \n PGeneset.buildOverlapWithEnsembl( infile, \n tmpfilename,\n \"gwas.bed\" )\n\n tablename = outfile[:-len(\".import\")]\n\n statement = '''\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --allow-empty \\\n --index=interval_id \\\n --index=roi_id \\\n --table=%(tablename)s \\\n < %(tmpfilename)s > %(outfile)s\n '''\n\n P.run()\n \n os.unlink( tmpfilename )\n os.unlink( tmpfilename+\".log\" )", "metadata": "root.importGWASEnsembl", "header": "['module', '___EOS___']", "index": 5855 }, { "content": "@follows( buildGeneRegions, importRegionsOfInterest )\n@files( [ ( (\"%s.bed\" % x, \"%s.bed\" % y), \"%s_%s.import\" % (x,y)) \n for x,y in itertools.product( TRACKS_ANNOTATOR, TRACKS_REGIONS) ] )\ndef importOverlapRegions( infiles, outfile ):\n '''compute overlap of infile with bedfile.\n '''\n\n infile, bedfile = infiles\n\n tablename = outfile[:-len(\".import\")]\n to_cluster = True\n statement = '''\n python %(scriptsdir)s/bed2graph.py \\\n --output=name \\\n --log=%(outfile)s \\\n %(infile)s %(bedfile)s |\\\n sed \"s/name1/interval_id/; s/name2/roi_id/\" |\\\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\\n --allow-empty \\\n --index=interval_id \\\n --index=roi_id \\\n --table=%(tablename)s \\\n > %(outfile)s\n '''\n \n P.run()", "metadata": "root.importOverlapRegions", "header": "['module', '___EOS___']", "index": 5884 }, { "content": "@transform( buildSNPCoverage, suffix( \".snpcoverage\" ), \"_snpcoverage.import\")\ndef importSNPCoverage( infile, outfile ):\n\n tablename = outfile[:-len(\".import\")]\n \n statement = '''\n sed \"s/chromosome/contig/\" < %(infile)s |\\\n python %(scriptsdir)s/csv2db.py %(csv2db_options)s \\ \n --allow-empty \\\n --index=snp \\\n --index=genesymbol \\\n --table=%(tablename)s \\\n > %(outfile)s\n '''\n P.run()", "metadata": "root.importSNPCoverage", "header": "['module', '___EOS___']", "index": 5987 } ]
[ { "span": "statement ", "start_line": 145, "start_column": 4, "end_line": 145, "end_column": 13 }, { "span": "to_cluster ", "start_line": 175, "start_column": 4, "end_line": 175, "end_column": 14 }, { "span": "statement ", "start_line": 177, "start_column": 4, "end_line": 177, "end_column": 13 }, { "span": "table ", "start_line": 315, "start_column": 4, "end_line": 315, "end_column": 9 }, { "span": "statement ", "start_line": 317, "start_column": 4, "end_line": 317, "end_column": 13 }, { "span": "table ", "start_line": 727, "start_column": 4, "end_line": 727, "end_column": 9 }, { "span": "statement ", "start_line": 729, "start_column": 4, "end_line": 729, "end_column": 13 }, { "span": "track ", "start_line": 778, "start_column": 4, "end_line": 778, "end_column": 9 }, { "span": "tmpfilename ", "start_line": 781, "start_column": 4, "end_line": 781, "end_column": 15 }, { "span": "statement ", "start_line": 805, "start_column": 4, "end_line": 805, "end_column": 13 }, { "span": "tmpfilename ", "start_line": 898, "start_column": 8, "end_line": 898, "end_column": 19 }, { "span": "statement ", "start_line": 916, "start_column": 8, "end_line": 916, "end_column": 17 }, { "span": "to_cluster ", "start_line": 1492, "start_column": 8, "end_line": 1492, "end_column": 18 }, { "span": "prefix ", "start_line": 1501, "start_column": 8, "end_line": 1501, "end_column": 14 }, { "span": "statement ", "start_line": 1503, "start_column": 8, "end_line": 1503, "end_column": 17 }, { "span": "to_cluster ", "start_line": 2321, "start_column": 4, "end_line": 2321, "end_column": 14 }, { "span": "job_queue ", "start_line": 2322, "start_column": 4, "end_line": 2322, "end_column": 13 }, { "span": "statement ", "start_line": 2324, "start_column": 4, "end_line": 2324, "end_column": 13 }, { "span": "table ", "start_line": 2342, "start_column": 4, "end_line": 2342, "end_column": 9 }, { "span": "statement ", "start_line": 2344, "start_column": 4, "end_line": 2344, "end_column": 13 }, { "span": "dbhandle ", "start_line": 2372, "start_column": 4, "end_line": 2372, "end_column": 12 }, { "span": "table ", "start_line": 2492, "start_column": 4, "end_line": 2492, "end_column": 9 }, { "span": "statement ", "start_line": 2494, "start_column": 4, "end_line": 2494, "end_column": 13 }, { "span": "table ", "start_line": 2656, "start_column": 4, "end_line": 2656, "end_column": 9 }, { "span": "statement ", "start_line": 2658, "start_column": 4, "end_line": 2658, "end_column": 13 }, { "span": "table ", "start_line": 2786, "start_column": 4, "end_line": 2786, "end_column": 9 }, { "span": "statement ", "start_line": 2788, "start_column": 4, "end_line": 2788, "end_column": 13 }, { "span": "table ", "start_line": 2805, "start_column": 4, "end_line": 2805, "end_column": 9 }, { "span": "statement ", "start_line": 2807, "start_column": 4, "end_line": 2807, "end_column": 13 }, { "span": "table ", "start_line": 2826, "start_column": 4, "end_line": 2826, "end_column": 9 }, { "span": "statement ", "start_line": 2828, "start_column": 4, "end_line": 2828, "end_column": 13 }, { "span": "to_cluster ", "start_line": 2847, "start_column": 4, "end_line": 2847, "end_column": 14 }, { "span": "infile,", "start_line": 2848, "start_column": 4, "end_line": 2848, "end_column": 10 }, { "span": "probeset ", "start_line": 2848, "start_column": 12, "end_line": 2848, "end_column": 20 }, { "span": "statement ", "start_line": 2849, "start_column": 4, "end_line": 2849, "end_column": 13 }, { "span": "tablename ", "start_line": 2871, "start_column": 4, "end_line": 2871, "end_column": 13 }, { "span": "statement ", "start_line": 2873, "start_column": 4, "end_line": 2873, "end_column": 13 }, { "span": "options ", "start_line": 2969, "start_column": 8, "end_line": 2969, "end_column": 15 }, { "span": "options ", "start_line": 2971, "start_column": 8, "end_line": 2971, "end_column": 15 }, { "span": "infiles ", "start_line": 2973, "start_column": 4, "end_line": 2973, "end_column": 11 }, { "span": "statement ", "start_line": 2975, "start_column": 4, "end_line": 2975, "end_column": 13 }, { "span": "tablename ", "start_line": 2992, "start_column": 4, "end_line": 2992, "end_column": 13 }, { "span": "statement ", "start_line": 2994, "start_column": 4, "end_line": 2994, "end_column": 13 }, { "span": "options ", "start_line": 3021, "start_column": 8, "end_line": 3021, "end_column": 15 }, { "span": "options ", "start_line": 3023, "start_column": 8, "end_line": 3023, "end_column": 15 }, { "span": "to_cluster ", "start_line": 3025, "start_column": 4, "end_line": 3025, "end_column": 14 }, { "span": "infiles ", "start_line": 3027, "start_column": 4, "end_line": 3027, "end_column": 11 }, { "span": "statement ", "start_line": 3028, "start_column": 4, "end_line": 3028, "end_column": 13 }, { "span": "tablename ", "start_line": 3047, "start_column": 4, "end_line": 3047, "end_column": 13 }, { "span": "statement ", "start_line": 3049, "start_column": 4, "end_line": 3049, "end_column": 13 }, { "span": "to_cluster ", "start_line": 3170, "start_column": 4, "end_line": 3170, "end_column": 14 }, { "span": "job_options ", "start_line": 3171, "start_column": 4, "end_line": 3171, "end_column": 15 }, { "span": "infiles ", "start_line": 3173, "start_column": 4, "end_line": 3173, "end_column": 11 }, { "span": "statement ", "start_line": 3175, "start_column": 4, "end_line": 3175, "end_column": 13 }, { "span": "to_cluster ", "start_line": 3314, "start_column": 4, "end_line": 3314, "end_column": 14 }, { "span": "job_queue ", "start_line": 3315, "start_column": 4, "end_line": 3315, "end_column": 13 }, { "span": "job_options ", "start_line": 3316, "start_column": 4, "end_line": 3316, "end_column": 15 }, { "span": "statement ", "start_line": 3368, "start_column": 4, "end_line": 3368, "end_column": 13 }, { "span": "to_cluster ", "start_line": 3532, "start_column": 4, "end_line": 3532, "end_column": 14 }, { "span": "job_queue ", "start_line": 3533, "start_column": 4, "end_line": 3533, "end_column": 13 }, { "span": "min_sequences ", "start_line": 3547, "start_column": 4, "end_line": 3547, "end_column": 17 }, { "span": "statement ", "start_line": 3548, "start_column": 4, "end_line": 3548, "end_column": 13 }, { "span": "to_cluster ", "start_line": 3583, "start_column": 8, "end_line": 3583, "end_column": 18 }, { "span": "statement ", "start_line": 3584, "start_column": 8, "end_line": 3584, "end_column": 17 }, { "span": "query_id,", "start_line": 3605, "start_column": 13, "end_line": 3605, "end_column": 21 }, { "span": "target_id,", "start_line": 3605, "start_column": 23, "end_line": 3605, "end_column": 32 }, { "span": "optimal_offset,", "start_line": 3606, "start_column": 13, "end_line": 3606, "end_column": 27 }, { "span": "pvalue,", "start_line": 3606, "start_column": 29, "end_line": 3606, "end_column": 35 }, { "span": "qvalue,", "start_line": 3606, "start_column": 37, "end_line": 3606, "end_column": 43 }, { "span": "overlap,", "start_line": 3606, "start_column": 45, "end_line": 3606, "end_column": 52 }, { "span": "query_consensus,", "start_line": 3606, "start_column": 54, "end_line": 3606, "end_column": 69 }, { "span": "target_consensus,", "start_line": 3607, "start_column": 13, "end_line": 3607, "end_column": 29 }, { "span": "orientation)", "start_line": 3607, "start_column": 31, "end_line": 3607, "end_column": 42 }, { "span": "tablename ", "start_line": 3613, "start_column": 8, "end_line": 3613, "end_column": 17 }, { "span": "statement ", "start_line": 3615, "start_column": 8, "end_line": 3615, "end_column": 17 }, { "span": "to_cluster ", "start_line": 3686, "start_column": 4, "end_line": 3686, "end_column": 14 }, { "span": "job_queue ", "start_line": 3687, "start_column": 4, "end_line": 3687, "end_column": 13 }, { "span": "job_options ", "start_line": 3690, "start_column": 4, "end_line": 3690, "end_column": 15 }, { "span": "statement ", "start_line": 3709, "start_column": 8, "end_line": 3709, "end_column": 17 }, { "span": "to_cluster ", "start_line": 3728, "start_column": 4, "end_line": 3728, "end_column": 14 }, { "span": "job_options ", "start_line": 3732, "start_column": 4, "end_line": 3732, "end_column": 15 }, { "span": "nseq ", "start_line": 3736, "start_column": 4, "end_line": 3736, "end_column": 8 }, { "span": "statement ", "start_line": 3742, "start_column": 4, "end_line": 3742, "end_column": 13 }, { "span": "to_cluster ", "start_line": 3878, "start_column": 4, "end_line": 3878, "end_column": 14 }, { "span": "job_options ", "start_line": 3879, "start_column": 4, "end_line": 3879, "end_column": 15 }, { "span": "nseq ", "start_line": 3885, "start_column": 8, "end_line": 3885, "end_column": 12 }, { "span": "nseq ", "start_line": 3891, "start_column": 8, "end_line": 3891, "end_column": 12 }, { "span": "nseq ", "start_line": 3897, "start_column": 8, "end_line": 3897, "end_column": 12 }, { "span": "arrangements ", "start_line": 3905, "start_column": 4, "end_line": 3905, "end_column": 16 }, { "span": "statement ", "start_line": 3907, "start_column": 4, "end_line": 3907, "end_column": 13 }, { "span": "to_cluster ", "start_line": 4279, "start_column": 4, "end_line": 4279, "end_column": 14 }, { "span": "statement ", "start_line": 4280, "start_column": 4, "end_line": 4280, "end_column": 13 }, { "span": "tablename ", "start_line": 4305, "start_column": 4, "end_line": 4305, "end_column": 13 }, { "span": "statement ", "start_line": 4307, "start_column": 4, "end_line": 4307, "end_column": 13 }, { "span": "statement ", "start_line": 4335, "start_column": 4, "end_line": 4335, "end_column": 13 }, { "span": "to_cluster ", "start_line": 4365, "start_column": 4, "end_line": 4365, "end_column": 14 }, { "span": "statement ", "start_line": 4366, "start_column": 4, "end_line": 4366, "end_column": 13 }, { "span": "to_cluster ", "start_line": 4385, "start_column": 4, "end_line": 4385, "end_column": 14 }, { "span": "statement ", "start_line": 4386, "start_column": 4, "end_line": 4386, "end_column": 13 }, { "span": "nskipped ", "start_line": 4479, "start_column": 4, "end_line": 4479, "end_column": 12 }, { "span": "tablename ", "start_line": 4553, "start_column": 4, "end_line": 4553, "end_column": 13 }, { "span": "statement ", "start_line": 4555, "start_column": 4, "end_line": 4555, "end_column": 13 }, { "span": "headers ", "start_line": 5613, "start_column": 12, "end_line": 5613, "end_column": 19 }, { "span": "tablename ", "start_line": 5677, "start_column": 4, "end_line": 5677, "end_column": 13 }, { "span": "statement ", "start_line": 5679, "start_column": 4, "end_line": 5679, "end_column": 13 }, { "span": "tablename ", "start_line": 5770, "start_column": 4, "end_line": 5770, "end_column": 13 }, { "span": "statement ", "start_line": 5772, "start_column": 4, "end_line": 5772, "end_column": 13 }, { "span": "tablename ", "start_line": 5836, "start_column": 4, "end_line": 5836, "end_column": 13 }, { "span": "statement ", "start_line": 5838, "start_column": 4, "end_line": 5838, "end_column": 13 }, { "span": "tablename ", "start_line": 5865, "start_column": 4, "end_line": 5865, "end_column": 13 }, { "span": "statement ", "start_line": 5867, "start_column": 4, "end_line": 5867, "end_column": 13 }, { "span": "infile,", "start_line": 5891, "start_column": 4, "end_line": 5891, "end_column": 10 }, { "span": "bedfile ", "start_line": 5891, "start_column": 12, "end_line": 5891, "end_column": 19 }, { "span": "tablename ", "start_line": 5893, "start_column": 4, "end_line": 5893, "end_column": 13 }, { "span": "to_cluster ", "start_line": 5894, "start_column": 4, "end_line": 5894, "end_column": 14 }, { "span": "statement ", "start_line": 5895, "start_column": 4, "end_line": 5895, "end_column": 13 }, { "span": "tablename ", "start_line": 5990, "start_column": 4, "end_line": 5990, "end_column": 13 }, { "span": "statement ", "start_line": 5992, "start_column": 4, "end_line": 5992, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "files_", "(_", "\"", "geno", "me", ".", "fasta", "\"_", ",_", "\"", "geno", "me", ".", "fa", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index", "Genome", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "index", " ", "the", " ", "geno", "me", " ", "for", " ", "samtools", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sam", "tool", "s", " ", "doe", "s", " ", "not", " ", "like", " ", "long", " ", "lines", ",", " ", "so", " ", "create", " ", "a", " ", "new", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "split", " ", "lines", " ", "(", "what", " ", "a", " ", "wast", "e", ").", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "fold", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pysam", "_", "._", "fai", "dx_", "(_", "outfile_", ")_", "\\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_", "@_", "files_", "(_", "\"", "geno", "me", ".", "fasta", "\"_", ",_", "\"", "geno", "me", "\\u", "gc", ".", "bed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Genome", "GC", "Segmentation", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "segment", " ", "the", " ", "geno", "me", " ", "int", "o", " ", "windows", " ", "according", " ", "to", " ", "G", "+", "C", " ", "content", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "fasta", "2b", "ed", ".", "py", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "method", "=", "fixed", "-", "widt", "h", "-", "windows", " ", "--", "window", "-", "size", "=", "1000", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "geno", "me", ")", "s", ".", "fasta", " ", ">", " ", "%", "(", "outfile", ")", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files_", "(_", "(_", "(_", "PARAMS_", "[_", "\"", "filename", "\\u", "regions", "\\u", "of", "\\u", "interest", "\"_", "]_", ",_", "\"", "roi", ".", "import", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "PARAMS_", "[_", "\"", "filename", "\\u", "selection", "\"_", "]_", ",_", "\"", "selection", ".", "import", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Regions", "Of", "Interest", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "regions", " ", "of", " ", "interest", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "dialect", "=", "exce", "l", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "index", "=", "class", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "index", "=", "roi", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "map", "=", "roi", "\\u", "id", ":", "str", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "map", "=", "start", ":", "int", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "map", "=", "end", ":", "int", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "merge_", "(_", "PARAMS_", "[_", "\"", "filename", "\\u", "snp", "s", "\\u", "of", "\\u", "interest", "\"_", "]_", ",_", "\"", "snp", "s", "\\u", "of", "\\u", "interest", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "SN", "Ps", "Of", "Interest", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "regions", " ", "of", " ", "interest", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "dialect", "=", "exce", "l", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "index", "=", "snp", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "map", "=", "snp", ":", "str", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "map", "=", "pos", ":", "int", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files_", "(_", "[_", "(_", "\"%", "s", ".", "bed", "\"_", "%_", "x_", ",_", "\"%", "s", "\\u", "interval", "s", ".", "import", "\"_", "%_", "x_", ")_", "for_", "x_", "in_", "TRACK", "S", "\\u", "REFERENCE", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Reference", "Intervals", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "reference", " ", "interval", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "add", " ", "the", " ", "bed", " ", "interval", "s", " ", "back", " ", "to", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "track_", "=_", "infile_", "[_", ":_", "-_", "len_", "(_", "\".", "bed", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", "delete_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile", "name_", "=_", "tmpfile_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "(_", "\"", "Av", "g", "Val", "\"_", ",_", "\"", "Dist", "to", "Start", "\"_", ",_", "\"", "Gene", "List", "\"_", ",_", "\"", "Length", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Peak", "Center", "\"_", ",_", "\"", "Peak", "Val", "\"_", ",_", "\"", "Position", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interval", "\\u", "id", "\"_", ",_", "\"", "n", "Cp", "Gs", "\"_", ",_", "\"", "n", "Genes", "\"_", ",_", "\"", "n", "Peak", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "n", "Probe", "s", "\"_", ",_", "\"", "n", "Promot", "ers", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "conti", "g", "\"_", ",_", "\"", "start", "\"_", ",_", "\"", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "avg", "val_", ",_", "contig_", ",_", "dist", "tost", "art_", ",_", "end_", ",_", "gene", "list_", ",_", "length_", ",_", "peak", "center_", ",_", "peak", "val_", ",_", "position_", ",_", "start_", ",_", "interval", "\\u", "id_", ",_", "ncp", "gs_", ",_", "ngen", "es_", ",_", "npe", "ak", "s_", ",_", "npr", "obe", "s_", ",_", "npr", "omo", "ters_", "=_", "0_", ",_", "\"\"_", ",_", "0_", ",_", "0_", ",_", "\"\"_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "headers_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "open_", "(_", "infile_", ",_", "\"", "r", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contig_", ",_", "start_", ",_", "end_", ",_", "interval", "\\u", "id_", "=_", "line_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "[_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", ",_", "end_", "=_", "int_", "(_", "start_", ")_", ",_", "int_", "(_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "end_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npe", "ak", "s_", ",_", "peak", "center_", "=_", "1_", ",_", "start_", "+_", "int_", "(_", "length_", "/_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avg", "val_", ",_", "peak", "val_", ",_", "npr", "obe", "s_", "=_", "1_", ",_", "1_", ",_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "(_", "avg", "val_", ",_", "dist", "tost", "art_", ",_", "gene", "list_", ",_", "length_", ",_", "peak", "center_", ",_", "peak", "val_", ",_", "position_", ",_", "interval", "\\u", "id_", ",_", "ncp", "gs_", ",_", "ngen", "es_", ",_", "npe", "ak", "s_", ",_", "npr", "obe", "s_", ",_", "npr", "omo", "ters_", ",_", "contig_", ",_", "start_", ",_", "end_", ")_", ")_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmpfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "interval", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "track", ")", "s", "\\u", "interval", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "tmpfile", "name", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpfile_", "._", "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_", "@_", "transform_", "(_", "\"*", ".", "interval", "s", "\"_", ",_", "suffix_", "(_", "\".", "interval", "s", "\"_", ")_", ",_", "\"\\u", "interval", "s", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Intervals", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "add", " ", "the", " ", "bed", " ", "interval", "s", " ", "back", " ", "to", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "track_", "=_", "infile_", "[_", ":_", "-_", "len_", "(_", "\".", "interval", "s", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", "delete_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile", "name_", "=_", "tmpfile_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "\\u", "id2", "coords_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "open_", "(_", "track_", "+_", "\".", "bed", "\"_", ",_", "\"", "r", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contig_", ",_", "start_", ",_", "end_", ",_", "id_", "=_", "line_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "[_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "\\u", "id2", "coords_", "[_", "id_", "]_", "=_", "(_", "contig_", ",_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "open_", "(_", "infile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "startswith_", "(_", "\"", "interval", "\\u", "id", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmpfile_", "._", "write_", "(_", "\"%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "(_", "line_", "[_", ":_", "-_", "1_", "]_", ",_", "\"", "conti", "g", "\"_", ",_", "\"", "start", "\"_", ",_", "\"", "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 ", " _", "id_", "=_", "line_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tmpfile_", "._", "write_", "(_", "\"%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "(_", "line_", "[_", ":_", "-_", "1_", "]_", ",_", ")_", "+_", "map", "\\u", "id2", "coords_", "[_", "id_", "]_", ")_", ")_", "\\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 ", " ", "_", "P_", "._", "warn_", "(_", "\"%", "s", " ", "->", " ", "interval", " ", "%", "s", " ", "-", " ", "omit", "ted", " ", "due", " ", "to", " ", "mapping", " ", "problem", "s", "\"_", "%_", "(_", "infile_", ",_", "id_", ")_", ")_", "\\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_", "tmpfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "interval", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "track", ")", "s", "\\u", "interval", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "tmpfile", "name", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpfile_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "follow", "s_", "(_", "index", "Genome", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "transform_", "(_", "PARAMS_", "[_", "\"", "filename", "\\u", "reads", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "regex_", "(_", "\"(", "\\\\", "S", "+)", ".", "export", ".", "txt", ".", "gz", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\\\\", "1", ".", "bam", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "BAM", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "re", "-", "map", " ", "ela", "nd", " ", "format", "ted", " ", "reads", " ", "with", " ", "bowtie", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", " ", "4", "Gb", " ", "of", " ", "free", " ", "memory_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "options_", "=_", "\"-", "l", " ", "mem", "\\u", "free", "=", "4000", "M", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "options_", "+=_", "\"", " ", "-", "q", " ", "server", "\\u", "jobs", ".", "q", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile", "name_", "=_", "P_", "._", "get", "Temp", "Filename_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "bam", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "gun", "zip", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "aw", "k", " ", "'$", "11", " ", "!=", " ", "\"", "QC", "\"", " ", "||", " ", "$", "10", " ", "~", " ", "/(", "\\\\", "d", "+)", ":(", "\\\\", "d", "+)", ":(", "\\\\", "d", "+)", "/", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", "{", " ", "if", " ", "($", "1", " ", "!=", " ", "\"\"", ")", " ", "{", " ", "read", "name", "=", "sprint", "f", "(", " ", "\"%%", "s", "\\u", "%%", "s", ":", "%%", "s", ":", "%%", "s", ":", "%%", "s", ":", "%%", "s", "\",", " ", "$", "1", ",", "$", "2", ",", "$", "3", ",", "$", "4", ",", "$", "5", ",", "$", "6", ");", "}", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "else", " ", "{", " ", "read", "name", "=", "sprint", "f", "(", " ", "\"%%", "s", ":", "%%", "s", ":", "%%", "s", ":", "%%", "s", ":", "%%", "s", "\",", " ", "$", "1", ",", "$", "3", ",", "$", "4", ",", "$", "5", ",", "$", "6", ");", " ", "}", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "printf", "(\"", "@", "%%", "s", "\\\\\\\\", "n", "%%", "s", "\\\\\\\\", "n", "+\\\\", "\\\\", "n", "%%", "s", "\\\\\\\\", "n", "\",", "read", "name", ",", "$", "9", ",", "$", "10", ");", "}'", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "bowtie", " ", "--", "sam", " ", "%", "(", "inte", "vals", "\\u", "bowtie", "\\u", "options", ")", "s", " ", "%", "(", "interval", "s", "\\u", "bowtie", "\\u", "index", ")", "s", " ", "-", " ", "2", ">", "%", "(", "outfile", ")", "s", ".", "log", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "samtools", " ", "import", " ", "%", "(", "geno", "me", ")", "s", " ", "-", " ", "%", "(", "tmpfile", "name", ")", "s", " ", ">", "&", " ", "%", "(", "outfile", ")", "s", ".", "log", ";", "\\", "10", ";", " ", " ", " ", " ", "samtools", " ", "sort", " ", "%", "(", "tmpfile", "name", ")", "s", " ", "%", "(", "prefix", ")", "s", ";", "\\", "10", ";", " ", " ", " ", " ", "samtools", " ", "index", " ", "%", "(", "outfile", ")", "s", ";", "\\", "10", ";", " ", " ", " ", " ", "rm", " ", "-", "f", " ", "%", "(", "tmpfile", "name", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "tmpfile", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "unlink_", "(_", "tmpfile", "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_", "@_", "files", "\\u", "re_", "(_", "(_", "build", "BAM", "_", ",_", "normali", "ze", "BAM", "Per", "Experiment_", ",_", "normali", "ze", "BAM", "Per", "Replica", "te_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"(.", "*)", ".", "bam", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\\\\", "1", ".", "big", "wig", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Big", "wig", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "convert", " ", "BAM", " ", "to", " ", "big", "wig", " ", "file", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "bed", "To", "Big", "Bed", " ", "on", " ", "the", " ", "32", " ", "bit", " ", "cluster_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "queue_", "=_", "\"", "server", "\\u", "jobs", ".", "q", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bam", "2w", "ig", "gle", ".", "py", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "geno", "me", "-", "file", "=", "%", "(", "geno", "me", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "output", "-", "format", "=", "big", "wig", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "output", "-", "filename", "=", "%", "(", "outfile", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "infile", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", ".", "log", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files_", "(_", "(_", "(_", "PARAMS_", "[_", "\"", "filename", "\\u", "aff", "yme", "trix", "\"_", "]_", ",_", "\"", "aff", "yme", "trix", "\\u", "import", "\"_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Aff", "yme", "trix", "Annotation_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "aff", "yme", "trix", " ", "prob", "e", " ", "annot", "ation", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "\"", "aff", "yme", "trix", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "gun", "zip", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "sed", " ", "\"", "s", "/", "probes", "et", "\\u", "id", "/", "probes", "et", "/\"", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "dialect", "=", "exce", "l", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "probes", "et", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "mr", "na", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files_", "(_", "import", "Aff", "yme", "trix", "Annotation_", ",_", "\"", "probes", "et", "2t", "rans", "cript", ".", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Probe", "set", "2", "Transcript", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "build", " ", "map", " ", "relati", "ng", " ", "a", " ", "probes", "et", " ", "to", " ", "a", " ", "transcri", "pt", "\\u", "id", ",", " ", "gene", "\\u", "id", ",", " ", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "only", " ", "take", " ", "tho", "se", " ", "tha", "t", " ", "can", " ", "be", " ", "mapp", "ed", " ", "to", " ", "transcripts", " ", "in", " ", "table", " ", "transcripts", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "check", " ", "consiste", "nc", "y", " ", "of", " ", "location", " ", "with", " ", "transcripts", " ", "in", " ", "table", " ", "transcripts", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "remove", " ", "tho", "se", " ", "with", " ", "cross", " ", "hybrid", "yz", "ation", " ", "signal", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "andle", "_", "=_", "sqlite3_", "._", "connect_", "(_", "PARAMS_", "[_", "\"", "databa", "se", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "debug_", "(_", "\"", "collecti", "ng", " ", "exon", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "Error_", "(_", "\"", "check", " ", "fast", "gtf", " ", "and", " ", "gzip", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "gzip_", "._", "open_", "(_", "PARAMS_", "[_", "\"", "transcripts", "\"_", "]_", ")_", "as_", "inf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exons_", "=_", "GT", "F_", "._", "read", "And", "Index_", "(_", "GT", "F_", "._", "iterator_", "(_", "inf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "E_", "._", "debug_", "(_", "\"", "collecti", "ng", " ", "transcripts", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "dbh", "andle", "_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "\"", "SELECT", " ", "transcri", "pt", "\\u", "id", ",", " ", "gene", "\\u", "id", ",", " ", "source", ",", " ", "conti", "g", ",", " ", "min", "(", "start", "),", " ", "max", "(", "end", "),", " ", "strand", " ", "FROM", " ", "transcripts", " ", "GROU", "P", " ", "BY", " ", "transcri", "pt", "\\u", "id", ",", " ", "gene", "\\u", "id", ",", " ", "source", ",", " ", "conti", "g", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "._", "execute_", "(_", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "\\u", "transcri", "pt", "2g", "ene", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "transcri", "pt", "\\u", "id_", ",_", "gene", "\\u", "id_", ",_", "source_", ",_", "contig_", ",_", "start_", ",_", "end_", ",_", "strand_", "in_", "cc_", "._", "fetchall_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map", "\\u", "transcri", "pt", "2g", "ene", "_", "[_", "transcri", "pt", "\\u", "id_", "]_", "=_", "(_", "gene", "\\u", "id_", ",_", "source_", ",_", "contig_", ",_", "start_", ",_", "end_", ",_", "strand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "counter_", "=_", "E_", "._", "Counter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cc_", "=_", "dbh", "andle", "_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "\"", "SELECT", " ", "probes", "et", ",", " ", "transcri", "pt", "\\u", "cluster", "\\u", "id", ",", " ", "seqn", "ame", ",", " ", "start", ",", " ", "stop", ",", " ", "mr", "na", "\\u", "assign", "ment", ",", " ", "cross", "hy", "b", "\\u", "type", " ", "FROM", " ", "aff", "yme", "trix", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "._", "execute_", "(_", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outf", "\\u", "notfound", "_", "=_", "open_", "(_", "outfile_", "+_", "\".", "notfound", "\"_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outf", "\\u", "notfound", "_", "._", "write_", "(_", "\"", "probes", "et", "\\\\", "tca", "use", "\\\\", "tcon", "tig", "\\\\", "tstart", "\\\\", "tend", "\\\\", "tm", "rna", "\\u", "assign", "ment", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outf_", "=_", "open_", "(_", "outfile_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outf_", "._", "write_", "(_", "\"", "probes", "et", "\\\\", "tcl", "uste", "r", "\\u", "id", "\\\\", "tpr", "obe", "\\u", "conti", "g", "\\\\", "tpr", "obe", "\\u", "start", "\\\\", "tpr", "obe", "\\u", "end", "\\\\", "ttr", "ans", "cript", "\\u", "id", "\\\\", "tge", "ne", "\\u", "id", "\\\\", "ts", "ource", "\\\\", "tcon", "tig", "\\\\", "tstart", "\\\\", "tend", "\\\\", "tstr", "and", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gene", "s", "\\u", "found_", ",_", "transcripts", "\\u", "found_", "=_", "set_", "(_", ")_", ",_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "probes", "et_", ",_", "transcri", "pt", "\\u", "cluster", "\\u", "id_", ",_", "contig_", ",_", "start_", ",_", "end_", ",_", "mr", "na", "\\u", "assignment_", ",_", "cross", "hy", "b", "\\u", "type_", "in_", "cc_", "._", "fetchall_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mr", "na", "\\u", "assignment_", "==_", "\"--", "-\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "._", "probes", "ets", "\\u", "unassign", "ed_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "[_", "x_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "\"", " ", "//", " ", "\"_", ")_", "for_", "x_", "in_", "mr", "na", "\\u", "assignment_", "._", "split_", "(_", "\"//", "/\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", ",_", "mapped_", ",_", "mism", "appe", "d_", ",_", "nx", "hy", "b_", "=_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "collect", " ", "transcripts", " ", "by", " ", "exon", " ", "overlap_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "overlaps_", "=_", "[_", "x_", "[_", "2_", "]_", "for_", "x_", "in_", "exons_", "._", "get_", "(_", "contig_", ",_", "start_", ",_", "end_", ")_", "]_", "\\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 ", " _", "overlaps_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transcripts", "_", "=_", "set_", "(_", "[_", "x_", "._", "transcri", "pt", "\\u", "id_", "for_", "x_", "in_", "overlaps_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "transcri", "pt", "\\u", "id_", ",_", "seqn", "ame_", ",_", "score_", ",_", "direct", "\\u", "probes", "_", ",_", "possib", "le", "\\u", "probes", "_", ",_", "xh", "yb", "_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "xh", "yb", "_", "!=_", "\"", "0", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nx", "hy", "b_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "collect", " ", "transcripts", " ", "from", " ", "annot", "ation", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "transcri", "pt", "\\u", "id_", "._", "startswith_", "(_", "\"", "ENS", "T", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "+=_", "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 ", " ", "_", "gene", "\\u", "id_", ",_", "other", "\\u", "source_", ",_", "other", "\\u", "contig_", ",_", "other", "\\u", "start_", ",_", "other", "\\u", "end_", ",_", "other", "\\u", "strand_", "=_", "map", "\\u", "transcri", "pt", "2g", "ene", "_", "[_", "transcri", "pt", "\\u", "id_", "]_", "\\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 ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mapped_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "transcri", "pt", "\\u", "id_", "not_", "in_", "transcripts", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mism", "appe", "d_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other", "\\u", "contig_", "!=_", "contig_", "or_", "min_", "(_", "other", "\\u", "end_", ",_", "end_", ")_", "-_", "max_", "(_", "other", "\\u", "start_", ",_", "start_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mism", "appe", "d_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outf_", "._", "write_", "(_", "\"%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "probes", "et_", ",_", "transcri", "pt", "\\u", "cluster", "\\u", "id_", ",_", "contig_", ",_", "start_", ",_", "end_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transcri", "pt", "\\u", "id_", ",_", "gene", "\\u", "id_", ",_", "other", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "other", "\\u", "contig_", ",_", "other", "\\u", "start_", ",_", "other", "\\u", "end_", ",_", "other", "\\u", "strand_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gene", "s", "\\u", "found_", "._", "add_", "(_", "gene", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transcripts", "\\u", "found_", "._", "add_", "(_", "transcri", "pt", "\\u", "id_", ")_", "\\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_", "found_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "._", "probes", "ets", "\\u", "notfound", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "\"", "no", " ", "ENS", "EMBL", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mapped_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "._", "probes", "ets", "\\u", "unmapped", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "\"", "not", " ", "in", " ", "transcripts", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mapped_", ">_", "0_", "and_", "mapped_", "==_", "mism", "appe", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "._", "probes", "ets", "\\u", "mism", "appe", "d_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "\"", "mism", "appe", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mapped_", ">_", "0_", "and_", "mapped_", "==_", "nx", "hy", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "._", "probes", "ets", "\\u", "cross", "hy", "b_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "\"", "cross", "-", "hybrid", "ize", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mapped_", ">_", "0_", "and_", "mapped_", "==_", "nx", "hy", "b_", "+_", "mism", "appe", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "._", "probes", "ets", "\\u", "errors_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "\"", "error", "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 ", " _", "counter_", "._", "probes", "ets", "\\u", "found_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outf", "\\u", "notfound", "_", "._", "write_", "(_", "\"%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "probes", "et_", ",_", "code_", ",_", "contig_", ",_", "start_", ",_", "end_", ",_", "mr", "na", "\\u", "assignment_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outf", "\\u", "notfound", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outf_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "info_", "(_", "\"", "mapping", " ", "results", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "counter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "E_", "._", "info_", "(_", "\"", "gene", "s", " ", "found", ":", " ", "%", "i", "(%", "5.2", "f", "%%", "):", " ", "transcripts", " ", "found", " ", "%", "i", "(%", "5.2", "f", "%%", ")\"_", "%_", "(_", "len_", "(_", "gene", "s", "\\u", "found_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "100.0_", "*_", "len_", "(_", "gene", "s", "\\u", "found_", ")_", "/_", "len_", "(_", "set_", "(_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "map", "\\u", "transcri", "pt", "2g", "ene", "_", "._", "values_", "(_", ")_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "transcripts", "\\u", "found_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "100.0_", "*_", "len_", "(_", "transcripts", "\\u", "found_", ")_", "/_", "len_", "(_", "map", "\\u", "transcri", "pt", "2g", "ene", "_", "._", "keys_", "(_", ")_", ")_", ")_", ")_", "\\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_", "@_", "transform_", "(_", "build", "Probe", "set", "2", "Transcript", "_", ",_", "suffix_", "(_", "\".", "table", "\"_", ")_", ",_", "\"\\u", "table", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Probe", "set", "2", "Transcript", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\"\\u", "table", ".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "probes", "et", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "cluster", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "transcri", "pt", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "gene", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "build", "Expression", "Track", "s_", ",_", "suffix_", "(_", "\".", "data", "\"_", ")_", ",_", "\"\\u", "data", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Expression", "Track", "s_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\"\\u", "data", ".", "import", "\"_", ")_", "]_", "+_", "\"\\u", "level", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "cluster", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "(_", "build", "Expression", "Correla", "tion_", ",_", "build", "Expression", "Full", "Correla", "tion_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "suffix_", "(_", "\".", "correlation", "\"_", ")_", ",_", "\"\\u", "correlation", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Expression", "Correla", "tion_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "track", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "build", "Expression", "Track", "s_", ",_", "suffix_", "(_", "\".", "table", "\"_", ")_", ",_", "\"\\u", "table", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Expression", "Probe", "sets_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\"\\u", "table", ".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "cluster", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "mr", "na", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "gene", "symbol", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "build", "Expression", "Track", "s_", ",_", "suffix_", "(_", "\".", "map", "\"_", ")_", ",_", "\"\\u", "map", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Expression", "Map_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "table", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files", "\\u", "re_", "(_", "[_", "x_", "for_", "x_", "in_", "glob_", "._", "glob_", "(_", "\"", "run", "*.", "bed", "\"_", ")_", "if_", "not_", "is", "Replica", "te_", "(_", "x_", "[_", ":_", "-_", "len_", "(_", "\"", "bed", "\"_", ")_", "]_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"(.", "*)", ".", "bed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "\"\\\\", "1", ".", "bed", "\"_", ",_", "TARGET", "\\u", "PROB", "ES", "ET_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\\\\", "1", ".", "assoc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Interv", "al", "Probe", "set", "Assoc", "iation", "s_", "(_", "infiles", "_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "build", " ", "associ", "ation", " ", "bet", "ween", " ", "probes", "ets", " ", "and", " ", "interval", "s", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "infile_", ",_", "probes", "et_", "=_", "infiles", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bed", "2g", "ff", ".", "py", " ", "--", "as", "-", "gtf", " ", "|\\\\", "\\", "10", ";", "\t", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "gtf", "2t", "able", ".", "py", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "counter", "=", "neighbour", "s", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "filename", "-", "gff", "=", "%", "(", "probes", "et", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "proxim", "al", "-", "distance", "=", "%", "(", "proxim", "al", "\\u", "distance", ")", "s", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "geno", "me", "-", "file", "=", "%", "(", "geno", "me", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "tool", "sdir", ")", "s", "\\\\", "table", "2g", "raph", ".", "py", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "header", "s", "=", "id", ",", "probes", "et", " ", "\\\\", "\\", "10", ";", "\t", ">", " ", "%", "(", "outfile", ")", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files", "\\u", "re_", "(_", "build", "Interv", "al", "Probe", "set", "Assoc", "iation", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"(.", "*)", ".", "assoc", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\\\\", "1", "\\u", "assoc", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Interv", "al", "Probe", "set", "Assoc", "iation", "s_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tablename_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "probes", "et", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "merge_", "(_", "(_", "export", "Reference", "As", "Bed", "_", ",_", "export", "Intervals", "As", "Bed", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"%", "s", ".", "bed", "\"_", "%_", "x_", "for_", "x_", "in_", "TRACK", "S", "\\u", "REFERENCE", "_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interval", "s", ".", "overl", "ap", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Overlap", "_", "(_", "infiles", "_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "overl", "ap", " ", "bet", "ween", " ", "interval", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "rename_", "(_", "outfile_", ",_", "outfile_", "+_", "\".", "orig", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "\"--", "update", "=", "%", "s", ".", "orig", "\"_", "%_", "outfile_", "\\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 ", " _", "options_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infiles", "_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "IO", "Tools_", "._", "flatten_", "(_", "infiles", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "diff", "\\u", "bed", ".", "py", " ", "\\", "10", ";", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\", "10", ";", " ", " ", " ", "%", "(", "options", ")", "s", " ", "\\", "10", ";", " ", " ", " ", "%", "(", "infiles", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "build", "Overlap", "_", ",_", "suffix_", "(_", "\".", "overl", "ap", "\"_", ")_", ",_", "\"\\u", "overl", "ap", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Overlap", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "overl", "ap", " ", "results", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "\"", "overl", "ap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "set1", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "set", "2", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "merge_", "(_", "(_", "export", "UCS", "CE", "ncode", "Track", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "export", "Reference", "As", "Bed", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"%", "s", ".", "bed", "\"_", "%_", "x_", "for_", "x_", "in_", "TRACK", "S", "\\u", "REFERENCE", "_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "combin", "e", "Conditions", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "combin", "e", "Uns", "tim_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "combin", "e", "Replica", "tes_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ucs", "c", ".", "overl", "ap", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "UCS", "CO", "ver", "lap", "_", "(_", "infiles", "_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "overl", "ap", " ", "bet", "ween", " ", "interval", "s", " ", "and", " ", "the", " ", "ucs", "c", " ", "tracks", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "rename_", "(_", "outfile_", ",_", "outfile_", "+_", "\".", "orig", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "\"--", "update", "=", "%", "s", ".", "orig", "\"_", "%_", "outfile_", "\\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 ", " _", "options_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "infiles", "_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "IO", "Tools_", "._", "flatten_", "(_", "infiles", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "diff", "\\u", "bed", ".", "py", " ", "\\", "10", ";", " ", " ", " ", "--", "tracks", " ", "\\", "10", ";", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", "\\", "10", ";", " ", " ", " ", "%", "(", "options", ")", "s", " ", "\\", "10", ";", " ", " ", " ", "%", "(", "infiles", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "build", "UCS", "CO", "ver", "lap", "_", ",_", "suffix_", "(_", "\".", "overl", "ap", "\"_", ")_", ",_", "\"\\u", "overl", "ap", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "UCS", "CO", "ver", "lap", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "overl", "ap", " ", "results", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "\"", "ucs", "c\\u", "overl", "ap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "set1", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "set", "2", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files_", "(_", "[_", "(_", "[_", "\"%", "s", "%", "s", ".", "norm", ".", "bam", "\"_", "%_", "(_", "x_", ",_", "y_", ")_", "for_", "y_", "in_", "REPLICA", "TES", "_", "]_", ",_", "\"%", "s", ".", "read", "correlation", "s", ".", "gz", "\"_", "%_", "x_", ")_", "for_", "x_", "in_", "TRACK", "S", "\\u", "EXPERIMENT", "S_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "make", "Read", "Correla", "tion_", "(_", "infiles", "_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "correlation", " ", "bet", "ween", " ", "reads", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "options_", "=_", "\"-", "l", " ", "mem", "\\u", "free", "=", "800", "0", "M", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "infiles", "_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "infiles", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bam", "\\u", "correlation", ".", "py", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "geno", "me", "=", "%", "(", "geno", "me", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "infiles", ")", "s", " ", "|", " ", "gzip", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "export", "Moti", "f", "Sequences", "_", ",_", "suffix_", "(_", "\".", "fasta", "\"_", ")_", ",_", "\".", "meme", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "MEM", "E_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "run", " ", "MEM", "E", " ", "on", " ", "all", " ", "interval", "s", " ", "and", " ", "motifs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "order", " ", "to", " ", "increase", " ", "the", " ", "signal", "/", "noise", " ", "ratio", ",", "\\", "10", ";", " ", " ", " ", " ", "MEM", "E", " ", "is", " ", "not", " ", "run", " ", "on", " ", "all", " ", "interval", "s", " ", "but", " ", "only", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "top", " ", "10", "%", " ", "of", " ", "interval", "s", " ", "(", "peak", "val", ")", " ", "are", " ", "used", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "Al", "so", ",", " ", "only", " ", "the", " ", "segment", " ", "of", " ", "200", " ", "bp", " ", "aro", "und", " ", "the", " ", "peak", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "used", " ", "and", " ", "not", " ", "the", " ", "complete", " ", "interval", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Sof", "tma", "ske", "d", " ", "sequence", " ", "is", " ", "convert", "ed", " ", "to", " ", "hard", "mask", "ed", "\\", "10", ";", " ", " ", "sequence", " ", "to", " ", "avoid", " ", "the", " ", "detect", "ion", " ", "of", " ", "spu", "rio", "us", " ", "motifs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Sequ", "ence", " ", "is", " ", "run", " ", "through", " ", "dust", "mask", "er", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "queue_", "=_", "\"", "medium", "\\u", "jobs", ".", "q", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "options_", "=_", "\"-", "l", " ", "mem", "\\u", "free", "=", "800", "0", "M", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "PARAMS_", "[_", "\"", "export", "dir", "\"_", "]_", ")_", ",_", "\"", "meme", "\"_", ",_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "andle", "_", "=_", "sqlite3_", "._", "connect_", "(_", "PARAMS_", "[_", "\"", "databa", "se", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fasta_", "=_", "Indexe", "d", "Fast", "a_", "._", "Indexe", "d", "Fast", "a_", "(_", "PARAMS_", "[_", "\"", "geno", "me", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track_", "=_", "infile_", "[_", ":_", "-_", "len_", "(_", "\".", "fasta", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "dbh", "andle", "_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "\"", "SELECT", " ", "peak", "center", ",", " ", "interval", "\\u", "id", ",", " ", "conti", "g", " ", "FROM", " ", "%", "s", "\\u", "interval", "s", " ", "ORDE", "R", " ", "BY", " ", "peak", "val", " ", "DESC", "\"_", "%_", "track_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "._", "execute_", "(_", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "cc_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cutoff_", "=_", "len_", "(_", "data_", ")_", "//_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "maxim", "um", " ", "size", " ", "of", " ", "data", " ", "set", " ", "(", "in", " ", "character", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "maxsize_", "=_", "int_", "(_", "PARAMS_", "[_", "\"", "motifs", "\\u", "meme", "\\u", "max", "\\u", "size", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "info_", "(_", "\"", "run", "Mem", "e", ":", " ", "%", "s", ":", " ", "usi", "ng", " ", "at", " ", "most", " ", "%", "i", " ", "sequence", "s", " ", "for", " ", "pattern", " ", "finding", "\"_", "%_", "(_", "track_", ",_", "cutoff_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fasta_", "=_", "Indexe", "d", "Fast", "a_", "._", "Indexe", "d", "Fast", "a_", "(_", "PARAMS_", "[_", "\"", "geno", "me", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "dir_", "=_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpf", "asta", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "\"", "in", ".", "fa", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "=_", "open_", "(_", "tmpf", "asta", "_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mask", "er_", "=_", "Mask", "er_", "._", "Mask", "er", "Du", "st", "Mask", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hw_", "=_", "int_", "(_", "PARAMS_", "[_", "\"", "motifs", "\\u", "meme", "\\u", "half", "widt", "h", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "size_", ",_", "nse", "q_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "peak", "center_", ",_", "id_", ",_", "contig_", "in_", "data_", "[_", ":_", "cutoff_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "end_", "=_", "peak", "center_", "-_", "hw_", ",_", "peak", "center_", "+_", "hw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "\"%", "s", "\\u", "%", "s", " ", "%", "s", ":", "%", "i", "..", "%", "i", "\"_", "%_", "(_", "track_", ",_", "str_", "(_", "id_", ")_", ",_", "contig_", ",_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq_", "=_", "fasta_", "._", "get", "Sequence_", "(_", "contig_", ",_", "\"+\"_", ",_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PARAMS_", "[_", "\"", "motifs", "\\u", "meme", "\\u", "mask", "er", "\"_", "]_", "==_", "\"", "repeat", "mask", "er", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "geno", "me", " ", "sequence", " ", "is", " ", "repeat", " ", "masked_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mask", "ed", "\\u", "seq_", "=_", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "PARAMS_", "[_", "\"", "motifs", "\\u", "meme", "\\u", "mask", "er", "\"_", "]_", "==_", "\"", "dust", "mask", "er", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mask", "ed", "\\u", "seq_", "=_", "mask", "er_", "(_", "seq_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hard", " ", "mask", " ", "soft", "mask", "ed", " ", "characters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mask", "ed", "\\u", "seq_", "=_", "re_", "._", "sub_", "(_", "\"[", "a", "-", "z", "]\"_", ",_", "\"", "N", "\"_", ",_", "mask", "ed", "\\u", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "size_", "+=_", "len_", "(_", "mask", "ed", "\\u", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "size_", ">=_", "maxsize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "info_", "(_", "\"", "run", "MEM", "E", ":", " ", "%", "s", ":", " ", "maxim", "um", " ", "size", " ", "(%", "i", ")", " ", "reache", "d", " ", "-", " ", "only", " ", "%", "i", " ", "sequence", "s", " ", "output", "\"_", "%_", "(_", "track_", ",_", "maxsize_", ",_", "nse", "q_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nse", "q_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "._", "write_", "(_", "\">", "%", "s", "\\\\", "n", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "id_", ",_", "mask", "ed", "\\u", "seq_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outs_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "motifs", "\\u", "exec", "meme", ")", "s", " ", "%", "(", "tmpf", "asta", ")", "s", " ", "-", "dna", " ", "-", "rev", "comp", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "-", "mod", " ", "%", "(", "motifs", "\\u", "meme", "\\u", "model", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "-", "nmo", "tif", "s", " ", "%", "(", "motifs", "\\u", "meme", "\\u", "nmo", "tif", "s", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "-", "oc", " ", "%", "(", "tmpdir", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "-", "maxs", "ize", " ", "%", "(", "maxs", "ize", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", " ", "%", "(", "motifs", "\\u", "meme", "\\u", "options", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", ".", "log", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copy", " ", "over", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "target", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ignore", " ", "\"", "file", " ", "exist", "s", "\"", " ", "exception_", "\\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_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "target", "\\u", "path_", ")_", ":_", "shutil_", "._", "rmtree_", "(_", "target", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "move_", "(_", "tmpdir_", ",_", "target", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shutil_", "._", "copyfile_", "(_", "os_", "._", "path_", "._", "join_", "(_", "target", "\\u", "path_", ",_", "\"", "meme", ".", "txt", "\"_", ")_", ",_", "outfile_", ")_", "\\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_", "@_", "transform_", "(_", "export", "Moti", "f", "Sequences", "_", ",_", "suffix_", "(_", "\".", "fasta", "\"_", ")_", ",_", "\".", "gla", "m2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "GL", "AM", "2_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "run", " ", "gla", "m2", " ", "on", " ", "all", " ", "interval", "s", " ", "and", " ", "motifs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "order", " ", "to", " ", "increase", " ", "the", " ", "signal", "/", "noise", " ", "ratio", ",", "\\", "10", ";", " ", " ", " ", " ", "MEM", "E", " ", "is", " ", "not", " ", "run", " ", "on", " ", "all", " ", "interval", "s", " ", "but", " ", "only", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "top", " ", "10", "%", " ", "of", " ", "interval", "s", " ", "(", "peak", "val", ")", " ", "are", " ", "used", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "Al", "so", ",", " ", "only", " ", "the", " ", "segment", " ", "of", " ", "200", " ", "bp", " ", "aro", "und", " ", "the", " ", "peak", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "used", " ", "and", " ", "not", " ", "the", " ", "complete", " ", "interval", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Sof", "tma", "ske", "d", " ", "sequence", " ", "is", " ", "convert", "ed", " ", "to", " ", "hard", "mask", "ed", "\\", "10", ";", " ", " ", "sequence", " ", "to", " ", "avoid", " ", "the", " ", "detect", "ion", " ", "of", " ", "spu", "rio", "us", " ", "motifs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Sequ", "ence", " ", "is", " ", "run", " ", "through", " ", "dust", "mask", "er", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "queue_", "=_", "\"", "server", "\\u", "jobs", ".", "q", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "PARAMS_", "[_", "\"", "export", "dir", "\"_", "]_", ")_", ",_", "\"", "gla", "m2", "\"_", ",_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track_", "=_", "infile_", "[_", ":_", "-_", "len_", "(_", "\".", "fasta", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpf", "asta", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "\"", "in", ".", "fa", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nse", "q_", "=_", "write", "Sequences", "For", "Intervals", "_", "(_", "track_", ",_", "tmpf", "asta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "full_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "half", "width_", "=_", "int_", "(_", "PARAMS_", "[_", "\"", "motifs", "\\u", "meme", "\\u", "half", "widt", "h", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maxsize_", "=_", "int_", "(_", "PARAMS_", "[_", "\"", "motifs", "\\u", "meme", "\\u", "max", "\\u", "size", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proportion_", "=_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "sequences_", "=_", "int_", "(_", "nse", "q_", "/_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "motifs", "\\u", "exec", "gla", "m2", ")", "s", " ", "-", "2", " ", "-", "O", " ", "%", "(", "tmpdir", ")", "s", " ", "%", "(", "motifs", "\\u", "gla", "m2", "\\u", "options", ")", "s", " ", "-", "z", " ", "%", "(", "min", "\\u", "sequence", "s", ")", "i", " ", "n", " ", "%", "(", "tmpf", "asta", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", ".", "log", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copy", " ", "over", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "target", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ignore", " ", "\"", "file", " ", "exist", "s", "\"", " ", "exception_", "\\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_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "target", "\\u", "path_", ")_", ":_", "shutil_", "._", "rmtree_", "(_", "target", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "move_", "(_", "tmpdir_", ",_", "target", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shutil_", "._", "copyfile_", "(_", "os_", "._", "path_", "._", "join_", "(_", "target", "\\u", "path_", ",_", "\"", "gla", "m2", ".", "txt", "\"_", ")_", ",_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "follow", "s_", "(_", "make", "Moti", "fs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "transform_", "(_", "run", "MEM", "E_", ",_", "suffix_", "(_", "\".", "meme", "\"_", ")_", ",_", "\".", "tom", "tom", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "Tom", "Tom", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compare", " ", "ab", "-", "init", "io", " ", "motifs", " ", "against", " ", "tom", "tom", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "%", "(", "motifs", "\\u", "exec", "tom", "tom", ")", "s", " ", "-", "text", " ", "-", "query", " ", "%", "(", "motifs", "\\u", "tom", "tom", "\\u", "master", "\\u", "motif", ")", "s", " ", "-", "target", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "run", "Tom", "Tom", "_", ",_", "suffix_", "(_", "\".", "tom", "tom", "\"_", ")_", ",_", "\"\\u", "tom", "tom", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Tom", "Tom", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compare", " ", "ab", "-", "init", "io", " ", "motifs", " ", "against", " ", "tom", "tom", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "P_", "._", "get", "Temp", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "(_", "\"", "query", "\\u", "id", "\"_", ",_", "\"", "target", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "optim", "al", "\\u", "offset", "\"_", ",_", "\"", "pvalue", "\"_", ",_", "\"", "qva", "lue", "\"_", ",_", "\"", "overl", "ap", "\"_", ",_", "\"", "query", "\\u", "consensus", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "target", "\\u", "consensus", "\"_", ",_", "\"", "orientation", "\"_", ")_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "open_", "(_", "infile_", ",_", "\"", "r", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "startswith_", "(_", "\"#", "Query", "\"_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "query", "\\u", "id_", ",_", "target", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "optim", "al", "\\u", "offset_", ",_", "pvalue_", ",_", "qva", "lue_", ",_", "overlap_", ",_", "query", "\\u", "consensus", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "consensus", "_", ",_", "orientation_", ")_", "=_", "line_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "._", "write_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmpfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "name_", "=_", "tmpfile_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "allow", "-", "empty", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "tmp", "name", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmp", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "follow", "s_", "(_", "make", "Moti", "fs_", ",_", "filter", "Moti", "fs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "files", "\\u", "re_", "(_", "(_", "export", "Moti", "f", "Sequences", "_", ",_", "export", "Moti", "f", "Control", "Sequences", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "\\\\", "S", "+)", ".", "control", "fasta", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "r", "\"\\\\", "1", ".", "control", "fasta", "\"_", ",_", "r", "\"\\\\", "1", ".", "fasta", "\"_", ",_", "glob_", "._", "glob_", "(_", "\"*", ".", "motif", "\"_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\\\\", "1", ".", "mas", "t", ".", "gz", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "MAS", "T_", "(_", "infiles", "_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "run", " ", "mas", "t", " ", "on", " ", "all", " ", "interval", "s", " ", "and", " ", "motifs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Collect", " ", "all", " ", "results", " ", "for", " ", "an", " ", "E-", "value", " ", "up", " ", "to", " ", "10000", " ", "so", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "sequence", "s", " ", "are", " ", "output", " ", "and", " ", "MAS", "T", " ", "curve", "s", " ", "can", " ", "be", " ", "compute", "d", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "10000", " ", "is", " ", "a", " ", "heuristic", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "queue_", "=_", "\"", "medium", "\\u", "jobs", ".", "q", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "use", " ", "new", " ", "nodes", ",", " ", "as", " ", "/", "bin", "/", "csh", " ", "is", " ", "not", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "the", " ", "old", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "options_", "=_", "\"-", "l", " ", "mem", "\\u", "free", "=", "800", "0", "M", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "control", "file_", ",_", "dbfile_", ",_", "motif", "files_", "=_", "infiles", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control", "file_", "=_", "dbfile_", "[_", ":_", "-_", "len_", "(_", "\".", "fasta", "\"_", ")_", "]_", "+_", "\".", "control", "fasta", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "control", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "P_", "._", "Pipe", "line", "Error_", "(_", "\"", "control", " ", "file", " ", "%", "s", " ", "for", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "%_", "(_", "control", "file_", ",_", "dbfile_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "outfile_", ")_", ":_", "os_", "._", "remove_", "(_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "motif", "file_", "in_", "motif", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "IO", "Tools_", "._", "is", "Empty_", "(_", "motif", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "info_", "(_", "\"", "skip", "ping", " ", "empty", " ", "motif", " ", "file", " ", "%", "s", "\"_", "%_", "motif", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "of_", "=_", "gzip_", "._", "open_", "(_", "outfile_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "motif_", ",_", "x_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "motif", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "of_", "._", "write_", "(_", "\":", ":", " ", "motif", " ", "=", " ", "%", "s", " ", "::", "\\\\", "n", "\"_", "%_", "motif_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "of_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "%", "(", "dbf", "ile", ")", "s", " ", "%", "(", "control", "file", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "%", "(", "motifs", "\\u", "exec", "mas", "t", ")", "s", " ", "%", "(", "motif", "file", ")", "s", " ", "-", "std", "in", " ", "-", "stdout", " ", "-", "text", " ", "-", "ev", " ", "%", "(", "motifs", "\\u", "mas", "t", "\\u", "evalue", ")", "f", " ", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "gzip", " ", "\\", "10", ";", " ", " ", " ", " ", ">>", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "export", "Moti", "f", "Sequences", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "suffix_", "(_", "\".", "fasta", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\".", "bio", "prospe", "ctor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "Bio", "Pro", "spect", "or_", "(_", "infiles", "_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "run", " ", "bio", "prospe", "ctor", " ", "for", " ", "motif", " ", "discove", "ry", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Bio", "prospe", "ctor", " ", "is", " ", "run", " ", "on", " ", "only", " ", "the", " ", "top", " ", "10", "%", " ", "of", " ", "peaks", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "use", " ", "new", " ", "nodes", ",", " ", "as", " ", "/", "bin", "/", "csh", " ", "is", " ", "not", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "the", " ", "old", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "options_", "=_", "\"-", "l", " ", "mem", "\\u", "free", "=", "800", "0", "M", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpf", "asta", "_", "=_", "P_", "._", "get", "Temp", "Filename_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "bio", "prospe", "ctor", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nse", "q_", "=_", "write", "Sequences", "For", "Intervals", "_", "(_", "track_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmpf", "asta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "full_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mask", "er_", "=_", "\"", "dust", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proportion_", "=_", "0.10", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "motifs", "\\u", "exec", "bio", "prospe", "ctor", ")", "s", " ", "-", "i", " ", "%", "(", "tmpf", "asta", ")", "s", " ", "%", "(", "motifs", "\\u", "bio", "prospe", "ctor", "\\u", "options", ")", "s", " ", "-", "o", " ", "%", "(", "outfile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", ".", "log", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpf", "asta", "_", ")_", "\\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", "run", "Nu", "bis", "can", "Moti", "f", "Search_", "(_", "infile_", ",_", "outfile_", ",_", "motif_", ",_", "mode_", "=_", "\"", "straight", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "run", " ", "NU", "BI", "SCAN", " ", "to", " ", "find", " ", "matche", "s", " ", "to", " ", "nucle", "ar", " ", "receptor", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "options_", "=_", "\"-", "l", " ", "mem", "\\u", "free", "=", "800", "0", "M", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track_", "=_", "re_", "._", "sub_", "(_", "\".", "nu", "bis", "can", ".*\"_", ",_", "\"\"_", ",_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpf", "asta", "_", "=_", "P_", "._", "get", "Temp", "Filename_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mode_", "==_", "\"", "shuffled", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nse", "q_", "=_", "write", "Sequences", "For", "Intervals", "_", "(_", "track_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmpf", "asta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "full_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "half", "width_", "=_", "100_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shuffled", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "\"", "shifted", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nse", "q_", "=_", "write", "Sequences", "For", "Intervals", "_", "(_", "track_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmpf", "asta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "full_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "half", "width_", "=_", "100_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "-_", "1000000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "\"", "straight", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nse", "q_", "=_", "write", "Sequences", "For", "Intervals", "_", "(_", "track_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmpf", "asta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "full_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "half", "width_", "=_", "100_", ")_", "\\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_", "Value", "Error_", "(_", "\"", "invalid", " ", "mode", " ", "`", "%", "s", "`\"_", "%_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arrange", "ments_", "=_", "\",\"_", "._", "join_", "(_", "PARAMS_", "[_", "\"", "motifs", "\\u", "nu", "bis", "can", "\\u", "arrange", "ment", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "run", "\\u", "nu", "bis", "can", ".", "py", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "qva", "lue", "=", "%", "(", "motifs", "\\u", "nu", "bis", "can", "\\u", "qva", "lue", ")", "f", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "iterati", "ons", "=", "%", "(", "motifs", "\\u", "nu", "bis", "can", "\\u", "iterati", "ons", ")", "i", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "arrange", "ment", "s", "=", "%", "(", "arrange", "ment", "s", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "motif", "=", "%", "(", "motif", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "mask", "=", "dust", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "add", "-", "sequence", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "tmpf", "asta", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpf", "asta", "_", ")_", "\\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_", "@_", "files_", "(_", "[_", "(_", "\"%", "s", ".", "bed", "\"_", "%_", "x_", ",_", "\"%", "s", ".", "annot", "ation", "s", "\"_", "%_", "x_", ")_", "for_", "x_", "in_", "TRACK", "S", "\\u", "ANNOTAT", "E_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "annot", "ate", "Intervals", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "classify", " ", "chips", "eq", " ", "interval", "s", " ", "according", " ", "to", " ", "thei", "r", " ", "location", " ", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "respec", "t", " ", "to", " ", "the", " ", "gene", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bed", "2g", "ff", ".", "py", " ", "--", "as", "-", "gtf", " ", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "gtf", "2t", "able", ".", "py", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "counter", "=", "position", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "counter", "=", "classif", "ier", "-", "chips", "eq", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "section", "=", "exon", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "counter", "=", "length", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "filename", "-", "gff", "=", "%", "(", "annot", "ation", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "geno", "me", "-", "file", "=", "%", "(", "geno", "me", ")", "s", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "straight", "Import_", "(_", "infile_", ",_", "outfile_", ",_", "options_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "straight", " ", "import", " ", "from", " ", "gtf", "2t", "able", " ", "results", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "table", " ", "name", " ", "is", " ", "give", "n", " ", "by", " ", "outfile", " ", "with", "out", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "\".", "import", "\"", " ", "suff", "ix", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "gene", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "%", "(", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files_", "(_", "[_", "(_", "\"%", "s", ".", "bed", "\"_", "%_", "x_", ",_", "\"%", "s", ".", "tracks", "\"_", "%_", "x_", ",_", "\"", "ucs", "c\\u", "encode", ".", "bed", "\"_", ")_", "for_", "x_", "in_", "TRACK", "S", "\\u", "ANNOTAT", "E_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "annot", "ate", "Track", "s_", "(_", "infile_", ",_", "outfile_", ",_", "track", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "annot", "ate", " ", "interval", "s", " ", "by", " ", "track", " ", "overl", "ap", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bed", "2t", "able", ".", "py", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "counter", "=", "overl", "ap", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "filename", "-", "bed", "=", "%", "(", "track", "file", ")", "s", " ", "\\", "10", ";", " ", " ", " ", " ", "--", "geno", "me", "-", "file", "=", "%", "(", "geno", "me", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "perl", " ", "-", "p", " ", "-", "e", " ", "\"", "s", "/", "name", "/", "gene", "\\u", "id", "/\"", " ", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "follow", "s_", "(_", "build", "Gene", "Regions", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "files_", "(_", "[_", "(_", "\"%", "s", ".", "bed", "\"_", "%_", "x_", ",_", "\"%", "s", ".", "tss", "\"_", "%_", "x_", ")_", "for_", "x_", "in_", "TRACK", "S", "\\u", "ANNOTAT", "E_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "annot", "ate", "TS", "S_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bed", "2g", "ff", ".", "py", " ", "--", "as", "-", "gtf", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "gtf", "2t", "able", ".", "py", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "counter", "=", "distance", "-", "tss", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "filename", "-", "gff", "=", "%", "(", "transcripts", "\\u", "tss", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "geno", "me", "-", "file", "=", "%", "(", "geno", "me", ")", "s", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files_", "(_", "[_", "(_", "\"%", "s", ".", "bed", "\"_", "%_", "x_", ",_", "\"%", "s", ".", "repeat", "s", "\"_", "%_", "x_", ")_", "for_", "x_", "in_", "TRACK", "S", "\\u", "ANNOTAT", "E_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "annot", "ate", "Repeat", "s_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "count", " ", "the", " ", "overl", "ap", " ", "bet", "ween", " ", "interval", "s", " ", "and", " ", "repeat", "s", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bed", "2g", "ff", ".", "py", " ", "--", "as", "-", "gtf", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "gtf", "2t", "able", ".", "py", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "counter", "=", "overl", "ap", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "filename", "-", "gff", "=", "%", "(", "repeat", "s", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "geno", "me", "-", "file", "=", "%", "(", "geno", "me", ")", "s", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "import", "Expression", "Track", "s_", ",_", "suffix_", "(_", "\"\\u", "data", ".", "import", "\"_", ")_", ",_", "\".", "sam", ".", "exp", "diff", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Expression", "Difference", "s", "SAM", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "stats", " ", "on", " ", "express", "ion", " ", "difference", "s", " ", "bet", "ween", " ", "each", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "the", " ", "appropr", "iate", " ", "unst", "imu", "late", "d", " ", "set", " ", "usi", "ng", " ", "SAM", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ns", "kip", "ped_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track_", "=_", "infile_", "[_", ":_", "-_", "len_", "(_", "\"\\u", "data", ".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "PARAMS_", "[_", "\"", "export", "dir", "\"_", "]_", ")_", ",_", "\"", "SAM", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "target", "\\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_", "(_", "target", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\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_", "outs_", "=_", "open_", "(_", "outfile_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "._", "write_", "(_", "\"", "cluster", "\\u", "id", "\\\\", "tme", "an", "1", "\\\\", "tst", "d1", "\\\\", "tme", "an", "2", "\\\\", "tst", "d2", "\\\\", "tp", "value", "\\\\", "tq", "value", "\\\\", "tdi", "ff", "\\\\", "tfo", "ld", "\\\\", "tca", "lle", "d", "\\\\", "n", "\"_", ")_", "\\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 ", " _", "control_", ",_", "cluster", "\\u", "ids_", ",_", "treatment", "s_", ",_", "controls_", "=_", "PE", "xpr", "ession", "_", "._", "get", "Expression", "Measurement", "s_", "(_", "track_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "P_", "._", "Pipe", "line", "Error_", ",_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "warn_", "(_", "\"", "skip", "ped", ":", " ", "%", "s", "\"_", "%_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "._", "close_", "(_", ")_", "\\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_", "E_", "._", "info_", "(_", "\"", "track", "=", "%", "s", ",", " ", "control", "=", "%", "s", ":", " ", "compu", "ting", " ", "SAM", " ", "for", " ", "%", "i", " ", "probes", "ets", ",", " ", "%", "i", " ", "samples", ",", " ", "%", "i", " ", "control", "\"_", "%_", "(_", "track_", ",_", "control_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "cluster", "\\u", "ids_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "treatment", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "controls_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "genes_", ",_", "summary_", ",_", "cuto", "ffs_", "=_", "Expression_", "._", "SAM", "_", "(_", ")_", "(_", "cluster", "\\u", "ids_", ",_", "treatment", "s_", ",_", "controls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pattern_", "=_", "os_", "._", "path_", "._", "join_", "(_", "target", "\\u", "path_", ",_", "outfile_", "+_", "\"%", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fd", "r_", "=_", "float_", "(_", "PARAMS_", "[_", "\"", "express", "ion", "\\u", "sam", "\\u", "fd", "r", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ngen", "es_", "=_", "float_", "(_", "PARAMS_", "[_", "\"", "express", "ion", "\\u", "sam", "\\u", "ngen", "es", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nde", "lta", "_", "=_", "float_", "(_", "PARAMS_", "[_", "\"", "express", "ion", "\\u", "sam", "\\u", "nde", "lta", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "npe", "rm", "utat", "ions_", "=_", "PARAMS_", "[_", "\"", "express", "ion", "\\u", "sam", "\\u", "permutation", "s", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "PARAMS_", "[_", "\"", "express", "ion", "\\u", "sam", "\\u", "method", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "exce", "l\\u", "sam", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "summary_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "warn_", "(_", "\"", "no", " ", "cuto", "ff", " ", "whe", "n", " ", "runn", "ing", " ", "sam", " ", "for", " ", "%", "s", "\"_", "%_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cuto", "ffs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "=_", "open_", "(_", "outfile_", "+_", "\".", "cuto", "ffs", "\"_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logs_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "cuto", "ffs_", "[_", "0_", "]_", "._", "\\u", "fields_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "cuto", "ffs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "x_", ")_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logs_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "s_", "in_", "genes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outs_", "._", "write_", "(_", "\"%", "s", "\\\\", "t", "%", "f", "\\\\", "t", "%", "f", "\\\\", "t", "%", "f", "\\\\", "t", "%", "f", "\\\\", "t", "%", "e", "\\\\", "t", "%", "f", "\\\\", "t", "%", "f", "\\\\", "t", "%", "f", "\\\\", "t", "%", "i", "\\\\", "n", "\"_", "%_", "(_", "s_", "._", "probes", "et_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mean", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "stddev", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "mean", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "stddev", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "pvalue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "qva", "lue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "difference_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "fold_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "called_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outs_", "._", "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_", "@_", "transform_", "(_", "(_", "build", "Expression", "Difference", "s", "SAM", "_", ",_", "build", "Expression", "Difference", "s", "TT", "est_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "suffix_", "(_", "\".", "exp", "diff", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u", "exp", "diff", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Expression", "Difference", "s_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "express", "ion", " ", "difference", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "track_", ",_", "method_", ",_", "control_", "=_", "PE", "xpr", "ession", "_", "._", "get", "Expression", "Match_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "track_", "==_", "control_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outs_", "=_", "open_", "(_", "outfile_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "._", "close_", "(_", ")_", "\\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_", "tablename_", "=_", "\"%", "s", "\\u", "vs", "\\u", "%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "track_", ",_", "control_", ",_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "allow", "-", "empty", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "cluster", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", "<", " ", "%", "(", "infile", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "files_", "(_", "PARAMS_", "[_", "\"", "filename", "\\u", "t1", "d", "\"_", "]_", ",_", "\"", "t1", "d", ".", "bed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Dis", "eas", "e", "Intervals", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "infile_", ",_", "\"", "r", "U", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fasta_", "=_", "Indexe", "d", "Fast", "a_", "._", "Indexe", "d", "Fast", "a_", "(_", "FILE", "NAME", "\\u", "GEN", "OME", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outs_", "=_", "open_", "(_", "outfile_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "row_", "in_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "row_", "[_", "0_", "]_", "==_", "\"", "Locus", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc_", ",_", "chrom_", ",_", "start_", ",_", "end_", "=_", "row_", "[_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loc_", "==_", "\"\"_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", ",_", "end_", "=_", "int_", "(_", "start_", ")_", "-_", "1_", ",_", "int_", "(_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contig_", "=_", "fasta_", "._", "get", "Token_", "(_", "re_", "._", "sub_", "(_", "\"[", "pq", "]\\\\", "d", "[.", "0", "-", "9", "]*", "\"_", ",_", "\"\"_", ",_", "chrom_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outs_", "._", "write_", "(_", "\"%", "s", "\\\\", "t", "%", "i", "\\\\", "t", "%", "i", "\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "contig_", ",_", "start_", ",_", "end_", ",_", "loc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outs_", "._", "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_", "@_", "files_", "(_", "(_", "(_", "PARAMS_", "[_", "\"", "filename", "\\u", "express", "ion", "\\u", "wan", "g", "\"_", "]_", ",_", "\"", "express", "ion", "\\u", "wan", "g", ".", "import", "\"_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Expression", "Wan", "g_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "gene", " ", "express", "ion", " ", "data", " ", "from", " ", "Wan", "g", " ", "et", " ", "al", ".", " ", "(", "2005", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "pmid", ":`", "1600", "243", "4", "`", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Probe", " ", "Set", " ", "ID", "\"_", ",_", "\"", "probes", "et", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Access", "ion", "\"_", ",_", "\"", "accessi", "on", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Chrom", "osom", "al", " ", "Locat", "ion", "\"_", ",_", "\"", "chromo", "some", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Gene", " ", "Tit", "le", "\"_", ",_", "\"", "gene", "title", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Gene", " ", "Sym", "bol", "\"_", ",_", "\"", "gene", "symbol", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Entre", "z", " ", "Gene", "\"_", ",_", "\"", "entre", "zg", "ene", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Score", "\"_", ",_", "\"", "score", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Q", "-", "value", "\"_", ",_", "\"", "qva", "lue", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Gene", " ", "Sym", "bol", " ", "(", "Ma", "y2", "005", ")\"_", ",_", "\"", "gene", "symbol", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Entre", "z", " ", "Gene", " ", "(", "Ma", "y", " ", "2005", ")\"_", ",_", "\"", "entre", "zg", "ene", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Uni", "gene", " ", "(", "Release", " ", "#", " ", "184", ")\"_", ",_", "\"", "unig", "ene", "\"_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "DR", "3", " ", "cons", ".\"_", ",_", "\"", "d3", "\\u", "cons", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "DR", "3", " ", "1", " ", "mism", ".\"_", ",_", "\"", "d3", "\\u", "mism", "atch", "\"_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ER", "6", " ", "cons", ".\"_", ",_", "\"", "er", "6", "\\u", "cons", "\"_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "headers_", "=_", "set_", "(_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "headers_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "headers_", "=_", "[_", "x_", "[_", "1_", "]_", "for_", "x_", "in_", "headers_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "take_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "=_", "P_", "._", "get", "Temp", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reader_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "infile_", ",_", "\"", "r", "U", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "first_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", ",_", "old", "\\u", "header_", "in_", "enumerate_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "header_", "in_", "old", "\\u", "headers_", ":_", "take_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outs_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "new", "\\u", "headers_", ")_", "+_", "\"\\\\", "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 ", " _", "new", "\\u", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "take_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "row_", "[_", "x_", "]_", "._", "strip_", "(_", ")_", "!=_", "\"--", "-\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "row_", "._", "append_", "(_", "row_", "[_", "x_", "]_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " ", "_", "new", "\\u", "row_", "._", "append_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outs_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "new", "\\u", "row_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outs_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "name_", "=_", "outs_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "probes", "et", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "gene", "symbol", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "tmp", "name", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmp", "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_", "@_", "files_", "(_", "(_", "(_", "PARAMS_", "[_", "\"", "filename", "\\u", "express", "ion", "\\u", "kov", "alen", "ko", "\"_", "]_", ",_", "\"", "express", "ion", "\\u", "kov", "alen", "ko", ".", "import", "\"_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Expression", "Ko", "vale", "nk", "o_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "import", " ", "gene", " ", "express", "ion", " ", "data", " ", "from", " ", "Ko", "vale", "nk", "o", " ", "et", " ", "al", ".", " ", "(", "2010", ")", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "negati", "ve", " ", "fold", " ", "change", " ", "int", "o", " ", "ratio", "s", " ", "and", " ", "%", " ", "qva", "lue", "s", "\\", "10", ";", " ", " ", " ", " ", "int", "o", " ", "qva", "lue", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "andle", "_", "=_", "sqlite3_", "._", "connect_", "(_", "PARAMS_", "[_", "\"", "databa", "se", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "=_", "dbh", "andle", "_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "\\u", "name2", "id_", "=_", "dict_", "(_", "cc_", "._", "execute_", "(_", "\"", "SELECT", " ", "UPPER", "(", "gene", "\\u", "name", "),", " ", "gene", "\\u", "id", " ", "FROM", " ", "gene", "\\u", "info", "\"_", ")_", "._", "fetchall_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "aff", "y", "\\u", "id", "\"_", ",_", "\"", "probes", "et", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "gene", "\\u", "name", "\"_", ",_", "\"", "gene", "\\u", "id", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "fold", "\\u", "6", "\"_", ",_", "\"", "fold", "\\u", "6", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "qva", "lue", "\\u", "6", "\"_", ",_", "\"", "qva", "lue", "\\u", "6", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "fold", "\\u", "24", "\"_", ",_", "\"", "fold", "\\u", "24", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "qva", "lue", "\\u", "24", "\"_", ",_", "\"", "qva", "lue", "\\u", "24", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "fold", "\\u", "4", "8", "\"_", ",_", "\"", "fold", "\\u", "4", "8", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "qva", "lue", "\\u", "4", "8", "\"_", ",_", "\"", "qva", "lue", "\\u", "4", "8", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "headers_", "=_", "set_", "(_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "headers_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "headers_", "=_", "[_", "x_", "[_", "1_", "]_", "for_", "x_", "in_", "headers_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "take_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "=_", "P_", "._", "get", "Temp", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "counts_", "=_", "E_", "._", "Counter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reader_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "infile_", ",_", "\"", "r", "U", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notfound", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "first_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", ",_", "old", "\\u", "header_", "in_", "enumerate_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "header_", "in_", "old", "\\u", "headers_", ":_", "take_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outs_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "new", "\\u", "headers_", ")_", "+_", "\"\\\\", "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 ", " _", "skip_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "take_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "headers_", "[_", "x_", "]_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"", "fold", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fold", "val_", "=_", "float_", "(_", "row_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fold", "val_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "[_", "x_", "]_", "=_", "str_", "(_", "-_", "1.0_", "/_", "fold", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "headers_", "[_", "x_", "]_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"", "qva", "lue", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "qva", "lue_", "=_", "float_", "(_", "row_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "[_", "x_", "]_", "=_", "str_", "(_", "qva", "lue_", "/_", "100.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "headers_", "[_", "x_", "]_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"", "gene", "\\u", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "parts_", "=_", "[_", "c_", "._", "upper_", "(_", ")_", "._", "strip_", "(_", ")_", "for_", "c_", "in_", "row_", "[_", "x_", "]_", "._", "split_", "(_", "\"//", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "part_", "in_", "parts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "part_", "in_", "map", "\\u", "name2", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "row_", "[_", "x_", "]_", "=_", "map", "\\u", "name2", "id_", "[_", "part_", "]_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counts_", "._", "found_", "+=_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "counts_", "._", "notfound", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notfound", "_", "._", "add_", "(_", "row_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\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_", "if_", "row_", "[_", "x_", "]_", "._", "strip_", "(_", ")_", "!=_", "\"--", "-\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "row_", "._", "append_", "(_", "row_", "[_", "x_", "]_", "._", "strip_", "(_", ")_", ")_", "\\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 ", " ", "_", "new", "\\u", "row_", "._", "append_", "(_", "\"\"_", ")_", "\\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_", "skip_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "new", "\\u", "row_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outs_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "name_", "=_", "outs_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "probes", "et", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "gene", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "tmp", "name", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmp", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "info_", "(_", "\"%", "s", "\"_", "%_", "str_", "(_", "counts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "notfound", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "warn_", "(_", "\"", "not", " ", "found", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "notfound", "_", ")_", ")_", "\\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_", "@_", "transform_", "(_", "build", "Gene", "Set_", ",_", "suffix_", "(_", "\".", "gtf", "\"_", ")_", ",_", "\"\\u", "roi", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Overlap", "Regions", "Of", "Interest", "Ens", "embl", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "overl", "ap", " ", "of", " ", "interval", "s", " ", "with", " ", "regions", " ", "of", " ", "interest", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile", "name_", "=_", "P_", "._", "get", "Temp", "Filename_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PG", "ene", "set_", "._", "build", "Overlap", "With", "Ens", "embl", "_", "(_", "infile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "roi", ".", "bed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "allow", "-", "empty", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "index", "=", "interval", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "index", "=", "roi", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "tmpfile", "name", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpfile", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpfile", "name_", "+_", "\".", "log", "\"_", ")_", "\\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_", "@_", "transform_", "(_", "build", "Gene", "Set_", ",_", "suffix_", "(_", "\".", "gtf", "\"_", ")_", ",_", "\"\\u", "gw", "as", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "GW", "AS", "Ens", "embl", "_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "overl", "ap", " ", "of", " ", "interval", "s", " ", "with", " ", "regions", " ", "of", " ", "interest", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile", "name_", "=_", "P_", "._", "get", "Temp", "Filename_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PG", "ene", "set_", "._", "build", "Overlap", "With", "Ens", "embl", "_", "(_", "infile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gw", "as", ".", "bed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "allow", "-", "empty", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "index", "=", "interval", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "index", "=", "roi", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", " ", "%", "(", "tmpfile", "name", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpfile", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpfile", "name_", "+_", "\".", "log", "\"_", ")_", "\\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_", "@_", "follow", "s_", "(_", "build", "Gene", "Regions", "_", ",_", "import", "Regions", "Of", "Interest", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "files_", "(_", "[_", "(_", "(_", "\"%", "s", ".", "bed", "\"_", "%_", "x_", ",_", "\"%", "s", ".", "bed", "\"_", "%_", "y_", ")_", ",_", "\"%", "s", "\\u", "%", "s", ".", "import", "\"_", "%_", "(_", "x_", ",_", "y_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", ",_", "y_", "in_", "itertools_", "._", "product_", "(_", "TRACK", "S", "\\u", "ANNOTAT", "OR_", ",_", "TRACK", "S", "\\u", "REGION", "S_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "Overlap", "Regions", "_", "(_", "infiles", "_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "overl", "ap", " ", "of", " ", "infile", " ", "with", " ", "bed", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "infile_", ",_", "bed", "file_", "=_", "infiles", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bed", "2g", "raph", ".", "py", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "output", "=", "name", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "log", "=", "%", "(", "outfile", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "infile", ")", "s", " ", "%", "(", "bed", "file", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "sed", " ", "\"", "s", "/", "name", "1", "/", "interval", "\\u", "id", "/", ";", " ", "s", "/", "name2", "/", "roi", "\\u", "id", "/\"", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "allow", "-", "empty", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "index", "=", "interval", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "index", "=", "roi", "\\u", "id", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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_", "@_", "transform_", "(_", "build", "SN", "PC", "over", "age_", ",_", "suffix_", "(_", "\".", "snp", "covera", "ge", "\"_", ")_", ",_", "\"\\u", "snp", "covera", "ge", ".", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "import", "SN", "PC", "over", "age_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tablename_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "import", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "sed", " ", "\"", "s", "/", "chromo", "some", "/", "conti", "g", "/\"", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "csv", "2d", "b", ".", "py", " ", "%", "(", "csv", "2d", "b", "\\u", "options", ")", "s", " ", "\\\\", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "allow", "-", "empty", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "snp", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "index", "=", "gene", "symbol", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "--", "table", "=", "%", "(", "tablename", ")", "s", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "run_", "(_", ")_", "\\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, 2, 2, 2, 2, 2, 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'
nlloyd/SubliminalCollaborator/libs/twisted/internet/tcp.py
[ { "content": " def _closeWriteConnection(self):\n try:\n getattr(self.socket, self._socketShutdownMethod)(1)\n except socket.error:\n pass\n p = interfaces.IHalfCloseableProtocol(self.protocol, None)\n if p:\n try:\n p.writeConnectionLost()\n except:\n f = failure.Failure()\n log.err()\n self.connectionLost(f)", "metadata": "root.Connection._closeWriteConnection", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 242 }, { "content": " def readConnectionLost(self, reason):\n p = interfaces.IHalfCloseableProtocol(self.protocol, None)\n if p:\n try:\n p.readConnectionLost()\n except:\n log.err()\n self.connectionLost(failure.Failure())\n else:\n self.connectionLost(reason)", "metadata": "root.Connection.readConnectionLost", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 257 }, { "content": " def doRead(self):\n \"\"\"Called when my socket is ready for reading.\n\n This accepts a connection and calls self.protocol() to handle the\n wire-level protocol.\n \"\"\"\n try:\n if platformType == \"posix\":\n numAccepts = self.numberAccepts\n else:\n # win32 event loop breaks if we do more than one accept()\n # in an iteration of the event loop.\n numAccepts = 1\n for i in range(numAccepts):\n # we need this so we can deal with a factory's buildProtocol\n # calling our loseConnection\n if self.disconnecting:\n return\n try:\n skt, addr = self.socket.accept()\n except socket.error, e:\n if e.args[0] in (EWOULDBLOCK, EAGAIN):\n self.numberAccepts = i\n break\n elif e.args[0] == EPERM:\n # Netfilter on Linux may have rejected the\n # connection, but we get told to try to accept()\n # anyway.\n continue\n elif e.args[0] in (EMFILE, ENOBUFS, ENFILE, ENOMEM, ECONNABORTED):\n\n # Linux gives EMFILE when a process is not allowed\n # to allocate any more file descriptors. *BSD and\n # Win32 give (WSA)ENOBUFS. Linux can also give\n # ENFILE if the system is out of inodes, or ENOMEM\n # if there is insufficient memory to allocate a new\n # dentry. ECONNABORTED is documented as possible on\n # both Linux and Windows, but it is not clear\n # whether there are actually any circumstances under\n # which it can happen (one might expect it to be\n # possible if a client sends a FIN or RST after the\n # server sends a SYN|ACK but before application code\n # calls accept(2), however at least on Linux this\n # _seems_ to be short-circuited by syncookies.\n\n log.msg(\"Could not accept new connection (%s)\" % (\n errorcode[e.args[0]],))\n break\n raise\n\n fdesc._setCloseOnExec(skt.fileno())\n protocol = self.factory.buildProtocol(self._buildAddr(addr))\n if protocol is None:\n skt.close()\n continue\n s = self.sessionno\n self.sessionno = s+1\n transport = self.transport(skt, protocol, addr, self, s, self.reactor)\n protocol.makeConnection(transport)\n else:\n self.numberAccepts = self.numberAccepts+20\n except:\n # Note that in TLS mode, this will possibly catch SSL.Errors\n # raised by self.socket.accept()\n #\n # There is no \"except SSL.Error:\" above because SSL may be\n # None if there is no SSL support. In any case, all the\n # \"except SSL.Error:\" suite would probably do is log.deferr()\n # and return, so handling it here works just as well.\n log.deferr()", "metadata": "root.Port.doRead", "header": "['class', 'Port', '(', 'base', '.', 'BasePort', ',', '_SocketCloser', ')', ':', '___EOS___']", "index": 1000 } ]
[ { "span": "except:", "start_line": 251, "start_column": 12, "end_line": 251, "end_column": 19 }, { "span": "except:", "start_line": 262, "start_column": 12, "end_line": 262, "end_column": 19 }, { "span": "except:", "start_line": 1061, "start_column": 8, "end_line": 1061, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "close", "Write", "Connection_", "(_", "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 ", " _", "getattr_", "(_", "self_", "._", "socket_", ",_", "self_", "._", "\\u", "socket", "Shut", "down", "Method_", ")_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "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_", "p_", "=_", "interfaces_", "._", "IH", "alf", "Clos", "eab", "le", "Protocol_", "(_", "self_", "._", "protocol_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", ":_", "\\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 ", " _", "p_", "._", "write", "Connect", "ion", "Lost", "_", "(_", ")_", "\\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 ", " _", "f_", "=_", "failure_", "._", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connecti", "on", "Lost", "_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "Connect", "ion", "Lost", "_", "(_", "self_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "interfaces_", "._", "IH", "alf", "Clos", "eab", "le", "Protocol_", "(_", "self_", "._", "protocol_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", ":_", "\\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 ", " _", "p_", "._", "read", "Connect", "ion", "Lost", "_", "(_", ")_", "\\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 ", " _", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connecti", "on", "Lost", "_", "(_", "failure_", "._", "Failure_", "(_", ")_", ")_", "\\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 ", " _", "self_", "._", "connecti", "on", "Lost", "_", "(_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Port_", "(_", "base_", "._", "Base", "Port_", ",_", "\\u", "Sock", "et", "Clos", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "Read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "whe", "n", " ", "my", " ", "socket", " ", "is", " ", "read", "y", " ", "for", " ", "readi", "ng", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "accepts", " ", "a", " ", "connecti", "on", " ", "and", " ", "calls", " ", "self", ".", "protoc", "ol", "()", " ", "to", " ", "handle", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "wire", "-", "level", " ", "protoc", "ol", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "platform", "Type_", "==_", "\"", "posix", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Accept", "s_", "=_", "self_", "._", "number", "Accept", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "win32", " ", "event", " ", "loop", " ", "breaks", " ", "if", " ", "we", " ", "do", " ", "more", " ", "than", " ", "one", " ", "accept", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "an", " ", "iterati", "on", " ", "of", " ", "the", " ", "event", " ", "loop", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Accept", "s_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Accept", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "this", " ", "so", " ", "we", " ", "can", " ", "deal", " ", "with", " ", "a", " ", "factor", "y", "'", "s", " ", "build", "Protocol_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calling", " ", "our", " ", "lose", "Connection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "discon", "necti", "ng_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sk", "t_", ",_", "addr_", "=_", "self_", "._", "socket_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "e_", "._", "args_", "[_", "0_", "]_", "in_", "(_", "EW", "OU", "LDB", "LOCK_", ",_", "EA", "GAIN", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "number", "Accept", "s_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "args_", "[_", "0_", "]_", "==_", "EP", "ERM", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Net", "filter", " ", "on", " ", "Lin", "ux", " ", "may", " ", "have", " ", "reject", "ed", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connecti", "on", ",", " ", "but", " ", "we", " ", "get", " ", "tol", "d", " ", "to", " ", "try", " ", "to", " ", "accept", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anyway", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "args_", "[_", "0_", "]_", "in_", "(_", "EM", "FILE_", ",_", "ENO", "BUF", "S_", ",_", "EN", "FILE_", ",_", "ENO", "MEM", "_", ",_", "ECO", "NN", "ABORT", "ED_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lin", "ux", " ", "give", "s", " ", "EM", "FILE", " ", "whe", "n", " ", "a", " ", "process", " ", "is", " ", "not", " ", "allowed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "allocate", " ", "any", " ", "more", " ", "file", " ", "descrip", "tors", ".", " ", " ", "*", "BS", "D", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Win", "32", " ", "give", " ", "(", "WS", "A", ")", "ENO", "BUF", "S", ".", " ", " ", "Lin", "ux", " ", "can", " ", "als", "o", " ", "give", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EN", "FILE", " ", "if", " ", "the", " ", "system", " ", "is", " ", "out", " ", "of", " ", "inode", "s", ",", " ", "or", " ", "ENO", "MEM", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "is", " ", "insuf", "ficient", " ", "memory", " ", "to", " ", "allocate", " ", "a", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dent", "ry", ".", " ", " ", "ECO", "NN", "ABORT", "ED", " ", "is", " ", "documente", "d", " ", "as", " ", "possib", "le", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bot", "h", " ", "Lin", "ux", " ", "and", " ", "Window", "s", ",", " ", "but", " ", "it", " ", "is", " ", "not", " ", "clear_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "ther", " ", "there", " ", "are", " ", "actual", "ly", " ", "any", " ", "circum", "stance", "s", " ", "under", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "it", " ", "can", " ", "happ", "en", " ", "(", "one", " ", "mig", "ht", " ", "expect", " ", "it", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "possib", "le", " ", "if", " ", "a", " ", "client", " ", "send", "s", " ", "a", " ", "FIN", " ", "or", " ", "RST", " ", "after", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "server", " ", "send", "s", " ", "a", " ", "SYN", "|", "AC", "K", " ", "but", " ", "bef", "ore", " ", "applica", "tion", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calls", " ", "accept", "(", "2", "),", " ", "how", "ever", " ", "at", " ", "leas", "t", " ", "on", " ", "Lin", "ux", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "see", "ms", "\\u", " ", "to", " ", "be", " ", "short", "-", "circuit", "ed", " ", "by", " ", "sync", "ook", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "msg_", "(_", "\"", "Cou", "ld", " ", "not", " ", "accept", " ", "new", " ", "connecti", "on", " ", "(%", "s", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "errorcode", "_", "[_", "e_", "._", "args_", "[_", "0_", "]_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fde", "sc_", "._", "\\u", "set", "Clos", "e", "On", "Exec_", "(_", "sk", "t_", "._", "fileno_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "protocol_", "=_", "self_", "._", "factory_", "._", "build", "Protocol_", "(_", "self_", "._", "\\u", "build", "Addr_", "(_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "protocol_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sk", "t_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "self_", "._", "session", "no_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "no_", "=_", "s_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transport_", "=_", "self_", "._", "transport_", "(_", "sk", "t_", ",_", "protocol_", ",_", "addr_", ",_", "self_", ",_", "s_", ",_", "self_", "._", "reactor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "protocol_", "._", "make", "Connection_", "(_", "transport_", ")_", "\\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_", "._", "number", "Accept", "s_", "=_", "self_", "._", "number", "Accept", "s_", "+_", "20_", "\\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_", "#", " ", "Not", "e", " ", "tha", "t", " ", "in", " ", "TLS", " ", "mode", ",", " ", "this", " ", "will", " ", "possib", "ly", " ", "catch", " ", "SS", "L", ".", "Errors_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raise", "d", " ", "by", " ", "self", ".", "socket", ".", "accept", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "is", " ", "no", " ", "\"", "except", " ", "SS", "L", ".", "Error", ":\"", " ", "above", " ", "bec", "aus", "e", " ", "SS", "L", " ", "may", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Non", "e", " ", "if", " ", "there", " ", "is", " ", "no", " ", "SS", "L", " ", "support", ".", " ", " ", "In", " ", "any", " ", "case", ",", " ", "all", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "except", " ", "SS", "L", ".", "Error", ":\"", " ", "suit", "e", " ", "wou", "ld", " ", "probab", "ly", " ", "do", " ", "is", " ", "log", ".", "defer", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "return", ",", " ", "so", " ", "handling", " ", "it", " ",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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 local variable
kenfar/DataGristle/gristle/tests/test_metadata.py
[ { "content": " def test_schema_upsert(self):\n #old_schema_rows = self.md.schema_tools.lister()\n # add new entry:\n assert self.md.schema_tools.setter(schema_name='uniq-schema',schema_desc='insert result') != 0\n assert len(self.md.schema_tools.lister()) == 2 # init row + just added row\n assert self.md.schema_tools.getter(schema_name='uniq-schema').schema_desc == 'insert result'\n\n # update duplicate entry:\n assert self.md.schema_tools.setter(schema_name='uniq-schema',schema_desc='update result') == 0\n assert len(self.md.schema_tools.lister()) == 2 # no changes since last check\n assert self.md.schema_tools.getter(schema_name='uniq-schema').schema_desc == 'update result'\n\n new_schema_rows = self.md.schema_tools.lister()\n #assert rowproxy_diff(old_schema_rows, new_schema_rows, expected_add_cnt=1, expected_del_cnt=0)", "metadata": "root.TestSchema.test_schema_upsert", "header": "['class', 'TestSchema', '(', 'object', ')', ':', '___EOS___']", "index": 37 }, { "content": " def test_schema_list_and_delete(self):\n assert len(self.md.schema_tools.lister()) == 1\n old_schema_rows = self.md.schema_tools.lister()\n\n assert self.md.schema_tools.deleter(schema_name='geoip') == 1 # delete 1 row\n assert self.md.schema_tools.deleter(schema_name='geoip') == 0 # no rows left\n\n # delete all fields for collection\n for field in self.md.field_tools.lister():\n if field.collection_id == self.collection_id:\n self.md.field_tools.deleter(collection_id=self.collection_id, field_id=field.field_id)\n\n # delete all collections for schema\n for collection in self.md.collection_tools.lister():\n if collection.schema_id == self.schema_id:\n assert self.md.collection_tools.deleter(schema_id=self.schema_id,\n collection_id=collection.collection_id) == 1\n # delete all elements for schema\n for element in self.md.element_tools.lister():\n self.md.element_tools.deleter(element_name=element.element_name)\n\n # delete schema\n self.md.schema_tools.deleter(schema_id=self.schema_id)\n\n # confirm all deletes again:\n assert len(self.md.element_tools.lister()) == 0\n assert len(self.md.field_tools.lister()) == 0\n assert len(self.md.collection_tools.lister()) == 0\n assert len(self.md.schema_tools.lister()) == 0", "metadata": "root.TestSchema.test_schema_list_and_delete", "header": "['class', 'TestSchema', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " def test_collection_insert_update(self):\n old_rows = self.md.collection_tools.lister()\n\n kva = {'schema_id' : self.schema_id,\n 'collection_name':'a',\n 'collection_desc':'a1'}\n kvb = {'schema_id' : self.schema_id,\n 'collection_name':'b',\n 'collection_desc':'b1'}\n\n # add new entries:\n assert self.md.collection_tools.setter(**kva) != 0\n assert self.md.collection_tools.setter(**kvb) != 0\n assert len(self.md.collection_tools.lister()) == 3 # init row + just added row\n assert self.md.collection_tools.getter(schema_id=self.schema_id,\n collection_name='b').collection_desc == 'b1'\n assert self.md.collection_tools.getter(**kva).collection_desc == 'a1'\n\n # update duplicate entry:\n kvb['collection_desc'] = 'b2'\n assert self.md.collection_tools.setter(**kvb) == 0\n assert len(self.md.collection_tools.lister()) == 3 # no changes since last check\n assert self.md.collection_tools.getter(**kvb).collection_desc == 'b2'\n\n kvb['collection_desc'] = 'b3'\n assert self.md.collection_tools.setter(**kvb) == 0\n # should be no additions:\n assert len(self.md.collection_tools.lister()) == 3\n # should be changed:\n assert self.md.collection_tools.getter(schema_id=self.schema_id,\n collection_name='b').collection_desc == 'b3'\n # should be no changes to other rows:\n assert self.md.collection_tools.getter(schema_id=self.schema_id,\n collection_name='a').collection_desc == 'a1'", "metadata": "root.TestCollection.test_collection_insert_update", "header": "['class', 'TestCollection', '(', 'object', ')', ':', '___EOS___']", "index": 154 } ]
[ { "span": "new_schema_rows ", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 23 }, { "span": "old_schema_rows ", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 23 }, { "span": "old_rows ", "start_line": 155, "start_column": 8, "end_line": 155, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Schema_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "schema", "\\u", "upsert_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "old", "\\u", "schema", "\\u", "rows", " ", "=", " ", "self", ".", "md", ".", "schema", "\\u", "tool", "s", ".", "liste", "r", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "new", " ", "entry", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "setter_", "(_", "schema", "\\u", "name_", "=_", "'", "uniq", "-", "schema", "'_", ",_", "schema", "\\u", "desc_", "=_", "'", "insert", " ", "result", "'_", ")_", "!=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "2_", "#", " ", "init", " ", "row", " ", "+", " ", "just", " ", "adde", "d", " ", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "getter_", "(_", "schema", "\\u", "name_", "=_", "'", "uniq", "-", "schema", "'_", ")_", "._", "schema", "\\u", "desc_", "==_", "'", "insert", " ", "result", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "duplicat", "e", " ", "entry", ":_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "setter_", "(_", "schema", "\\u", "name_", "=_", "'", "uniq", "-", "schema", "'_", ",_", "schema", "\\u", "desc_", "=_", "'", "update", " ", "result", "'_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "2_", "#", " ", "no", " ", "change", "s", " ", "sinc", "e", " ", "last", " ", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "getter_", "(_", "schema", "\\u", "name_", "=_", "'", "uniq", "-", "schema", "'_", ")_", "._", "schema", "\\u", "desc_", "==_", "'", "update", " ", "result", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "schema", "\\u", "rows_", "=_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "assert", " ", "row", "proxy", "\\u", "diff", "(", "old", "\\u", "schema", "\\u", "rows", ",", " ", "new", "\\u", "schema", "\\u", "rows", ",", " ", "expected", "\\u", "add", "\\u", "cnt", "=", "1", ",", " ", "expected", "\\u", "del", "\\u", "cnt", "=", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Schema_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "schema", "\\u", "list", "\\u", "and", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "schema", "\\u", "rows_", "=_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "deleter", "_", "(_", "schema", "\\u", "name_", "=_", "'", "geoi", "p", "'_", ")_", "==_", "1_", "#", " ", "delete", " ", "1", " ", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "deleter", "_", "(_", "schema", "\\u", "name_", "=_", "'", "geoi", "p", "'_", ")_", "==_", "0_", "#", " ", "no", " ", "rows", " ", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "all", " ", "fields", " ", "for", " ", "collection_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "field_", "in_", "self_", "._", "md_", "._", "field", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field_", "._", "collection", "\\u", "id_", "==_", "self_", "._", "collection", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "md_", "._", "field", "\\u", "tools_", "._", "deleter", "_", "(_", "collection", "\\u", "id_", "=_", "self_", "._", "collection", "\\u", "id_", ",_", "field", "\\u", "id_", "=_", "field_", "._", "field", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "all", " ", "collection", "s", " ", "for", " ", "schema_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "collection_", "in_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "collection_", "._", "schema", "\\u", "id_", "==_", "self_", "._", "schema", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "deleter", "_", "(_", "schema", "\\u", "id_", "=_", "self_", "._", "schema", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collection", "\\u", "id_", "=_", "collection_", "._", "collection", "\\u", "id_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "all", " ", "element", "s", " ", "for", " ", "schema_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "element_", "in_", "self_", "._", "md_", "._", "element", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "md_", "._", "element", "\\u", "tools_", "._", "deleter", "_", "(_", "element", "\\u", "name_", "=_", "element_", "._", "element", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "schema_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "deleter", "_", "(_", "schema", "\\u", "id_", "=_", "self_", "._", "schema", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "confirm", " ", "all", " ", "delete", "s", " ", "again", ":_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "md_", "._", "element", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "md_", "._", "field", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "md_", "._", "schema", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "collection", "\\u", "insert", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "rows_", "=_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kv", "a_", "=_", "{_", "'", "schema", "\\u", "id", "'_", ":_", "self_", "._", "schema", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "\\u", "name", "'_", ":_", "'", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "\\u", "desc", "'_", ":_", "'", "a1", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kv", "b_", "=_", "{_", "'", "schema", "\\u", "id", "'_", ":_", "self_", "._", "schema", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "\\u", "name", "'_", ":_", "'", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "\\u", "desc", "'_", ":_", "'", "b1", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "new", " ", "entri", "es", ":_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "setter_", "(_", "**_", "kv", "a_", ")_", "!=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "setter_", "(_", "**_", "kv", "b_", ")_", "!=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "3_", "#", " ", "init", " ", "row", " ", "+", " ", "just", " ", "adde", "d", " ", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "getter_", "(_", "schema", "\\u", "id_", "=_", "self_", "._", "schema", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collection", "\\u", "name_", "=_", "'", "b", "'_", ")_", "._", "collection", "\\u", "desc_", "==_", "'", "b1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "getter_", "(_", "**_", "kv", "a_", ")_", "._", "collection", "\\u", "desc_", "==_", "'", "a1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "duplicat", "e", " ", "entry", ":_", "\\u\\u\\uNL\\u\\u\\u_", "kv", "b_", "[_", "'", "collection", "\\u", "desc", "'_", "]_", "=_", "'", "b2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "setter_", "(_", "**_", "kv", "b_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "3_", "#", " ", "no", " ", "change", "s", " ", "sinc", "e", " ", "last", " ", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "getter_", "(_", "**_", "kv", "b_", ")_", "._", "collection", "\\u", "desc_", "==_", "'", "b2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kv", "b_", "[_", "'", "collection", "\\u", "desc", "'_", "]_", "=_", "'", "b3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "setter_", "(_", "**_", "kv", "b_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "shou", "ld", " ", "be", " ", "no", " ", "additions", ":_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "liste", "r_", "(_", ")_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "shou", "ld", " ", "be", " ", "change", "d", ":_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "getter_", "(_", "schema", "\\u", "id_", "=_", "self_", "._", "schema", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collection", "\\u", "name_", "=_", "'", "b", "'_", ")_", "._", "collection", "\\u", "desc_", "==_", "'", "b3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "shou", "ld", " ", "be", " ", "no", " ", "change", "s", " ", "to", " ", "other", " ", "rows", ":_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "md_", "._", "collection", "\\u", "tools_", "._", "getter_", "(_", "schema", "\\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, 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/core/management.py
[ { "content": "def _get_sql_model_create(model, known_models=set()):\n \"\"\"\n Get the SQL required to create a single model.\n\n Returns list_of_sql, pending_references_dict\n \"\"\"\n from django.db import backend, get_creation_module, models\n data_types = get_creation_module().DATA_TYPES\n\n opts = model._meta\n final_output = []\n table_output = []\n pending_references = {}\n for f in opts.fields:\n if isinstance(f, (models.ForeignKey, models.OneToOneField)):\n rel_field = f.rel.get_related_field()\n data_type = get_rel_data_type(rel_field)\n else:\n rel_field = f\n data_type = f.get_internal_type()\n col_type = data_types[data_type]\n if col_type is not None:\n # Make the definition (e.g. 'foo VARCHAR(30)') for this field.\n field_output = [style.SQL_FIELD(backend.quote_name(f.column)),\n style.SQL_COLTYPE(col_type % rel_field.__dict__)]\n field_output.append(style.SQL_KEYWORD('%sNULL' % (not f.null and 'NOT ' or '')))\n if f.unique:\n field_output.append(style.SQL_KEYWORD('UNIQUE'))\n if f.primary_key:\n field_output.append(style.SQL_KEYWORD('PRIMARY KEY'))\n if f.rel:\n if f.rel.to in known_models:\n field_output.append(style.SQL_KEYWORD('REFERENCES') + ' ' + \\\n style.SQL_TABLE(backend.quote_name(f.rel.to._meta.db_table)) + ' (' + \\\n style.SQL_FIELD(backend.quote_name(f.rel.to._meta.get_field(f.rel.field_name).column)) + ')' + \n backend.get_deferrable_sql()\n )\n else:\n # We haven't yet created the table to which this field\n # is related, so save it for later.\n pr = pending_references.setdefault(f.rel.to, []).append((model, f))\n table_output.append(' '.join(field_output))\n if opts.order_with_respect_to:\n table_output.append(style.SQL_FIELD(backend.quote_name('_order')) + ' ' + \\\n style.SQL_COLTYPE(data_types['IntegerField']) + ' ' + \\\n style.SQL_KEYWORD('NULL'))\n for field_constraints in opts.unique_together:\n table_output.append(style.SQL_KEYWORD('UNIQUE') + ' (%s)' % \\\n \", \".join([backend.quote_name(style.SQL_FIELD(opts.get_field(f).column)) for f in field_constraints]))\n\n full_statement = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + style.SQL_TABLE(backend.quote_name(opts.db_table)) + ' (']\n for i, line in enumerate(table_output): # Combine and add commas.\n full_statement.append(' %s%s' % (line, i < len(table_output)-1 and ',' or ''))\n full_statement.append(');')\n final_output.append('\\n'.join(full_statement))\n\n return final_output, pending_references", "metadata": "root._get_sql_model_create", "header": "['module', '___EOS___']", "index": 154 }, { "content": "def _get_sql_for_pending_references(model, pending_references):\n \"\"\"\n Get any ALTER TABLE statements to add constraints after the fact.\n \"\"\"\n from django.db import backend, get_creation_module\n data_types = get_creation_module().DATA_TYPES\n\n final_output = []\n if backend.supports_constraints:\n opts = model._meta\n if model in pending_references:\n for rel_class, f in pending_references[model]:\n rel_opts = rel_class._meta\n r_table = rel_opts.db_table\n r_col = f.column\n table = opts.db_table\n col = opts.get_field(f.rel.field_name).column\n # For MySQL, r_name must be unique in the first 64 characters.\n # So we are careful with character usage here.\n r_name = '%s_refs_%s_%x' % (r_col, col, abs(hash((r_table, table))))\n final_output.append(style.SQL_KEYWORD('ALTER TABLE') + ' %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s)%s;' % \\\n (backend.quote_name(r_table), r_name,\n backend.quote_name(r_col), backend.quote_name(table), backend.quote_name(col), \n backend.get_deferrable_sql()))\n del pending_references[model]\n return final_output", "metadata": "root._get_sql_for_pending_references", "header": "['module', '___EOS___']", "index": 212 }, { "content": "def get_sql_delete(app):\n \"Returns a list of the DROP TABLE SQL statements for the given app.\"\n from django.db import backend, connection, models, get_introspection_module\n introspection = get_introspection_module()\n\n # This should work even if a connection isn't available\n try:\n cursor = connection.cursor()\n except:\n cursor = None\n\n # Figure out which tables already exist\n if cursor:\n table_names = introspection.get_table_list(cursor)\n else:\n table_names = []\n\n output = []\n\n # Output DROP TABLE statements for standard application tables.\n to_delete = set()\n\n references_to_delete = {}\n app_models = models.get_models(app)\n for model in app_models:\n if cursor and model._meta.db_table in table_names:\n # The table exists, so it needs to be dropped\n opts = model._meta\n for f in opts.fields:\n if f.rel and f.rel.to not in to_delete:\n references_to_delete.setdefault(f.rel.to, []).append( (model, f) )\n\n to_delete.add(model)\n\n for model in app_models:\n if cursor and model._meta.db_table in table_names:\n # Drop the table now\n output.append('%s %s;' % (style.SQL_KEYWORD('DROP TABLE'),\n style.SQL_TABLE(backend.quote_name(model._meta.db_table))))\n if backend.supports_constraints and references_to_delete.has_key(model):\n for rel_class, f in references_to_delete[model]:\n table = rel_class._meta.db_table\n col = f.column\n r_table = model._meta.db_table\n r_col = model._meta.get_field(f.rel.field_name).column\n output.append('%s %s %s %s;' % \\\n (style.SQL_KEYWORD('ALTER TABLE'),\n style.SQL_TABLE(backend.quote_name(table)),\n style.SQL_KEYWORD(backend.get_drop_foreignkey_sql()),\n style.SQL_FIELD(backend.quote_name('%s_refs_%s_%x' % (col, r_col, abs(hash((table, r_table))))))))\n del references_to_delete[model]\n\n # Output DROP TABLE statements for many-to-many tables.\n for model in app_models:\n opts = model._meta\n for f in opts.many_to_many:\n if cursor and f.m2m_db_table() in table_names:\n output.append(\"%s %s;\" % (style.SQL_KEYWORD('DROP TABLE'),\n style.SQL_TABLE(backend.quote_name(f.m2m_db_table()))))\n\n app_label = app_models[0]._meta.app_label\n\n # Close database connection explicitly, in case this output is being piped\n # directly into a database client, to avoid locking issues.\n if cursor:\n cursor.close()\n connection.close()\n\n return output[::-1] # Reverse it, to deal with table dependencies.", "metadata": "root.get_sql_delete", "header": "['module', '___EOS___']", "index": 277 }, { "content": "def get_custom_sql(app):\n \"Returns a list of the custom table modifying SQL statements for the given app.\"\n from django.db.models import get_models\n output = []\n\n app_models = get_models(app)\n app_dir = os.path.normpath(os.path.join(os.path.dirname(app.__file__), 'sql'))\n\n for model in app_models:\n output.extend(get_custom_sql_for_model(model))\n\n return output", "metadata": "root.get_custom_sql", "header": "['module', '___EOS___']", "index": 390 }, { "content": "def syncdb(verbosity=1, interactive=True):\n \"Creates the database tables for all apps in INSTALLED_APPS whose tables haven't already been created.\"\n from django.db import connection, transaction, models, get_creation_module\n from django.conf import settings\n\n disable_termcolors()\n\n # First, try validating the models.\n _check_for_validation_errors()\n\n # Import the 'management' module within each installed app, to register\n # dispatcher events.\n for app_name in settings.INSTALLED_APPS:\n try:\n __import__(app_name + '.management', {}, {}, [''])\n except ImportError:\n pass\n\n data_types = get_creation_module().DATA_TYPES\n\n cursor = connection.cursor()\n\n # Get a list of all existing database tables,\n # so we know what needs to be added.\n table_list = _get_table_list()\n\n # Get a list of already installed *models* so that references work right.\n seen_models = _get_installed_models(table_list)\n created_models = set()\n pending_references = {}\n\n # Create the tables for each model\n for app in models.get_apps():\n app_name = app.__name__.split('.')[-2]\n model_list = models.get_models(app)\n for model in model_list:\n # Create the model's database table, if it doesn't already exist.\n if verbosity >= 2:\n print \"Processing %s.%s model\" % (app_name, model._meta.object_name)\n if model._meta.db_table in table_list:\n continue\n sql, references = _get_sql_model_create(model, seen_models)\n seen_models.add(model)\n created_models.add(model)\n for refto, refs in references.items():\n pending_references.setdefault(refto, []).extend(refs)\n sql.extend(_get_sql_for_pending_references(model, pending_references))\n if verbosity >= 1:\n print \"Creating table %s\" % model._meta.db_table\n for statement in sql:\n cursor.execute(statement)\n table_list.append(model._meta.db_table)\n\n # Create the m2m tables. This must be done after all tables have been created\n # to ensure that all referred tables will exist.\n for app in models.get_apps():\n app_name = app.__name__.split('.')[-2]\n model_list = models.get_models(app)\n for model in model_list:\n if model in created_models:\n sql = _get_many_to_many_sql_for_model(model)\n if sql:\n if verbosity >= 2:\n print \"Creating many-to-many tables for %s.%s model\" % (app_name, model._meta.object_name)\n for statement in sql:\n cursor.execute(statement)\n\n transaction.commit_unless_managed()\n\n # Send the post_syncdb signal, so individual apps can do whatever they need\n # to do at this point.\n _emit_post_sync_signal(created_models, verbosity, interactive)\n\n # Install custom SQL for the app (but only if this \n # is a model we've just created)\n for app in models.get_apps():\n for model in models.get_models(app):\n if model in created_models:\n custom_sql = get_custom_sql_for_model(model)\n if custom_sql:\n if verbosity >= 1:\n print \"Installing custom SQL for %s.%s model\" % (app_name, model._meta.object_name)\n try:\n for sql in custom_sql:\n cursor.execute(sql)\n except Exception, e:\n sys.stderr.write(\"Failed to install custom SQL for %s.%s model: %s\" % \\\n (app_name, model._meta.object_name, e))\n transaction.rollback_unless_managed()\n else:\n transaction.commit_unless_managed()\n\n # Install SQL indicies for all newly created models\n for app in models.get_apps():\n app_name = app.__name__.split('.')[-2]\n for model in models.get_models(app):\n if model in created_models:\n index_sql = get_sql_indexes_for_model(model)\n if index_sql:\n if verbosity >= 1:\n print \"Installing index for %s.%s model\" % (app_name, model._meta.object_name)\n try:\n for sql in index_sql:\n cursor.execute(sql)\n except Exception, e:\n sys.stderr.write(\"Failed to install index for %s.%s model: %s\" % \\\n (app_name, model._meta.object_name, e))\n transaction.rollback_unless_managed()\n else:\n transaction.commit_unless_managed()\n\n # Install the 'initialdata' fixture, using format discovery\n load_data(['initial_data'], verbosity=verbosity)", "metadata": "root.syncdb", "header": "['module', '___EOS___']", "index": 483 }, { "content": "def run_shell(use_plain=False):\n \"Runs a Python interactive interpreter. Tries to use IPython, if it's available.\"\n # XXX: (Temporary) workaround for ticket #1796: force early loading of all\n # models from installed apps.\n from django.db.models.loading import get_models\n loaded_models = get_models()\n\n try:\n if use_plain:\n # Don't bother loading IPython, because the user wants plain Python.\n raise ImportError\n import IPython\n # Explicitly pass an empty list as arguments, because otherwise IPython\n # would use sys.argv from this script.\n shell = IPython.Shell.IPShell(argv=[])\n shell.mainloop()\n except ImportError:\n import code\n try: # Try activating rlcompleter, because it's handy.\n import readline\n except ImportError:\n pass\n else:\n # We don't have to wrap the following import in a 'try', because\n # we already know 'readline' was imported successfully.\n import rlcompleter\n readline.parse_and_bind(\"tab:complete\")\n code.interact()", "metadata": "root.run_shell", "header": "['module', '___EOS___']", "index": 1254 }, { "content": "def load_data(fixture_labels, verbosity=1):\n \"Installs the provided fixture file(s) as data in the database.\"\n from django.db.models import get_apps\n from django.core import serializers\n from django.db import connection, transaction\n from django.conf import settings\n import sys\n \n # Keep a count of the installed objects and fixtures\n count = [0,0]\n \n humanize = lambda dirname: dirname and \"'%s'\" % dirname or 'absolute path'\n\n # Get a cursor (even though we don't need one yet). This has\n # the side effect of initializing the test database (if \n # it isn't already initialized).\n cursor = connection.cursor()\n \n # Start transaction management. All fixtures are installed in a \n # single transaction to ensure that all references are resolved.\n transaction.commit_unless_managed()\n transaction.enter_transaction_management()\n transaction.managed(True)\n \n app_fixtures = [os.path.join(os.path.dirname(app.__file__),'fixtures') for app in get_apps()]\n for fixture_label in fixture_labels:\n if verbosity > 0:\n print \"Loading '%s' fixtures...\" % fixture_label\n for fixture_dir in app_fixtures + list(settings.FIXTURE_DIRS) + ['']:\n if verbosity > 1:\n print \"Checking %s for fixtures...\" % humanize(fixture_dir)\n parts = fixture_label.split('.')\n if len(parts) == 1:\n fixture_name = fixture_label\n formats = serializers.get_serializer_formats()\n else:\n fixture_name, format = '.'.join(parts[:-1]), parts[-1]\n formats = [format]\n\n label_found = False\n for format in formats:\n serializer = serializers.get_serializer(format)\n if verbosity > 1:\n print \"Trying %s for %s fixture '%s'...\" % \\\n (humanize(fixture_dir), format, fixture_name)\n try:\n full_path = os.path.join(fixture_dir, '.'.join([fixture_name, format]))\n fixture = open(full_path, 'r')\n if label_found:\n fixture.close()\n print style.ERROR(\"Multiple fixtures named '%s' in %s. Aborting.\" % \n (fixture_name, humanize(fixture_dir)))\n transaction.rollback()\n transaction.leave_transaction_management()\n return\n else:\n count[1] += 1\n if verbosity > 0:\n print \"Installing %s fixture '%s' from %s.\" % \\\n (format, fixture_name, humanize(fixture_dir))\n try:\n objects = serializers.deserialize(format, fixture)\n for obj in objects:\n count[0] += 1\n obj.save()\n label_found = True\n except Exception, e:\n fixture.close()\n sys.stderr.write(\n style.ERROR(\"Problem installing fixture '%s': %s\\n\" % \n (full_path, str(e))))\n transaction.rollback()\n transaction.leave_transaction_management()\n return\n fixture.close()\n except:\n if verbosity > 1:\n print \"No %s fixture '%s' in %s.\" % \\\n (format, fixture_name, humanize(fixture_dir))\n if count[0] == 0:\n if verbosity > 0:\n print \"No fixtures found.\"\n else:\n if verbosity > 0:\n print \"Installed %d object(s) from %d fixture(s)\" % tuple(count)\n transaction.commit()\n transaction.leave_transaction_management()", "metadata": "root.load_data", "header": "['module', '___EOS___']", "index": 1329 }, { "content": "def setup_environ(settings_mod):\n \"\"\"\n Configure the runtime environment. This can also be used by external\n scripts wanting to set up a similar environment to manage.py.\n \"\"\"\n # Add this project to sys.path so that it's importable in the conventional\n # way. For example, if this file (manage.py) lives in a directory\n # \"myproject\", this code would add \"/path/to/myproject\" to sys.path.\n project_directory = os.path.dirname(settings_mod.__file__)\n project_name = os.path.basename(project_directory)\n sys.path.append(os.path.join(project_directory, '..'))\n project_module = __import__(project_name, {}, {}, [''])\n sys.path.pop()\n\n # Set DJANGO_SETTINGS_MODULE appropriately.\n os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % project_name\n return project_directory", "metadata": "root.setup_environ", "header": "['module', '___EOS___']", "index": 1635 } ]
[ { "span": "pr ", "start_line": 194, "start_column": 20, "end_line": 194, "end_column": 22 }, { "span": "data_types ", "start_line": 217, "start_column": 4, "end_line": 217, "end_column": 14 }, { "span": "app_label ", "start_line": 337, "start_column": 4, "end_line": 337, "end_column": 13 }, { "span": "app_dir ", "start_line": 396, "start_column": 4, "end_line": 396, "end_column": 11 }, { "span": "data_types ", "start_line": 501, "start_column": 4, "end_line": 501, "end_column": 14 }, { "span": "loaded_models ", "start_line": 1259, "start_column": 4, "end_line": 1259, "end_column": 17 }, { "span": "cursor ", "start_line": 1345, "start_column": 4, "end_line": 1345, "end_column": 10 }, { "span": "project_module ", "start_line": 1646, "start_column": 4, "end_line": 1646, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "sql", "\\u", "model", "\\u", "create_", "(_", "model_", ",_", "know", "n", "\\u", "models_", "=_", "set_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "SQL", " ", "require", "d", " ", "to", " ", "create", " ", "a", " ", "single", " ", "model", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "list", "\\u", "of", "\\u", "sql", ",", " ", "pend", "ing", "\\u", "reference", "s", "\\u", "dict", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "backend_", ",_", "get", "\\u", "creati", "on", "\\u", "module_", ",_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "types_", "=_", "get", "\\u", "creati", "on", "\\u", "module_", "(_", ")_", "._", "DATA", "\\u", "TYPES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "=_", "model_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "ing", "\\u", "references_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "opts_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "f_", ",_", "(_", "models_", "._", "Fore", "ign", "Key_", ",_", "models_", "._", "One", "To", "One", "Field_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rel", "\\u", "field_", "=_", "f_", "._", "rel_", "._", "get", "\\u", "relate", "d\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "type_", "=_", "get", "\\u", "rel", "\\u", "data\\u", "type_", "(_", "rel", "\\u", "field_", ")_", "\\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 ", " _", "rel", "\\u", "field_", "=_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "type_", "=_", "f_", "._", "get", "\\u", "internal", "\\u", "type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "col", "\\u", "type_", "=_", "data\\u", "types_", "[_", "data\\u", "type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "col", "\\u", "type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "the", " ", "definit", "ion", " ", "(", "e", ".", "g", ".", " ", "'", "foo", " ", "VARCHA", "R", "(", "30", ")'", ")", " ", "for", " ", "this", " ", "field", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "output_", "=_", "[_", "style_", "._", "SQL", "\\u", "FIELD_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "f_", "._", "column_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "._", "SQL", "\\u", "COL", "TYPE_", "(_", "col", "\\u", "type_", "%_", "rel", "\\u", "field_", "._", "\\u\\u", "dict\\u\\u_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "output_", "._", "append_", "(_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'%", "s", "NULL", "'_", "%_", "(_", "not_", "f_", "._", "null_", "and_", "'", "NOT", " ", "'_", "or_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "._", "unique_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "output_", "._", "append_", "(_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "UNI", "QUE", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "f_", "._", "primary", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "output_", "._", "append_", "(_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "PRIMA", "RY", " ", "KEY", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "f_", "._", "rel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "._", "rel_", "._", "to_", "in_", "know", "n", "\\u", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "field", "\\u", "output_", "._", "append_", "(_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "REFERENCE", "S", "'_", ")_", "+_", "'", " ", "'_", "+_", "style_", "._", "SQL", "\\u", "TABLE_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "f_", "._", "rel_", "._", "to_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", ")_", ")_", "+_", "'", " ", "('_", "+_", "style_", "._", "SQL", "\\u", "FIELD_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "f_", "._", "rel_", "._", "to_", "._", "\\u", "meta_", "._", "get", "\\u", "field_", "(_", "f_", "._", "rel_", "._", "field", "\\u", "name_", ")_", "._", "column_", ")_", ")_", "+_", "')'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "._", "get", "\\u", "defer", "rab", "le", "\\u", "sql_", "(_", ")_", "\\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_", "#", " ", "We", " ", "have", "n", "'", "t", " ", "ye", "t", " ", "created", " ", "the", " ", "table", " ", "to", " ", "whi", "ch", " ", "this", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "relate", "d", ",", " ", "so", " ", "save", " ", "it", " ", "for", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pr_", "=_", "pend", "ing", "\\u", "references_", "._", "setdefault_", "(_", "f_", "._", "rel_", "._", "to_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "(_", "model_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table", "\\u", "output_", "._", "append_", "(_", "'", " ", "'_", "._", "join_", "(_", "field", "\\u", "output_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "order", "\\u", "with", "\\u", "respec", "t", "\\u", "to_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "output_", "._", "append_", "(_", "style_", "._", "SQL", "\\u", "FIELD_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "'\\u", "order", "'_", ")_", ")_", "+_", "'", " ", "'_", "+_", "style_", "._", "SQL", "\\u", "COL", "TYPE_", "(_", "data\\u", "types_", "[_", "'", "Integer", "Field", "'_", "]_", ")_", "+_", "'", " ", "'_", "+_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "NULL", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "field", "\\u", "constraints_", "in_", "opts_", "._", "unique", "\\u", "together_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "output_", "._", "append_", "(_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "UNI", "QUE", "'_", ")_", "+_", "'", " ", "(%", "s", ")'_", "%_", "\",", " ", "\"_", "._", "join_", "(_", "[_", "backend_", "._", "quote", "\\u", "name_", "(_", "style_", "._", "SQL", "\\u", "FIELD_", "(_", "opts_", "._", "get", "\\u", "field_", "(_", "f_", ")_", "._", "column_", ")_", ")_", "for_", "f_", "in_", "field", "\\u", "constraints_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "\\u", "statement_", "=_", "[_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "CREATE", " ", "TAB", "LE", "'_", ")_", "+_", "'", " ", "'_", "+_", "style_", "._", "SQL", "\\u", "TABLE_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "opts_", "._", "db", "\\u", "table_", ")_", ")_", "+_", "'", " ", "('_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "table", "\\u", "output_", ")_", ":_", "#", " ", "Combine", " ", "and", " ", "add", " ", "commas", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "statement_", "._", "append_", "(_", "'", " ", " ", " ", " ", "%", "s", "%", "s", "'_", "%_", "(_", "line_", ",_", "i_", "<_", "len_", "(_", "table", "\\u", "output_", ")_", "-_", "1_", "and_", "','_", "or_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "\\u", "statement_", "._", "append_", "(_", "');", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "output_", "._", "append_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "full", "\\u", "statement_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "final", "\\u", "output_", ",_", "pend", "ing", "\\u", "references_", "\\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", "get", "\\u", "sql", "\\u", "for", "\\u", "pend", "ing", "\\u", "references_", "(_", "model_", ",_", "pend", "ing", "\\u", "references_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "any", " ", "ALT", "ER", " ", "TAB", "LE", " ", "statem", "ents", " ", "to", " ", "add", " ", "constraint", "s", " ", "after", " ", "the", " ", "fact", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "backend_", ",_", "get", "\\u", "creati", "on", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "types_", "=_", "get", "\\u", "creati", "on", "\\u", "module_", "(_", ")_", "._", "DATA", "\\u", "TYPES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "final", "\\u", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "backend_", "._", "support", "s", "\\u", "constraints_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "model_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model_", "in_", "pend", "ing", "\\u", "references_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rel", "\\u", "class_", ",_", "f_", "in_", "pend", "ing", "\\u", "references_", "[_", "model_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rel", "\\u", "opts_", "=_", "rel", "\\u", "class_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "table_", "=_", "rel", "\\u", "opts_", "._", "db", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "col_", "=_", "f_", "._", "column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "opts_", "._", "db", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "opts_", "._", "get", "\\u", "field_", "(_", "f_", "._", "rel_", "._", "field", "\\u", "name_", ")_", "._", "column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "My", "SQL", ",", " ", "r", "\\u", "name", " ", "must", " ", "be", " ", "unique", " ", "in", " ", "the", " ", "first", " ", "64", " ", "character", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "we", " ", "are", " ", "care", "ful", " ", "with", " ", "character", " ", "usage", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "r", "\\u", "name_", "=_", "'%", "s", "\\u", "refs", "\\u", "%", "s", "\\u", "%", "x", "'_", "%_", "(_", "r", "\\u", "col_", ",_", "col_", ",_", "abs_", "(_", "hash_", "(_", "(_", "r", "\\u", "table_", ",_", "table_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "output_", "._", "append_", "(_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "ALT", "ER", " ", "TAB", "LE", "'_", ")_", "+_", "'", " ", "%", "s", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "%", "s", " ", "FORE", "IGN", " ", "KEY", " ", "(%", "s", ")", " ", "REFERENCE", "S", " ", "%", "s", " ", "(%", "s", ")%", "s", ";'_", "%_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "r", "\\u", "table_", ")_", ",_", "r", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "._", "quote", "\\u", "name_", "(_", "r", "\\u", "col_", ")_", ",_", "backend_", "._", "quote", "\\u", "name_", "(_", "table_", ")_", ",_", "backend_", "._", "quote", "\\u", "name_", "(_", "col_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "._", "get", "\\u", "defer", "rab", "le", "\\u", "sql_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "pend", "ing", "\\u", "references_", "[_", "model_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "final", "\\u", "output_", "\\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", "sql", "\\u", "delete_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "the", " ", "DROP", " ", "TAB", "LE", " ", "SQL", " ", "statem", "ents", " ", "for", " ", "the", " ", "give", "n", " ", "app", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "backend_", ",_", "connection_", ",_", "models_", ",_", "get", "\\u", "introspect", "ion", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "introspect", "ion_", "=_", "get", "\\u", "introspect", "ion", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "work", " ", "even", " ", "if", " ", "a", " ", "connecti", "on", " ", "isn", "'", "t", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "connection_", "._", "cursor_", "(_", ")_", "\\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 ", " _", "cursor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fig", "ure", " ", "out", " ", "whi", "ch", " ", "tables", " ", "alr", "ead", "y", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "names_", "=_", "introspect", "ion_", "._", "get", "\\u", "table", "\\u", "list_", "(_", "cursor_", ")_", "\\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 ", " _", "table", "\\u", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "DROP", " ", "TAB", "LE", " ", "statem", "ents", " ", "for", " ", "standard", " ", "applica", "tion", " ", "tables", "._", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "delete_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reference", "s", "\\u", "to", "\\u", "delete_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "models_", "=_", "models_", "._", "get", "\\u", "models_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", "in_", "app", "\\u", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cursor_", "and_", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", "in_", "table", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "table", " ", "exist", "s", ",", " ", "so", " ", "it", " ", "need", "s", " ", "to", " ", "be", " ", "dropped", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "model_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "opts_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "._", "rel_", "and_", "f_", "._", "rel_", "._", "to_", "not_", "in_", "to", "\\u", "delete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "reference", "s", "\\u", "to", "\\u", "delete_", "._", "setdefault_", "(_", "f_", "._", "rel_", "._", "to_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "(_", "model_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "\\u", "delete_", "._", "add_", "(_", "model_", ")_", "\\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_", "model_", "in_", "app", "\\u", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cursor_", "and_", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", "in_", "table", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Drop", " ", "the", " ", "table", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "append_", "(_", "'%", "s", " ", "%", "s", ";'_", "%_", "(_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "DROP", " ", "TAB", "LE", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "._", "SQL", "\\u", "TABLE_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "backend_", "._", "support", "s", "\\u", "constraints_", "and_", "reference", "s", "\\u", "to", "\\u", "delete_", "._", "has", "\\u", "key_", "(_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rel", "\\u", "class_", ",_", "f_", "in_", "reference", "s", "\\u", "to", "\\u", "delete_", "[_", "model_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "table_", "=_", "rel", "\\u", "class_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "f_", "._", "column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "table_", "=_", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "col_", "=_", "model_", "._", "\\u", "meta_", "._", "get", "\\u", "field_", "(_", "f_", "._", "rel_", "._", "field", "\\u", "name_", ")_", "._", "column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "append_", "(_", "'%", "s", " ", "%", "s", " ", "%", "s", " ", "%", "s", ";'_", "%_", "(_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "ALT", "ER", " ", "TAB", "LE", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "._", "SQL", "\\u", "TABLE_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "table_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "backend_", "._", "get", "\\u", "drop", "\\u", "foreign", "key", "\\u", "sql_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "._", "SQL", "\\u", "FIELD_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "'%", "s", "\\u", "refs", "\\u", "%", "s", "\\u", "%", "x", "'_", "%_", "(_", "col_", ",_", "r", "\\u", "col_", ",_", "abs_", "(_", "hash_", "(_", "(_", "table_", ",_", "r", "\\u", "table_", ")_", ")_", ")_", ")_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "reference", "s", "\\u", "to", "\\u", "delete_", "[_", "model_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "DROP", " ", "TAB", "LE", " ", "statem", "ents", " ", "for", " ", "many", "-", "to", "-", "many", " ", "tables", "._", "\\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_", "model_", "in_", "app", "\\u", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "model_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "opts_", "._", "many", "\\u", "to", "\\u", "many_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cursor_", "and_", "f_", "._", "m2", "m", "\\u", "db", "\\u", "table_", "(_", ")_", "in_", "table", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "append_", "(_", "\"%", "s", " ", "%", "s", ";\"_", "%_", "(_", "style_", "._", "SQL", "\\u", "KEYWORD", "_", "(_", "'", "DROP", " ", "TAB", "LE", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "._", "SQL", "\\u", "TABLE_", "(_", "backend_", "._", "quote", "\\u", "name_", "(_", "f_", "._", "m2", "m", "\\u", "db", "\\u", "table_", "(_", ")_", ")_", ")_", ")_", ")_", "\\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_", "app", "\\u", "label_", "=_", "app", "\\u", "models_", "[_", "0_", "]_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clos", "e", " ", "databa", "se", " ", "connecti", "on", " ", "explicit", "ly", ",", " ", "in", " ", "case", " ", "this", " ", "output", " ", "is", " ", "bei", "ng", " ", "pipe", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "direct", "ly", " ", "int", "o", " ", "a", " ", "databa", "se", " ", "client", ",", " ", "to", " ", "avoid", " ", "locking", " ", "issue", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output_", "[_", ":_", ":_", "-_", "1_", "]_", "#", " ", "Revers", "e", " ", "it", ",", " ", "to", " ", "deal", " ", "with", " ", "table", " ", "dependen", "cies", "._", "\\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", "custom", "\\u", "sql_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "the", " ", "custom", " ", "table", " ", "modif", "ying", " ", "SQL", " ", "statem", "ents", " ", "for", " ", "the", " ", "give", "n", " ", "app", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "get", "\\u", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "models_", "=_", "get", "\\u", "models_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "app_", "._", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "sql", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "model_", "in_", "app", "\\u", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "extend_", "(_", "get", "\\u", "custom", "\\u", "sql", "\\u", "for", "\\u", "model_", "(_", "model_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output_", "\\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_", "sync", "db_", "(_", "verbosity_", "=_", "1_", ",_", "interactive_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Creat", "es", " ", "the", " ", "databa", "se", " ", "tables", " ", "for", " ", "all", " ", "apps", " ", "in", " ", "INSTALLE", "D", "\\u", "APP", "S", " ", "who", "se", " ", "tables", " ", "have", "n", "'", "t", " ", "alr", "ead", "y", " ", "bee", "n", " ", "created", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connection_", ",_", "transaction_", ",_", "models_", ",_", "get", "\\u", "creati", "on", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disable", "\\u", "term", "colors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", ",", " ", "try", " ", "validat", "ing", " ", "the", " ", "model", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "check", "\\u", "for", "\\u", "validation", "\\u", "errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "the", " ", "'", "manage", "ment", "'", " ", "module", " ", "within", " ", "each", " ", "install", "ed", " ", "app", ",", " ", "to", " ", "register_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dispatcher", " ", "events", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "app", "\\u", "name_", "in_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", ":_", "\\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\\u", "import\\u\\u_", "(_", "app", "\\u", "name_", "+_", "'.", "manage", "ment", "'_", ",_", "{_", "}_", ",_", "{_", "}_", ",_", "[_", "''_", "]_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data\\u", "types_", "=_", "get", "\\u", "creati", "on", "\\u", "module_", "(_", ")_", "._", "DATA", "\\u", "TYPES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "=_", "connection_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "list", " ", "of", " ", "all", " ", "exist", "ing", " ", "databa", "se", " ", "tables", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "know", " ", "what", " ", "need", "s", " ", "to", " ", "be", " ", "adde", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "list_", "=_", "\\u", "get", "\\u", "table", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "list", " ", "of", " ", "alr", "ead", "y", " ", "install", "ed", " ", "*", "model", "s", "*", " ", "so", " ", "tha", "t", " ", "reference", "s", " ", "work", " ", "right", "._", "\\u\\u\\uNL\\u\\u\\u_", "see", "n", "\\u", "models_", "=_", "\\u", "get", "\\u", "install", "ed", "\\u", "models_", "(_", "table", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created", "\\u", "models_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "ing", "\\u", "references_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "tables", " ", "for", " ", "each", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "app_", "in_", "models_", "._", "get", "\\u", "apps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "name_", "=_", "app_", "._", "\\u\\u", "name\\u\\u_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "list_", "=_", "models_", "._", "get", "\\u", "models_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", "in_", "model", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "model", "'", "s", " ", "databa", "se", " ", "table", ",", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "alr", "ead", "y", " ", "exist", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbosity_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Process", "ing", " ", "%", "s", ".", "%", "s", " ", "model", "\"_", "%_", "(_", "app", "\\u", "name_", ",_", "model_", "._", "\\u", "meta_", "._", "object\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", "in_", "table", "\\u", "list_", ":_", "\\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_", "sql_", ",_", "references_", "=_", "\\u", "get", "\\u", "sql", "\\u", "model", "\\u", "create_", "(_", "model_", ",_", "see", "n", "\\u", "models_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "see", "n", "\\u", "models_", "._", "add_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created", "\\u", "models_", "._", "add_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "reft", "o_", ",_", "refs_", "in_", "references_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pend", "ing", "\\u", "references_", "._", "setdefault_", "(_", "reft", "o_", ",_", "[_", "]_", ")_", "._", "extend_", "(_", "refs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sql_", "._", "extend_", "(_", "\\u", "get", "\\u", "sql", "\\u", "for", "\\u", "pend", "ing", "\\u", "references_", "(_", "model_", ",_", "pend", "ing", "\\u", "references_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "verbosity_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Creat", "ing", " ", "table", " ", "%", "s", "\"_", "%_", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "statement_", "in_", "sql_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table", "\\u", "list_", "._", "append_", "(_", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "m2", "m", " ", "tables", ".", " ", "Thi", "s", " ", "must", " ", "be", " ", "don", "e", " ", "after", " ", "all", " ", "tables", " ", "have", " ", "bee", "n", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "ensure", " ", "tha", "t", " ", "all", " ", "referred", " ", "tables", " ", "will", " ", "exist", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "app_", "in_", "models_", "._", "get", "\\u", "apps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "name_", "=_", "app_", "._", "\\u\\u", "name\\u\\u_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "list_", "=_", "models_", "._", "get", "\\u", "models_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", "in_", "model", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "model_", "in_", "created", "\\u", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sql_", "=_", "\\u", "get", "\\u", "many", "\\u", "to", "\\u", "many", "\\u", "sql", "\\u", "for", "\\u", "model_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sql_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "verbosity_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "Creat", "ing", " ", "many", "-", "to", "-", "many", " ", "tables", " ", "for", " ", "%", "s", ".", "%", "s", " ", "model", "\"_", "%_", "(_", "app", "\\u", "name_", ",_", "model_", "._", "\\u", "meta_", "._", "object\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "statement_", "in_", "sql_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cursor_", "._", "execute_", "(_", "statement_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transaction_", "._", "commit", "\\u", "unl", "ess", "\\u", "managed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sen", "d", " ", "the", " ", "post", "\\u", "sync", "db", " ", "signal", ",", " ", "so", " ", "individual", " ", "apps", " ", "can", " ", "do", " ", "what", "ever", " ", "the", "y", " ", "need", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "do", " ", "at", " ", "this", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "emit", "\\u", "post", "\\u", "sync", "\\u", "signal_", "(_", "created", "\\u", "models_", ",_", "verbosity_", ",_", "interactive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Install", " ", "custom", " ", "SQL", " ", "for", " ", "the", " ", "app", " ", "(", "but", " ", "only", " ", "if", " ", "this", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "a", " ", "model", " ", "we", "'", "ve", " ", "just", " ", "created", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "app_", "in_", "models_", "._", "get", "\\u", "apps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model_", "in_", "models_", "._", "get", "\\u", "models_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "model_", "in_", "created", "\\u", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "custom", "\\u", "sql_", "=_", "get", "\\u", "custom", "\\u", "sql", "\\u", "for", "\\u", "model_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "custom", "\\u", "sql_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "verbosity_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "Install", "ing", " ", "custom", " ", "SQL", " ", "for", " ", "%", "s", ".", "%", "s", " ", "model", "\"_", "%_", "(_", "app", "\\u", "name_", ",_", "model_", "._", "\\u", "meta_", "._", "object\\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 ", " ", " _", "for_", "sql_", "in_", "custom", "\\u", "sql_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Fail", "ed", " ", "to", " ", "install", " ", "custom", " ", "SQL", " ", "for", " ", "%", "s", ".", "%", "s", " ", "model", ":", " ", "%", "s", "\"_", "%_", "(_", "app", "\\u", "name_", ",_", "model_", "._", "\\u", "meta_", "._", "object\\u", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "rollback", "\\u", "unl", "ess", "\\u", "managed_", "(_", ")_", "\\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 ", " ", " _", "transaction_", "._", "commit", "\\u", "unl", "ess", "\\u", "managed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Install", " ", "SQL", " ", "indic", "ies", " ", "for", " ", "all", " ", "newl", "y", " ", "created", " ", "models_", "\\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_", "for_", "app_", "in_", "models_", "._", "get", "\\u", "apps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "name_", "=_", "app_", "._", "\\u\\u", "name\\u\\u_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", "in_", "models_", "._", "get", "\\u", "models_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "model_", "in_", "created", "\\u", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "sql_", "=_", "get", "\\u", "sql", "\\u", "indexe", "s", "\\u", "for", "\\u", "model_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index", "\\u", "sql_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "verbosity_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "Install", "ing", " ", "index", " ", "for", " ", "%", "s", ".", "%", "s", " ", "model", "\"_", "%_", "(_", "app", "\\u", "name_", ",_", "model_", "._", "\\u", "meta_", "._", "object\\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 ", " ", " _", "for_", "sql_", "in_", "index", "\\u", "sql_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cursor_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Fail", "ed", " ", "to", " ", "install", " ", "index", " ", "for", " ", "%", "s", ".", "%", "s", " ", "model", ":", " ", "%", "s", "\"_", "%_", "(_", "app", "\\u", "name_", ",_", "model_", "._", "\\u", "meta_", "._", "object\\u", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "rollback", "\\u", "unl", "ess", "\\u", "managed_", "(_", ")_", "\\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 ", " ", " _", "transaction_", "._", "commit", "\\u", "unl", "ess", "\\u", "managed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Install", " ", "the", " ", "'", "initial", "data", "'", " ", "fixture", ",", " ", "usi", "ng", " ", "format", " ", "discovery_", "\\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_", "load", "\\u", "data_", "(_", "[_", "'", "initial", "\\u", "data", "'_", "]_", ",_", "verbosity_", "=_", "verbosity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run", "\\u", "shell_", "(_", "use", "\\u", "plain_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Run", "s", " ", "a", " ", "Pyth", "on", " ", "interactive", " ", "interprete", "r", ".", " ", "Trie", "s", " ", "to", " ", "use", " ", "IP", "yth", "on", ",", " ", "if", " ", "it", "'", "s", " ", "avail", "able", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "(", "Tempora", "ry", ")", " ", "workar", "ound", " ", "for", " ", "tick", "et", " ", "#", "179", "6", ":", " ", "force", " ", "ear", "ly", " ", "load", "ing", " ", "of", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "model", "s", " ", "from", " ", "install", "ed", " ", "apps", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "loading_", "import_", "get", "\\u", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "ed", "\\u", "models_", "=_", "get", "\\u", "models_", "(_", ")_", "\\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_", "use", "\\u", "plain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "bot", "her", " ", "load", "ing", " ", "IP", "yth", "on", ",", " ", "bec", "aus", "e", " ", "the", " ", "user", " ", "want", "s", " ", "plain", " ", "Pyth", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Import", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "IP", "ython_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Exp", "licit", "ly", " ", "pass", " ", "an", " ", "empty", " ", "list", " ", "as", " ", "argu", "ment", "s", ",", " ", "bec", "aus", "e", " ", "other", "wis", "e", " ", "IP", "ython_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wou", "ld", " ", "use", " ", "sys", ".", "argv", " ", "from", " ", "this", " ", "script", "._", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "IP", "ython_", "._", "Shell_", "._", "IPS", "hell", "_", "(_", "argv_", "=_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shell_", "._", "mainloop_", "(_", ")_", "\\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_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "#", " ", "Tr", "y", " ", "activat", "ing", " ", "rl", "completer", ",", " ", "bec", "aus", "e", " ", "it", "'", "s", " ", "hand", "y", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "readline_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "have", " ", "to", " ", "wrap", " ", "the", " ", "follow", "ing", " ", "import", " ", "in", " ", "a", " ", "'", "try", "',", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "alr", "ead", "y", " ", "know", " ", "'", "readline", "'", " ", "was", " ", "import", "ed", " ", "success", "full", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "rl", "completer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "readline_", "._", "parse", "\\u", "and", "\\u", "bind_", "(_", "\"", "tab", ":", "complete", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "code_", "._", "interact", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "load", "\\u", "data_", "(_", "fixture", "\\u", "labels_", ",_", "verbosity_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Install", "s", " ", "the", " ", "provided", " ", "fixture", " ", "file", "(", "s", ")", " ", "as", " ", "data", " ", "in", " ", "the", " ", "databa", "se", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "get", "\\u", "apps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "serializers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connection_", ",_", "transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Keep", " ", "a", " ", "count", " ", "of", " ", "the", " ", "install", "ed", " ", "object", "s", " ", "and", " ", "fixtures_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "humanize", "_", "=_", "lambda_", "dirname_", ":_", "dirname_", "and_", "\"'", "%", "s", "'\"_", "%_", "dirname_", "or_", "'", "abs", "olute", " ", "path", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "cursor", " ", "(", "even", " ", "tho", "ugh", " ", "we", " ", "don", "'", "t", " ", "need", " ", "one", " ", "ye", "t", ").", " ", "Thi", "s", " ", "has_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "side", " ", "effect", " ", "of", " ", "initiali", "zin", "g", " ", "the", " ", "test", " ", "databa", "se", " ", "(", "if", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "isn", "'", "t", " ", "alr", "ead", "y", " ", "initialize", "d", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "=_", "connection_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "transaction", " ", "manage", "ment", ".", " ", "All", " ", "fixture", "s", " ", "are", " ", "install", "ed", " ", "in", " ", "a", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "single", " ", "transaction", " ", "to", " ", "ensure", " ", "tha", "t", " ", "all", " ", "reference", "s", " ", "are", " ", "resolve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "transaction_", "._", "commit", "\\u", "unl", "ess", "\\u", "managed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "enter", "\\u", "transaction", "\\u", "management_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "managed_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "fixtures_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "app_", "._", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "fixture", "s", "'_", ")_", "for_", "app_", "in_", "get", "\\u", "apps_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fixture", "\\u", "label_", "in_", "fixture", "\\u", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbosity_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Load", "ing", " ", "'%", "s", "'", " ", "fixture", "s", "...\"_", "%_", "fixture", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fixture", "\\u", "dir_", "in_", "app", "\\u", "fixtures_", "+_", "list_", "(_", "settings_", "._", "FIXTURE", "\\u", "DIRS_", ")_", "+_", "[_", "''_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbosity_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Check", "ing", " ", "%", "s", " ", "for", " ", "fixture", "s", "...\"_", "%_", "humanize", "_", "(_", "fixture", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "=_", "fixture", "\\u", "label_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fixture", "\\u", "name_", "=_", "fixture", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats_", "=_", "serializers_", "._", "get", "\\u", "serialize", "r", "\\u", "formats_", "(_", ")_", "\\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 ", " _", "fixture", "\\u", "name_", ",_", "format_", "=_", "'.'_", "._", "join_", "(_", "parts_", "[_", ":_", "-_", "1_", "]_", ")_", ",_", "parts_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats_", "=_", "[_", "format_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "label", "\\u", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "format_", "in_", "formats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serializer_", "=_", "serializers_", "._", "get", "\\u", "serializer_", "(_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "verbosity_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "Tr", "ying", " ", "%", "s", " ", "for", " ", "%", "s", " ", "fixture", " ", "'%", "s", "'...", "\"_", "%_", "(_", "humanize", "_", "(_", "fixture", "\\u", "dir_", ")_", ",_", "format_", ",_", "fixture", "\\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 ", " ", "_", "full", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "fixture", "\\u", "dir_", ",_", "'.'_", "._", "join_", "(_", "[_", "fixture", "\\u", "name_", ",_", "format_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fixture_", "=_", "open_", "(_", "full", "\\u", "path_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label", "\\u", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fixture_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "style_", "._", "ERROR_", "(_", "\"", "Multipl", "e", " ", "fixture", "s", " ", "named", " ", "'%", "s", "'", " ", "in", " ", "%", "s", ".", " ", "Abo", "rti", "ng", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "fixture", "\\u", "name_", ",_", "humanize", "_", "(_", "fixture", "\\u", "dir_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "lea", "ve", "\\u", "transaction", "\\u", "management_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\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 ", " ", " _", "count_", "[_", "1_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "verbosity_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "Install", "ing", " ", "%", "s", " ", "fixture", " ", "'%", "s", "'", " ", "from", " ", "%", "s", ".\"_", "%_", "(_", "format_", ",_", "fixture", "\\u", "name_", ",_", "humanize", "_", "(_", "fixture", "\\u", "dir_", ")_", ")_", "\\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 ", " ", " _", "objects_", "=_", "serializers_", "._", "deserialize_", "(_", "format_", ",_", "fixture_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "count_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "label", "\\u", "found_", "=_", "True_", "\\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 ", " ", " _", "fixture_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "._", "ERROR_", "(_", "\"", "Prob", "lem", " ", "install", "ing", " ", "fixture", " ", "'%", "s", "':", " ", "%", "s", "\\\\", "n", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "full", "\\u", "path_", ",_", "str_", "(_", "e_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "lea", "ve", "\\u", "transaction", "\\u", "management_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fixture_", "._", "close_", "(_", ")_", "\\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 ", " ", "_", "if_", "verbosity_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "No", " ", "%", "s", " ", "fixture", " ", "'%", "s", "'", " ", "in", " ", "%", "s", ".\"_", "%_", "(_", "format_", ",_", "fixture", "\\u", "name_", ",_", "humanize", "_", "(_", "fixture", "\\u", "dir_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "count_", "[_", "0_", "]_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbosity_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "No", " ", "fixture", "s", " ", "found", ".\"_", "\\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_", "verbosity_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Install", "ed", " ", "%", "d", " ", "object", "(", "s", ")", " ", "from", " ", "%", "d", " ", "fixture", "(", "s", ")\"_", "%_", "tuple_", "(_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transaction_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "lea", "ve", "\\u", "transaction", "\\u", "management_", "(_", ")_", "\\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_", "setup", "\\u", "environ_", "(_", "settings", "\\u", "mod_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Configure", " ", "the", " ", "runt", "ime", " ", "environ", "ment", ".", " ", "Thi", "s", " ", "can", " ", "als", "o", " ", "be", " ", "used", " ", "by", " ", "external", "\\", "10", ";", " ", " ", " ", " ", "scripts", " ", "want", "ing", " ", "to", " ", "set", " ", "up", " ", "a", " ", "similar", " ", "environ", "ment", " ", "to", " ", "manage", ".", "py", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "this", " ", "project", " ", "to", " ", "sys", ".", "path", " ", "so", " ", "tha", "t", " ", "it", "'", "s", " ", "importa", "ble", " ", "in", " ", "the", " ", "convention", "al_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "way", ".", " ", "For", " ", "example", ",", " ", "if", " ", "this", " ", "file", " ", "(", "manage", ".", "py", ")", " ", "lives", " ", "in", " ", "a", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "mypro", "ject", "\",", " ", "this", " ", "code", " ", "wou", "ld", " ", "add", " ", "\"/", "path", "/", "to", "/", "mypro", "ject", "\"", " ", "to", " ", "sys", ".", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "directory_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "settings", "\\u", "mod_", "._", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "project", "\\u", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "project", "\\u", "directory_", ",_", "'..'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "module_", "=_", "\\u\\u", "import\\u\\u_", "(_", "project", "\\u", "name_", ",_", "{_", "}_", ",_", "{_", "}_", ",_", "[_", "''_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", " ", "appropr", "iate", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "os_",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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, 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 ]
Imprecise assert
ganeti/ganeti/test/py/ganeti.ovf_unittest.py
[ { "content": " def testOVAUnpackingDirectories(self):\n self.importer = ovf.OVFImporter(self.ova_package, OPTS_EMPTY)\n self.assertTrue(self.importer.input_dir != None)\n self.assertEquals(self.importer.output_dir , pathutils.EXPORT_DIR)\n self.assertTrue(self.importer.temp_dir != None)", "metadata": "root.TestOVFImporter.testOVAUnpackingDirectories", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 410 }, { "content": " def testOVFSetOutputDirDirectories(self):\n self.importer = ovf.OVFImporter(self.ganeti_ovf, OPTS_EXPORT)\n self.assertEquals(self.importer.input_dir , _GetFullFilename(\"\"))\n self.assertTrue(OUTPUT_DIR in self.importer.output_dir)\n self.assertEquals(self.importer.temp_dir , None)", "metadata": "root.TestOVFImporter.testOVFSetOutputDirDirectories", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 423 }, { "content": " def testParseGanetiOvf(self):\n self.importer = ovf.OVFImporter(self.ganeti_ovf, OPTS_EXPORT_NO_NAME)\n self.importer.Parse()\n self.assertTrue(\"%s/ganeti-test-xen\" % OUTPUT_DIR in\n self.importer.output_dir)\n self.assertEqual(self.importer.results_disk, GANETI_DISKS)\n self.assertEqual(self.importer.results_network, GANETI_NETWORKS)\n self.assertEqual(self.importer.results_hypervisor, GANETI_HYPERVISOR)\n self.assertEqual(self.importer.results_os, GANETI_OS)\n self.assertEqual(self.importer.results_backend, GANETI_BACKEND)\n self.assertEqual(self.importer.results_name, GANETI_NAME)\n self.assertEqual(self.importer.results_template, GANETI_TEMPLATE)\n self.assertEqual(self.importer.results_tags, GANETI_TAGS)\n self.assertEqual(self.importer.results_version, GANETI_VERSION)", "metadata": "root.TestOVFImporter.testParseGanetiOvf", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 437 }, { "content": " def testParseVirtualboxOvf(self):\n self.importer = ovf.OVFImporter(self.virtualbox_ovf, OPTS_VBOX)\n self.importer.Parse()\n self.assertTrue(\"%s/test-instance\" % OUTPUT_DIR in self.importer.output_dir)\n self.assertEquals(self.importer.results_disk, VIRTUALBOX_DISKS)\n self.assertEquals(self.importer.results_network, VIRTUALBOX_NETWORKS)\n self.assertEquals(self.importer.results_hypervisor, CMDARGS_HYPERVISOR)\n self.assertEquals(self.importer.results_os, CMDARGS_OS)\n self.assertEquals(self.importer.results_backend, VIRTUALBOX_BACKEND)\n self.assertEquals(self.importer.results_name, CMDARGS_NAME)\n self.assertEquals(self.importer.results_template, VIRTUALBOX_TEMPLATE)\n self.assertEqual(self.importer.results_tags, VIRTUALBOX_TAGS)\n self.assertEqual(self.importer.results_version, constants.EXPORT_VERSION)", "metadata": "root.TestOVFImporter.testParseVirtualboxOvf", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 452 }, { "content": " def testParseEmptyOvf(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n self.importer.Parse()\n self.assertTrue(\"%s/test-instance\" % OUTPUT_DIR in self.importer.output_dir)\n self.assertEquals(self.importer.results_disk, CMDARGS_DISKS)\n self.assertEquals(self.importer.results_network, CMDARGS_NETWORKS)\n self.assertEquals(self.importer.results_hypervisor, CMDARGS_HYPERVISOR)\n self.assertEquals(self.importer.results_os, CMDARGS_OS)\n self.assertEquals(self.importer.results_backend, CMDARGS_BACKEND)\n self.assertEquals(self.importer.results_name, CMDARGS_NAME)\n self.assertEquals(self.importer.results_template, CMDARGS_TEMPLATE)\n self.assertEqual(self.importer.results_tags, CMDARGS_TAGS)\n self.assertEqual(self.importer.results_version, constants.EXPORT_VERSION)", "metadata": "root.TestOVFImporter.testParseEmptyOvf", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 466 }, { "content": " def testOVFWriterInit(self):\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_EMPTY in result)", "metadata": "root.TestOVFWriter.testOVFWriterInit", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 791 }, { "content": " def testSaveDisksDataEmpty(self):\n self.writer.SaveDisksData([])\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_DISKS_EMPTY in result)", "metadata": "root.TestOVFWriter.testSaveDisksDataEmpty", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 795 }, { "content": " def testSaveDisksData(self):\n self.writer.SaveDisksData(EXP_DISKS_LIST)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_DISKS in result)", "metadata": "root.TestOVFWriter.testSaveDisksData", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 800 }, { "content": " def testSaveNetworkDataEmpty(self):\n self.writer.SaveNetworksData([])\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_NETWORKS_EMPTY in result)", "metadata": "root.TestOVFWriter.testSaveNetworkDataEmpty", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 805 }, { "content": " def testSaveNetworksData(self):\n self.writer.SaveNetworksData(EXP_NETWORKS_LIST)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_NETWORKS in result)", "metadata": "root.TestOVFWriter.testSaveNetworksData", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 810 }, { "content": " def testSaveGanetiDataIncomplete(self):\n self.writer.SaveGanetiData(EXP_PARTIAL_GANETI_DICT, EXP_NETWORKS_LIST)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_GANETI_INCOMPLETE in result)", "metadata": "root.TestOVFWriter.testSaveGanetiDataIncomplete", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 815 }, { "content": " def testSaveGanetiDataComplete(self):\n self.writer.SaveGanetiData(EXP_GANETI_DICT, EXP_NETWORKS_LIST)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_GANETI in result)", "metadata": "root.TestOVFWriter.testSaveGanetiDataComplete", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 820 }, { "content": " def testSaveVirtualSystem(self):\n self.writer.SaveDisksData(EXP_DISKS_LIST)\n self.writer.SaveNetworksData(EXP_NETWORKS_LIST)\n self.writer.SaveVirtualSystemData(EXP_NAME, EXP_VCPUS, EXP_MEMORY)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_SYSTEM in result)", "metadata": "root.TestOVFWriter.testSaveVirtualSystem", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 825 } ]
[ { "span": "self.assertTrue(self.importer.input_dir != None)", "start_line": 412, "start_column": 4, "end_line": 412, "end_column": 52 }, { "span": "self.assertTrue(self.importer.temp_dir != None)", "start_line": 414, "start_column": 4, "end_line": 414, "end_column": 51 }, { "span": "self.assertTrue(OUTPUT_DIR in self.importer.output_dir)", "start_line": 426, "start_column": 4, "end_line": 426, "end_column": 59 }, { "span": "self.assertTrue(\"%s/ganeti-test-xen\" % OUTPUT_DIR in\n self.importer.output_dir)", "start_line": 440, "start_column": 4, "end_line": 441, "end_column": 31 }, { "span": "self.assertTrue(\"%s/test-instance\" % OUTPUT_DIR in self.importer.output_dir)", "start_line": 455, "start_column": 4, "end_line": 455, "end_column": 80 }, { "span": "self.assertTrue(\"%s/test-instance\" % OUTPUT_DIR in self.importer.output_dir)", "start_line": 469, "start_column": 4, "end_line": 469, "end_column": 80 }, { "span": "self.assertTrue(EXPORT_EMPTY in result)", "start_line": 793, "start_column": 4, "end_line": 793, "end_column": 43 }, { "span": "self.assertTrue(EXPORT_DISKS_EMPTY in result)", "start_line": 798, "start_column": 4, "end_line": 798, "end_column": 49 }, { "span": "self.assertTrue(EXPORT_DISKS in result)", "start_line": 803, "start_column": 4, "end_line": 803, "end_column": 43 }, { "span": "self.assertTrue(EXPORT_NETWORKS_EMPTY in result)", "start_line": 808, "start_column": 4, "end_line": 808, "end_column": 52 }, { "span": "self.assertTrue(EXPORT_NETWORKS in result)", "start_line": 813, "start_column": 4, "end_line": 813, "end_column": 46 }, { "span": "self.assertTrue(EXPORT_GANETI_INCOMPLETE in result)", "start_line": 818, "start_column": 4, "end_line": 818, "end_column": 55 }, { "span": "self.assertTrue(EXPORT_GANETI in result)", "start_line": 823, "start_column": 4, "end_line": 823, "end_column": 44 }, { "span": "self.assertTrue(EXPORT_SYSTEM in result)", "start_line": 830, "start_column": 4, "end_line": 830, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "OV", "AU", "npa", "ck", "ing", "Director", "ies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "ova", "\\u", "package_", ",_", "OPT", "S", "\\u", "EMPTY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "importer_", "._", "input", "\\u", "dir_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ",_", "path", "utils_", "._", "EXPORT", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "importer_", "._", "temp", "\\u", "dir_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "OV", "FS", "et", "Output", "Dir", "Director", "ies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "EXPORT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "input", "\\u", "dir_", ",_", "\\u", "Get", "Full", "Filename_", "(_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "OUTPU", "T", "\\u", "DIR_", "in_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "temp", "\\u", "dir_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Gan", "eti", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "EXPORT", "\\u", "NO", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "importer_", "._", "Parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"%", "s", "/", "gane", "ti", "-", "test", "-", "xen", "\"_", "%_", "OUTPU", "T", "\\u", "DIR_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "disk_", ",_", "GAN", "ETI", "\\u", "DISK", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "network_", ",_", "GAN", "ETI", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "hypervisor", "_", ",_", "GAN", "ETI", "\\u", "HYP", "ERV", "ISO", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "os_", ",_", "GAN", "ETI", "\\u", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "backend_", ",_", "GAN", "ETI", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "name_", ",_", "GAN", "ETI", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "template_", ",_", "GAN", "ETI", "\\u", "TEMPLATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "tags_", ",_", "GAN", "ETI", "\\u", "TAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "version_", ",_", "GAN", "ETI", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Virt", "ual", "box", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "virtual", "box", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "VB", "OX", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "importer_", "._", "Parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"%", "s", "/", "test", "-", "instance", "\"_", "%_", "OUTPU", "T", "\\u", "DIR_", "in_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "disk_", ",_", "VIRTUAL", "BO", "X", "\\u", "DISK", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "network_", ",_", "VIRTUAL", "BO", "X", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "hypervisor", "_", ",_", "CMD", "ARG", "S", "\\u", "HYP", "ERV", "ISO", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "os_", ",_", "CMD", "ARG", "S", "\\u", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "backend_", ",_", "VIRTUAL", "BO", "X", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "name_", ",_", "CMD", "ARG", "S", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "template_", ",_", "VIRTUAL", "BO", "X", "\\u", "TEMPLATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "tags_", ",_", "VIRTUAL", "BO", "X", "\\u", "TAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "version_", ",_", "constants_", "._", "EXPORT", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Emp", "ty", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "importer_", "._", "Parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"%", "s", "/", "test", "-", "instance", "\"_", "%_", "OUTPU", "T", "\\u", "DIR_", "in_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "disk_", ",_", "CMD", "ARG", "S", "\\u", "DISK", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "network_", ",_", "CMD", "ARG", "S", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "hypervisor", "_", ",_", "CMD", "ARG", "S", "\\u", "HYP", "ERV", "ISO", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "os_", ",_", "CMD", "ARG", "S", "\\u", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "backend_", ",_", "CMD", "ARG", "S", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "name_", ",_", "CMD", "ARG", "S", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "template_", ",_", "CMD", "ARG", "S", "\\u", "TEMPLATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "tags_", ",_", "CMD", "ARG", "S", "\\u", "TAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "version_", ",_", "constants_", "._", "EXPORT", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "OV", "FW", "riter", "Init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "EMPTY_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Disk", "s", "Data", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Disk", "s", "Data_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "DISK", "S", "\\u", "EMPTY_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Disk", "s", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Disk", "s", "Data_", "(_", "EXP", "\\u", "DISK", "S", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "DISK", "S_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Network", "Data", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Network", "s", "Data_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "NET", "WORKS", "\\u", "EMPTY_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Network", "s", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Network", "s", "Data_", "(_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "NET", "WORKS", "_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Gan", "eti", "Data", "Incomp", "lete", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Gan", "eti", "Data_", "(_", "EXP", "\\u", "PARTI", "AL", "\\u", "GAN", "ETI", "\\u", "DICT_", ",_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "GAN", "ETI", "\\u", "INCOM", "PLE", "TE_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Gan", "eti", "Data", "Complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Gan", "eti", "Data_", "(_", "EXP", "\\u", "GAN", "ETI", "\\u", "DICT_", ",_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "GAN", "ETI", "_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Virt", "ual", "System_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Disk", "s", "Data_", "(_", "EXP", "\\u", "DISK", "S", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "writer_", "._", "Save", "Network", "s", "Data_", "(_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "writer_", "._", "Save", "Virt", "ual", "System", "Data_", "(_", "EXP", "\\u", "NAME_", ",_", "EXP", "\\u", "VC", "PU", "S_", ",_", "EXP", "\\u", "MEM", "ORY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "SYSTEM", "_", "in_", "result_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Module is imported with 'import' and 'import from'
kennethreitz/requests/requests/packages/urllib3/__init__.py
[ { "content": "\"\"\"\nurllib3 - Thread-safe connection pooling and re-using.\n\"\"\"\n\nfrom __future__ import absolute_import\nimport warnings\n\nfrom .connectionpool import (\n HTTPConnectionPool,\n HTTPSConnectionPool,\n connection_from_url\n)\n\nfrom . import exceptions\nfrom .filepost import encode_multipart_formdata\nfrom .poolmanager import PoolManager, ProxyManager, proxy_from_url\nfrom .response import HTTPResponse\nfrom .util.request import make_headers\nfrom .util.url import get_host\nfrom .util.timeout import Timeout\nfrom .util.retry import Retry\n\n\n# Set default logging handler to avoid \"No handler found\" warnings.\nimport logging\ntry: # Python 2.7+\n from logging import NullHandler\nexcept ImportError:\n\n__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'\n__license__ = 'MIT'\n__version__ = '1.15.1'\n\n__all__ = (\n 'HTTPConnectionPool',\n 'HTTPSConnectionPool',\n 'PoolManager',\n 'ProxyManager',\n 'HTTPResponse',\n 'Retry',\n 'Timeout',\n 'add_stderr_logger',\n 'connection_from_url',\n 'disable_warnings',\n 'encode_multipart_formdata',\n 'get_host',\n 'make_headers',\n 'proxy_from_url',\n)\n\nlogging.getLogger(__name__).addHandler(NullHandler())\n\n\n\n# ... Clean up.\ndel NullHandler\n\n\n# All warning filters *must* be appended unless you're really certain that they\n# shouldn't be: otherwise, it's very hard for users to use most Python\n# mechanisms to silence them.\n# SecurityWarning's always go off by default.\nwarnings.simplefilter('always', exceptions.SecurityWarning, append=True)\n# SubjectAltNameWarning's should go off once per host\nwarnings.simplefilter('default', exceptions.SubjectAltNameWarning, append=True)\n# InsecurePlatformWarning's don't vary between requests, so we keep it default.\nwarnings.simplefilter('default', exceptions.InsecurePlatformWarning,\n append=True)\n# SNIMissingWarnings should go off only once.\nwarnings.simplefilter('default', exceptions.SNIMissingWarning, append=True)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import logging", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "url", "lib", "3", " ", "-", " ", "Thread", "-", "safe", " ", "connecti", "on", " ", "pooling", " ", "and", " ", "re", "-", "usi", "ng", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "connecti", "onp", "ool_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "HTTP", "Connect", "ion", "Pool_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "HTTP", "SC", "onnect", "ion", "Pool_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "connecti", "on", "\\u", "from", "\\u", "url_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "filep", "ost_", "import_", "encode", "\\u", "multip", "art", "\\u", "form", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "pool", "manager_", "import_", "Poo", "l", "Manager_", ",_", "Pro", "xy", "Manager_", ",_", "proxy", "\\u", "from", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "response_", "import_", "HTTP", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "._", "request_", "import_", "make", "\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "._", "url_", "import_", "get", "\\u", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "._", "timeout_", "import_", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "._", "retry_", "import_", "Retry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "default", " ", "logg", "ing", " ", "handler", " ", "to", " ", "avoid", " ", "\"", "No", " ", "handler", " ", "found", "\"", " ", "warn", "ings", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "#", " ", "Pyth", "on", " ", "2.7", "+_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "logging_", "import_", "Null", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u", "author\\u\\u_", "=_", "'", "Andre", "y", " ", "Pet", "rov", " ", "(", "andr", "ey", ".", "pet", "rov", "@", "sha", "zo", "w", ".", "net", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "'", "MIT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "1.1", "5.1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HTTP", "Connect", "ion", "Poo", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HTTP", "SC", "onnect", "ion", "Poo", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Poo", "l", "Manager", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Pro", "xy", "Manager", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HTTP", "Respons", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Retr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Time", "out", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "\\u", "std", "err", "\\u", "logg", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "connecti", "on", "\\u", "from", "\\u", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disable", "\\u", "warn", "ings", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "encode", "\\u", "multip", "art", "\\u", "form", "data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "get", "\\u", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "\\u", "header", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proxy", "\\u", "from", "\\u", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "._", "add", "Handler_", "(_", "Null", "Handler_", "(_", ")_", ")_", "\\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_", "#", " ", "...", " ", "Clean", " ", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "Null", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "warn", "ing", " ", "filter", "s", " ", "*", "must", "*", " ", "be", " ", "append", "ed", " ", "unl", "ess", " ", "you", "'", "re", " ", "reall", "y", " ", "cert", "ain", " ", "tha", "t", " ", "the", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", "n", "'", "t", " ", "be", ":", " ", "other", "wis", "e", ",", " ", "it", "'", "s", " ", "very", " ", "hard", " ", "for", " ", "users", " ", "to", " ", "use", " ", "most", " ", "Python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mechanism", "s", " ", "to", " ", "silence", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Secur", "it", "y", "Warn", "ing", "'", "s", " ", "alw", "ay", "s", " ", "go", " ", "off", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "warnings_", "._", "simplefilter_", "(_", "'", "alw", "ay", "s", "'_", ",_", "exceptions_", "._", "Secur", "it", "y", "Warning_", ",_", "append_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sub", "ject", "Alt", "Name", "Warn", "ing", "'", "s", " ", "shou", "ld", " ", "go", " ", "off", " ", "onc", "e", " ", "per", " ", "host_", "\\u\\u\\uNL\\u\\u\\u_", "warnings_", "._", "simplefilter_", "(_", "'", "default", "'_", ",_", "exceptions_", "._", "Sub", "ject", "Alt", "Name", "Warning_", ",_", "append_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Inse", "cure", "Plat", "form", "Warn", "ing", "'", "s", " ", "don", "'", "t", " ", "vary", " ", "bet", "ween", " ", "request", "s", ",", " ", "so", " ", "we", " ", "keep", " ", "it", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "warnings_", "._", "simplefilter_", "(_", "'", "default", "'_", ",_", "exceptions_", "._", "Inse", "cure", "Plat", "form", "Warning_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "append_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "SNI", "Missing", "Warnings", " ", "shou", "ld", " ", "go", " ", "off", " ", "only", " ", "onc", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "warnings_",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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 ]
Unused local variable
SpriteLink/NIPAP/tests/performance/speedtest.py
[ { "content": " def add_prefix(self, argp):\n t0 = time.time()\n prefix = self.n.add_prefix({ 'name': 'test-schema' }, { 'prefix': argp, 'description': 'test' })\n t1 = time.time()\n d1 = t1-t0\n print \"Add prefix:\", argp, \"took\", d1, \"seconds\"", "metadata": "root.bonk.add_prefix", "header": "['class', 'bonk', ':', '___EOS___']", "index": 127 }, { "content": " def remove_prefix(self, argp):\n t0 = time.time()\n prefix = self.n.remove_prefix({ 'name': 'test-schema' }, { 'prefix': argp })\n t1 = time.time()\n d1 = t1-t0\n print \"Delete prefix:\", argp, \"took\", d1, \"seconds\"", "metadata": "root.bonk.remove_prefix", "header": "['class', 'bonk', ':', '___EOS___']", "index": 136 }, { "content": " def test1(self):\n t0 = time.time()\n res = self.n.find_free_prefix({ 'schema_name': 'test-schema', 'from-prefix': ['1.0.0.0/8'] }, 32, 1)\n t1 = time.time()\n res = self.n.find_free_prefix({ 'schema_name': 'test-schema', 'from-prefix': ['1.0.0.0/8'] }, 32, 500)\n t2 = time.time()\n for prefix in res:\n self.n.add_prefix({ 'schema_name': 'test-schema', 'prefix': prefix, 'description': 'test' })\n t3 = time.time()\n res = self.n.find_free_prefix({ 'schema_name': 'test-schema', 'from-prefix': ['1.0.0.0/8'] }, 32, 1)\n t4 = time.time()\n d1 = t1-t0\n d2 = t2-t1\n d3 = t3-t2\n d4 = t4-t3\n d5 = d4-d1\n print \"First find free prefix:\", d1\n print \"First find of 500 prefixes:\", d2\n print \"Adding 500 prefixes\", d3\n print \"Find one prefix after\", d4\n print \"Diff\", d5", "metadata": "root.bonk.test1", "header": "['class', 'bonk', ':', '___EOS___']", "index": 150 }, { "content": " def test2(self):\n t0 = time.time()\n res = self.n.find_free_prefix({ 'schema_name': 'test-schema', 'from-prefix': ['2.0.0.0/8'] }, 32, 1)\n t1 = time.time()\n d1 = t1-t0\n print \"Find free prefix:\", d1", "metadata": "root.bonk.test2", "header": "['class', 'bonk', ':', '___EOS___']", "index": 172 } ]
[ { "span": "prefix ", "start_line": 129, "start_column": 8, "end_line": 129, "end_column": 14 }, { "span": "prefix ", "start_line": 138, "start_column": 8, "end_line": 138, "end_column": 14 }, { "span": "res ", "start_line": 159, "start_column": 8, "end_line": 159, "end_column": 11 }, { "span": "res ", "start_line": 174, "start_column": 8, "end_line": 174, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "bon", "k_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "prefix_", "(_", "self_", ",_", "argp", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t0_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "self_", "._", "n_", "._", "add", "\\u", "prefix_", "(_", "{_", "'", "name", "'_", ":_", "'", "test", "-", "schema", "'_", "}_", ",_", "{_", "'", "prefix", "'_", ":_", "argp", "_", ",_", "'", "description", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1_", "=_", "t1_", "-_", "t0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Add", " ", "prefix", ":\"_", ",_", "argp", "_", ",_", "\"", "too", "k", "\"_", ",_", "d1_", ",_", "\"", "second", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bon", "k_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "prefix_", "(_", "self_", ",_", "argp", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t0_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "self_", "._", "n_", "._", "remove", "\\u", "prefix_", "(_", "{_", "'", "name", "'_", ":_", "'", "test", "-", "schema", "'_", "}_", ",_", "{_", "'", "prefix", "'_", ":_", "argp", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1_", "=_", "t1_", "-_", "t0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Delete", " ", "prefix", ":\"_", ",_", "argp", "_", ",_", "\"", "too", "k", "\"_", ",_", "d1_", ",_", "\"", "second", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bon", "k_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t0_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "n_", "._", "find", "\\u", "free", "\\u", "prefix_", "(_", "{_", "'", "schema", "\\u", "name", "'_", ":_", "'", "test", "-", "schema", "'_", ",_", "'", "from", "-", "prefix", "'_", ":_", "[_", "'", "1.0", ".0", ".0", "/", "8", "'_", "]_", "}_", ",_", "32_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "n_", "._", "find", "\\u", "free", "\\u", "prefix_", "(_", "{_", "'", "schema", "\\u", "name", "'_", ":_", "'", "test", "-", "schema", "'_", ",_", "'", "from", "-", "prefix", "'_", ":_", "[_", "'", "1.0", ".0", ".0", "/", "8", "'_", "]_", "}_", ",_", "32_", ",_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prefix_", "in_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "n_", "._", "add", "\\u", "prefix_", "(_", "{_", "'", "schema", "\\u", "name", "'_", ":_", "'", "test", "-", "schema", "'_", ",_", "'", "prefix", "'_", ":_", "prefix_", ",_", "'", "description", "'_", ":_", "'", "test", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t3_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "n_", "._", "find", "\\u", "free", "\\u", "prefix_", "(_", "{_", "'", "schema", "\\u", "name", "'_", ":_", "'", "test", "-", "schema", "'_", ",_", "'", "from", "-", "prefix", "'_", ":_", "[_", "'", "1.0", ".0", ".0", "/", "8", "'_", "]_", "}_", ",_", "32_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1_", "=_", "t1_", "-_", "t0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "=_", "t2_", "-_", "t1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d3_", "=_", "t3_", "-_", "t2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d4", "_", "=_", "t4_", "-_", "t3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d5", "_", "=_", "d4", "_", "-_", "d1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Fi", "rst", " ", "find", " ", "free", " ", "prefix", ":\"_", ",_", "d1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Fi", "rst", " ", "find", " ", "of", " ", "500", " ", "prefix", "es", ":\"_", ",_", "d2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Add", "ing", " ", "500", " ", "prefix", "es", "\"_", ",_", "d3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Fin", "d", " ", "one", " ", "prefix", " ", "after", "\"_", ",_", "d4", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Diff", "\"_", ",_", "d5", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bon", "k_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t0_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "n_", "._", "find", "\\u", "free", "\\u", "prefix_", "(_", "{_", "'", "schema", "\\u", "name", "'_", ":_", "'", "test", "-", "schema", "'_", ",_", "'", "from", "-", "prefix", "'_", ":_", "[_", "'", "2.0", ".0", ".0", "/", "8", "'_", "]_", "}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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 ]
Testing equality to None
fp7-ofelia/ocf/ofam/src/src/foamext/IPy.py
[ { "content": " def _printPrefix(self, want):\n \"\"\"Prints Prefixlen/Netmask.\n\n Not really. In fact it is our universal Netmask/Prefixlen printer.\n This is considered an internal function.\n\n want == 0 / None don't return anything 1.2.3.0\n want == 1 /prefix 1.2.3.0/24\n want == 2 /netmask 1.2.3.0/255.255.255.0\n want == 3 -lastip 1.2.3.0-1.2.3.255\n \"\"\"\n\n if (self._ipversion == 4 and self._prefixlen == 32) or \\\n (self._ipversion == 6 and self._prefixlen == 128):\n if self.NoPrefixForSingleIp:\n want = 0\n if want == None:\n want = self.WantPrefixLen\n if want == None:\n want = 1\n if want:\n if want == 2:\n # this should work with IP and IPint\n netmask = self.netmask()\n if not isinstance(netmask, (int, long)):\n netmask = netmask.int()\n return \"/%s\" % (intToIp(netmask, self._ipversion))\n elif want == 3:\n return \"-%s\" % (intToIp(self.ip + self.len() - 1, self._ipversion))\n else:\n # default\n return \"/%d\" % (self._prefixlen)\n else:\n return ''\n\n # We have different flavours to convert to:\n # strFullsize 127.0.0.1 2001:0658:022a:cafe:0200:c0ff:fe8d:08fa\n # strNormal 127.0.0.1 2001:658:22a:cafe:200:c0ff:fe8d:08fa\n # strCompressed 127.0.0.1 2001:658:22a:cafe::1\n # strHex 0x7F000001 0x20010658022ACAFE0200C0FFFE8D08FA\n # strDec 2130706433 42540616829182469433547974687817795834", "metadata": "root.IPint._printPrefix", "header": "['class', 'IPint', ':', '___EOS___']", "index": 296 }, { "content": " def strBin(self, wantprefixlen = None):\n \"\"\"Return a string representation as a binary value.\n\n >>> print(IP('127.0.0.1').strBin())\n 01111111000000000000000000000001\n \"\"\"\n\n\n if self._ipversion == 4:\n bits = 32\n elif self._ipversion == 6:\n bits = 128\n else:\n raise ValueError(\"only IPv4 and IPv6 supported\")\n\n if self.WantPrefixLen == None and wantprefixlen == None:\n wantprefixlen = 0\n ret = _intToBin(self.ip)\n return '0' * (bits - len(ret)) + ret + self._printPrefix(wantprefixlen)", "metadata": "root.IPint.strBin", "header": "['class', 'IPint', ':', '___EOS___']", "index": 338 }, { "content": " def strCompressed(self, wantprefixlen = None):\n \"\"\"Return a string representation in compressed format using '::' Notation.\n\n >>> IP('127.0.0.1').strCompressed()\n '127.0.0.1'\n >>> IP('2001:0658:022a:cafe:0200::1').strCompressed()\n '2001:658:22a:cafe:200::1'\n >>> IP('ffff:ffff:ffff:ffff:ffff:f:f:fffc/127').strCompressed()\n 'ffff:ffff:ffff:ffff:ffff:f:f:fffc/127'\n \"\"\"\n\n if self.WantPrefixLen == None and wantprefixlen == None:\n wantprefixlen = 1\n\n if self._ipversion == 4:\n return self.strFullsize(wantprefixlen)\n else:\n if self.ip >> 32 == 0xffff:\n ipv4 = intToIp(self.ip & 0xffffffff, 4)\n text = \"::ffff:\" + ipv4 + self._printPrefix(wantprefixlen)\n return text\n # find the longest sequence of '0'\n hextets = [int(x, 16) for x in self.strFullsize(0).split(':')]\n # every element of followingzeros will contain the number of zeros\n # following the corresponding element of hextets\n followingzeros = [0] * 8\n for i in xrange(len(hextets)):\n followingzeros[i] = _countFollowingZeros(hextets[i:])\n # compressionpos is the position where we can start removing zeros\n compressionpos = followingzeros.index(max(followingzeros))\n if max(followingzeros) > 1:\n # genererate string with the longest number of zeros cut out\n # now we need hextets as strings\n hextets = [x for x in self.strNormal(0).split(':')]\n while compressionpos < len(hextets) and hextets[compressionpos] == '0':\n del(hextets[compressionpos])\n hextets.insert(compressionpos, '')\n if compressionpos + 1 >= len(hextets):\n hextets.append('')\n if compressionpos == 0:\n hextets = [''] + hextets\n return ':'.join(hextets) + self._printPrefix(wantprefixlen)\n else:\n return self.strNormal(0) + self._printPrefix(wantprefixlen)", "metadata": "root.IPint.strCompressed", "header": "['class', 'IPint', ':', '___EOS___']", "index": 358 }, { "content": " def strNormal(self, wantprefixlen = None):\n \"\"\"Return a string representation in the usual format.\n\n >>> print(IP('127.0.0.1').strNormal())\n 127.0.0.1\n >>> print(IP('2001:0658:022a:cafe:0200::1').strNormal())\n 2001:658:22a:cafe:200:0:0:1\n \"\"\"\n\n if self.WantPrefixLen == None and wantprefixlen == None:\n wantprefixlen = 1\n\n if self._ipversion == 4:\n ret = self.strFullsize(0)\n elif self._ipversion == 6:\n ret = ':'.join([hex(x)[2:] for x in [int(x, 16) for x in self.strFullsize(0).split(':')]])\n else:\n raise ValueError(\"only IPv4 and IPv6 supported\")\n\n\n\n return ret + self._printPrefix(wantprefixlen)", "metadata": "root.IPint.strNormal", "header": "['class', 'IPint', ':', '___EOS___']", "index": 403 }, { "content": " def strFullsize(self, wantprefixlen = None):\n \"\"\"Return a string representation in the non-mangled format.\n\n >>> print(IP('127.0.0.1').strFullsize())\n 127.0.0.1\n >>> print(IP('2001:0658:022a:cafe:0200::1').strFullsize())\n 2001:0658:022a:cafe:0200:0000:0000:0001\n \"\"\"\n\n if self.WantPrefixLen == None and wantprefixlen == None:\n wantprefixlen = 1\n\n return intToIp(self.ip, self._ipversion).lower() + self._printPrefix(wantprefixlen)", "metadata": "root.IPint.strFullsize", "header": "['class', 'IPint', ':', '___EOS___']", "index": 426 }, { "content": " def strHex(self, wantprefixlen = None):\n \"\"\"Return a string representation in hex format in lower case.\n\n >>> IP('127.0.0.1').strHex()\n '0x7f000001'\n >>> IP('2001:0658:022a:cafe:0200::1').strHex()\n '0x20010658022acafe0200000000000001'\n \"\"\"\n\n if self.WantPrefixLen == None and wantprefixlen == None:\n wantprefixlen = 0\n\n x = hex(self.ip)\n if x[-1] == 'L':\n x = x[:-1]\n return x.lower() + self._printPrefix(wantprefixlen)", "metadata": "root.IPint.strHex", "header": "['class', 'IPint', ':', '___EOS___']", "index": 440 }, { "content": " def strDec(self, wantprefixlen = None):\n \"\"\"Return a string representation in decimal format.\n\n >>> print(IP('127.0.0.1').strDec())\n 2130706433\n >>> print(IP('2001:0658:022a:cafe:0200::1').strDec())\n 42540616829182469433547762482097946625\n \"\"\"\n\n if self.WantPrefixLen == None and wantprefixlen == None:\n wantprefixlen = 0\n\n x = str(self.ip)\n if x[-1] == 'L':\n x = x[:-1]\n return x + self._printPrefix(wantprefixlen)", "metadata": "root.IPint.strDec", "header": "['class', 'IPint', ':', '___EOS___']", "index": 457 } ]
[ { "span": "want == None:", "start_line": 312, "start_column": 11, "end_line": 312, "end_column": 23 }, { "span": "want == None:", "start_line": 314, "start_column": 15, "end_line": 314, "end_column": 27 }, { "span": "self.WantPrefixLen == None ", "start_line": 353, "start_column": 11, "end_line": 353, "end_column": 37 }, { "span": "wantprefixlen == None:", "start_line": 353, "start_column": 42, "end_line": 353, "end_column": 63 }, { "span": "self.WantPrefixLen == None ", "start_line": 369, "start_column": 11, "end_line": 369, "end_column": 37 }, { "span": "wantprefixlen == None:", "start_line": 369, "start_column": 42, "end_line": 369, "end_column": 63 }, { "span": "self.WantPrefixLen == None ", "start_line": 412, "start_column": 11, "end_line": 412, "end_column": 37 }, { "span": "wantprefixlen == None:", "start_line": 412, "start_column": 42, "end_line": 412, "end_column": 63 }, { "span": "self.WantPrefixLen == None ", "start_line": 435, "start_column": 11, "end_line": 435, "end_column": 37 }, { "span": "wantprefixlen == None:", "start_line": 435, "start_column": 42, "end_line": 435, "end_column": 63 }, { "span": "self.WantPrefixLen == None ", "start_line": 449, "start_column": 11, "end_line": 449, "end_column": 37 }, { "span": "wantprefixlen == None:", "start_line": 449, "start_column": 42, "end_line": 449, "end_column": 63 }, { "span": "self.WantPrefixLen == None ", "start_line": 466, "start_column": 11, "end_line": 466, "end_column": 37 }, { "span": "wantprefixlen == None:", "start_line": 466, "start_column": 42, "end_line": 466, "end_column": 63 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "IP", "int_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "Prefix_", "(_", "self_", ",_", "want_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Print", "s", " ", "Pref", "ix", "len", "/", "Net", "mask", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", " ", "reall", "y", ".", " ", "In", " ", "fact", " ", "it", " ", "is", " ", "our", " ", "universal", " ", "Net", "mask", "/", "Pref", "ix", "len", " ", "printer", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "consider", "ed", " ", "an", " ", "internal", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "want", " ", "==", " ", "0", " ", "/", " ", "Non", "e", " ", " ", " ", " ", "don", "'", "t", " ", "return", " ", "anyt", "hing", " ", " ", " ", " ", "1.2", ".3", ".0", "\\", "10", ";", " ", " ", " ", " ", "want", " ", "==", " ", "1", " ", " ", " ", "/", "prefix", " ", " ", " ", " ", " ", " ", "1.2", ".3", ".0", "/", "24", "\\", "10", ";", " ", " ", " ", " ", "want", " ", "==", " ", "2", " ", " ", " ", "/", "net", "mask", " ", " ", " ", " ", " ", "1.2", ".3", ".0", "/", "255.", "255.", "255.", "0", "\\", "10", ";", " ", " ", " ", " ", "want", " ", "==", " ", "3", " ", " ", " ", "-", "lasti", "p", " ", " ", " ", " ", " ", " ", "1.2", ".3", ".0", "-1", ".2", ".3", ".2", "5", "5", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "ipv", "ersion_", "==_", "4_", "and_", "self_", "._", "\\u", "prefix", "len_", "==_", "32_", ")_", "or_", "(_", "self_", "._", "\\u", "ipv", "ersion_", "==_", "6_", "and_", "self_", "._", "\\u", "prefix", "len_", "==_", "128_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "No", "Pref", "ix", "For", "Sing", "le", "Ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "want_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "want_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "want_", "=_", "self_", "._", "Wan", "t", "Pref", "ix", "Len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "want_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "want_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "want_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "want_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "work", " ", "with", " ", "IP", " ", "and", " ", "IP", "int_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "netmask_", "=_", "self_", "._", "netmask_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "netmask_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "netmask_", "=_", "netmask_", "._", "int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"/%", "s", "\"_", "%_", "(_", "int", "To", "Ip_", "(_", "netmask_", ",_", "self_", "._", "\\u", "ipv", "ersion_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "want_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"-", "%", "s", "\"_", "%_", "(_", "int", "To", "Ip_", "(_", "self_", "._", "ip_", "+_", "self_", "._", "len_", "(_", ")_", "-_", "1_", ",_", "self_", "._", "\\u", "ipv", "ersion_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"/%", "d", "\"_", "%_", "(_", "self_", "._", "\\u", "prefix", "len_", ")_", "\\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 ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "have", " ", "different", " ", "flav", "ours", " ", "to", " ", "convert", " ", "to", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "str", "Full", "size", " ", " ", " ", "127", ".0", ".0", ".1", " ", " ", " ", " ", "200", "1", ":", "065", "8", ":", "022", "a", ":", "caf", "e", ":", "0200", ":", "c0", "ff", ":", "fe", "8d", ":", "0", "8f", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "str", "Normal", " ", "127", ".0", ".0", ".1", " ", " ", " ", " ", "200", "1", ":", "658", ":", "2", "2a", ":", "caf", "e", ":", "200", ":", "c0", "ff", ":", "fe", "8d", ":", "0", "8f", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "str", "Compress", "ed", " ", "127", ".0", ".0", ".1", " ", " ", " ", " ", "200", "1", ":", "658", ":", "2", "2a", ":", "caf", "e", "::", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "str", "Hex", " ", " ", " ", " ", "0x7", "F0", "00001", " ", " ", " ", "0x200", "106", "580", "2", "2", "ACA", "FE", "0200", "C0", "FFF", "E", "8", "D0", "8", "FA", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "str", "De", "c", " ", " ", " ", " ", "213", "070", "643", "3", " ", " ", " ", "425", "406", "168", "291", "824", "694", "335", "479", "746", "878", "177", "958", "34_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "IP", "int_", ":_", "\\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_", "str", "Bin_", "(_", "self_", ",_", "want", "prefix", "len_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "string", " ", "represent", "ation", " ", "as", " ", "a", " ", "binar", "y", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "IP", "('", "127", ".0", ".0", ".1", "')", ".", "str", "Bin", "())", "\\", "10", ";", " ", " ", " ", " ", "01111", "1110", "0000000000000", "000000000", "1", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "ipv", "ersion_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "ipv", "ersion_", "==_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "128_", "\\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_", "Value", "Error_", "(_", "\"", "only", " ", "IP", "v", "4", " ", "and", " ", "IP", "v6", " ", "support", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Wan", "t", "Pref", "ix", "Len_", "==_", "None_", "and_", "want", "prefix", "len_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "want", "prefix", "len_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "\\u", "int", "To", "Bin_", "(_", "self_", "._", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'", "0", "'_", "*_", "(_", "bits_", "-_", "len_", "(_", "ret_", ")_", ")_", "+_", "ret_", "+_", "self_", "._", "\\u", "print", "Prefix_", "(_", "want", "prefix", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "int_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "str", "Compress", "ed_", "(_", "self_", ",_", "want", "prefix", "len_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "string", " ", "represent", "ation", " ", "in", " ", "compress", "ed", " ", "format", " ", "usi", "ng", " ", "'::'", " ", "Nota", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "IP", "('", "127", ".0", ".0", ".1", "')", ".", "str", "Compress", "ed", "()", "\\", "10", ";", " ", " ", " ", " ", "'", "127", ".0", ".0", ".1", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "IP", "('", "200", "1", ":", "065", "8", ":", "022", "a", ":", "caf", "e", ":", "0200", "::", "1", "')", ".", "str", "Compress", "ed", "()", "\\", "10", ";", " ", " ", " ", " ", "'", "200", "1", ":", "658", ":", "2", "2a", ":", "caf", "e", ":", "200", "::", "1", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "IP", "('", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "f", ":", "f", ":", "fff", "c", "/", "127", "')", ".", "str", "Compress", "ed", "()", "\\", "10", ";", " ", " ", " ", " ", "'", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "f", ":", "f", ":", "fff", "c", "/", "127", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "Wan", "t", "Pref", "ix", "Len_", "==_", "None_", "and_", "want", "prefix", "len_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "want", "prefix", "len_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "ipv", "ersion_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "str", "Full", "size_", "(_", "want", "prefix", "len_", ")_", "\\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_", "self_", "._", "ip_", ">>_", "32_", "==_", "0xffff_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipv4_", "=_", "int", "To", "Ip_", "(_", "self_", "._", "ip_", "&_", "0xffffffff_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "\":", ":", "fff", "f", ":\"_", "+_", "ipv4_", "+_", "self_", "._", "\\u", "print", "Prefix_", "(_", "want", "prefix", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "long", "est", " ", "sequence", " ", "of", " ", "'", "0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hex", "tet", "s_", "=_", "[_", "int_", "(_", "x_", ",_", "16_", ")_", "for_", "x_", "in_", "self_", "._", "str", "Full", "size_", "(_", "0_", ")_", "._", "split_", "(_", "':'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "every", " ", "element", " ", "of", " ", "follow", "ing", "zero", "s", " ", "will", " ", "contain", " ", "the", " ", "number", " ", "of", " ", "zeros_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "follow", "ing", " ", "the", " ", "correspond", "ing", " ", "element", " ", "of", " ", "hex", "tet", "s_", "\\u\\u\\uNL\\u\\u\\u_", "follow", "ing", "zeros_", "=_", "[_", "0_", "]_", "*_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "hex", "tet", "s_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "follow", "ing", "zeros_", "[_", "i_", "]_", "=_", "\\u", "count", "Follow", "ing", "Zero", "s_", "(_", "hex", "tet", "s_", "[_", "i_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "compress", "ion", "pos", " ", "is", " ", "the", " ", "position", " ", "where", " ", "we", " ", "can", " ", "start", " ", "remo", "ving", " ", "zeros_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compress", "ion", "pos_", "=_", "follow", "ing", "zeros_", "._", "index_", "(_", "max_", "(_", "follow", "ing", "zeros_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max_", "(_", "follow", "ing", "zeros_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gener", "erate", " ", "string", " ", "with", " ", "the", " ", "long", "est", " ", "number", " ", "of", " ", "zero", "s", " ", "cut", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "we", " ", "need", " ", "hex", "tet", "s", " ", "as", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hex", "tet", "s_", "=_", "[_", "x_", "for_", "x_", "in_", "self_", "._", "str", "Normal_", "(_", "0_", ")_", "._", "split_", "(_", "':'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "compress", "ion", "pos_", "<_", "len_", "(_", "hex", "tet", "s_", ")_", "and_", "hex", "tet", "s_", "[_", "compress", "ion", "pos_", "]_", "==_", "'", "0", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "(_", "hex", "tet", "s_", "[_", "compress", "ion", "pos_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hex", "tet", "s_", "._", "insert_", "(_", "compress", "ion", "pos_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compress", "ion", "pos_", "+_", "1_", ">=_", "len_", "(_", "hex", "tet", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hex", "tet", "s_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compress", "ion", "pos_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hex", "tet", "s_", "=_", "[_", "''_", "]_", "+_", "hex", "tet", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "':'_", "._", "join_", "(_", "hex", "tet", "s_", ")_", "+_", "self_", "._", "\\u", "print", "Prefix_", "(_", "want", "prefix", "len_", ")_", "\\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_", "._", "str", "Normal_", "(_", "0_", ")_", "+_", "self_", "._", "\\u", "print", "Prefix_", "(_", "want", "prefix", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "int_", ":_", "\\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_", "str", "Normal_", "(_", "self_", ",_", "want", "prefix", "len_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "string", " ", "represent", "ation", " ", "in", " ", "the", " ", "usual", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "IP", "('", "127", ".0", ".0", ".1", "')", ".", "str", "Normal", "())", "\\", "10", ";", " ", " ", " ", " ", "127", ".0", ".0", ".1", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "IP", "('", "200", "1", ":", "065", "8", ":", "022", "a", ":", "caf", "e", ":", "0200", "::", "1", "')", ".", "str", "Normal", "())", "\\", "10", ";", " ", " ", " ", " ", "200", "1", ":", "658", ":", "2", "2a", ":", "caf", "e", ":", "200", ":", "0", ":", "0", ":", "1", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "Wan", "t", "Pref", "ix", "Len_", "==_", "None_", "and_", "want", "prefix", "len_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "want", "prefix", "len_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "ipv", "ersion_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "str", "Full", "size_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "ipv", "ersion_", "==_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "':'_", "._", "join_", "(_", "[_", "hex_", "(_", "x_", ")_", "[_", "2_", ":_", "]_", "for_", "x_", "in_", "[_", "int_", "(_", "x_", ",_", "16_", ")_", "for_", "x_", "in_", "self_", "._", "str", "Full", "size_", "(_", "0_", ")_", "._", "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 ", " _", "raise_", "Value", "Error_", "(_", "\"", "only", " ", "IP", "v", "4", " ", "and", " ", "IP", "v6", " ", "support", "ed", "\"_", ")_", "\\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_", "ret_", "+_", "self_", "._", "\\u", "print", "Prefix_", "(_", "want", "prefix", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "int_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "str", "Full", "size_", "(_", "self_", ",_", "want", "prefix", "len_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "string", " ", "represent", "ation", " ", "in", " ", "the", " ", "non", "-", "mangle", "d", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "IP", "('", "127", ".0", ".0", ".1", "')", ".", "str", "Full", "size", "())", "\\", "10", ";", " ", " ", " ", " ", "127", ".0", ".0", ".1", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "IP", "('", "200", "1", ":", "065", "8", ":", "022", "a", ":", "caf", "e", ":", "0200", "::", "1", "')", ".", "str", "Full", "size", "())", "\\", "10", ";", " ", " ", " ", " ", "200", "1", ":", "065", "8", ":", "022", "a", ":", "caf", "e", ":", "0200", ":", "0000", ":", "0000", ":", "0001", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "Wan", "t", "Pref", "ix", "Len_", "==_", "None_", "and_", "want", "prefix", "len_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "want", "prefix", "len_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "int", "To", "Ip_", "(_", "self_", "._", "ip_", ",_", "self_", "._", "\\u", "ipv", "ersion_", ")_", "._", "lower_", "(_", ")_", "+_", "self_", "._", "\\u", "print", "Prefix_", "(_", "want", "prefix", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "int_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "str", "Hex_", "(_", "self_", ",_", "want", "prefix", "len_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "string", " ", "represent", "ation", " ", "in", " ", "hex", " ", "format", " ", "in", " ", "lower", " ", "case", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "IP", "('", "127", ".0", ".0", ".1", "')", ".", "str", "Hex", "()", "\\", "10", ";", " ", " ", " ", " ", "'", "0x7f", "000001", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "IP", "('", "200", "1", ":", "065", "8", ":", "022", "a", ":", "caf", "e", ":", "0200", "::", "1", "')", ".", "str", "Hex", "()", "\\", "10", ";", " ", " ", " ", " ", "'", "0x200", "106", "580", "2", "2a", "caf", "e0", "20000000", "0000001", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "Wan", "t", "Pref", "ix", "Len_", "==_", "None_", "and_", "want", "prefix", "len_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "want", "prefix", "len_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "hex_", "(_", "self_", "._", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", "[_", "-_", "1_", "]_", "==_", "'", "L", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "x_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "._", "lower_", "(_", ")_", "+_", "self_", "._", "\\u", "print", "Prefix_", "(_", "want", "prefix", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IP", "int_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "str", "Dec_", "(_", "self_", ",_", "want", "prefix", "len_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "string", " ", "represent", "ation", " ", "in", " ", "decima", "l", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "IP", "('", "127", ".0", ".0", ".1", "')", ".", "str", "De", "c", "())", "\\", "10", ";", " ", " ", " ", " ", "213", "070", "643", "3", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "IP", "('", "200", "1", ":", "065", "8", ":", "022", "a", ":", "caf", "e", ":", "0200", "::", "1", "')", ".", "str", "De", "c", "())", "\\", "10", ";", " ", " ", " ", " ", "425", "406", "168", "291", "824", "694", "335", "477", "624", "820", "979", "466", "25", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "Wan", "t", "Pref", "ix", "Len_", "==_", "None_", "and_", "want", "prefix", "len_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "want", "prefix", "len_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "str_", "(_", "self_", "._", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", "[_", "-_", "1_", "]_", "==_", "'", "L", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "x_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "+_", "self_", "._", "\\u", "print", "Prefix_", "(_", "want", "prefix", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_derivatives.py
[ { "content": " def test_first_derivative(self):\n\n top = set_as_top(Assembly())\n top.add('comp', Paraboloid())\n top.add('driver', SimpleDriver())\n top.driver.workflow.add(['comp'])\n top.driver.add_parameter('comp.x', low=-1000, high=1000)\n top.driver.add_parameter('comp.y', low=-1000, high=1000)\n top.driver.add_objective('comp.f_xy')\n\n top.comp.x = 3\n top.comp.y = 5\n top.run()\n\n J = top.driver.calc_gradient(outputs=['comp.f_xy'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 5.0, 0.0001)\n assert_rel_error(self, J[0, 1], 21.0, 0.0001)\n\n expected = \"\"\"\\\n------------------------\nCalculated Gradient\n------------------------\n\\[\\[ 5. 21.\\]\\]\n------------------------\nFinite Difference Comparison\n------------------------\n\\[\\[ 5.[0-9]+[ ]+21.[0-9]+\\]\\]\n\n Calculated FiniteDiff RelError[^\\n]+\n----------------------------------------------------------------------------\ncomp.f_xy / comp.x: 5.0 5.[0-9]+[ ]+[^\\n]+\ncomp.f_xy / comp.y: 21.0 21.[0-9]+[ ]+[^\\n]+\n\nAverage RelError: [^\\n]+\nMax RelError: [^ ]+ for comp.f_xy / comp.x\n\n\"\"\"\n stream = StringIO()\n top.driver.check_gradient(outputs=('comp.f_xy',), stream=stream)\n actual = stream.getvalue()\n if re.match(expected, actual) is None:\n print 'Expected:\\n%s' % expected\n print 'Actual:\\n%s' % actual\n self.fail(\"check_gradient() output doesn't match expected\")\n\n stream = StringIO()\n top.check_gradient(outputs=['comp.f_xy'], stream=stream,\n inputs=['comp.x', 'comp.y'])\n actual = stream.getvalue()\n if re.match(expected, actual) is None:\n print 'Expected:\\n%s' % expected\n print 'Actual:\\n%s' % actual\n self.fail(\"check_gradient() output doesn't match expected\")\n\n stream = StringIO()\n top.check_gradient(inputs=('comp.x', 'comp.y'), outputs=('comp.f_xy',),\n stream=stream)\n actual = stream.getvalue()\n if re.match(expected, actual) is None:\n print 'Expected:\\n%s' % expected\n print 'Actual:\\n%s' % actual\n self.fail(\"check_gradient() output doesn't match expected\")\n\n stream = StringIO()\n top.check_gradient(name='driver', outputs=['comp.f_xy'], stream=stream,\n inputs=['comp.x', 'comp.y'])\n actual = stream.getvalue()\n if re.match(expected, actual) is None:\n print 'Expected:\\n%s' % expected\n print 'Actual:\\n%s' % actual\n self.fail(\"check_gradient() output doesn't match expected\")\n\n stream = StringIO()\n top.check_gradient(name='comp', stream=stream)\n actual = stream.getvalue()\n if re.match(expected, actual) is None:\n print 'Expected:\\n%s' % expected\n print 'Actual:\\n%s' % actual\n self.fail(\"check_gradient() output doesn't match expected\")\n\n stream = StringIO()\n top.comp.check_gradient(stream=stream)\n actual = stream.getvalue()\n if re.match(expected, actual) is None:\n print 'Expected:\\n%s' % expected\n print 'Actual:\\n%s' % actual\n self.fail(\"check_gradient() output doesn't match expected\")\n\n stream = StringIO()\n comp = Paraboloid()\n comp.x = 3\n comp.y = 5\n Jbase, J, io_pairs, suspects = comp.check_gradient(stream=stream)\n actual = stream.getvalue()\n if re.match(expected, actual) is None:\n print 'Expected:\\n%s' % expected\n print 'Actual:\\n%s' % actual\n self.fail(\"check_gradient() output doesn't match expected\")\n\n # now do it again to make sure name and parent were properly reset\n Jbase, J, io_pairs, suspects = comp.check_gradient(stream=stream)\n actual = stream.getvalue()\n if re.match(expected, actual) is None:\n print 'Expected:\\n%s' % expected\n print 'Actual:\\n%s' % actual\n self.fail(\"check_gradient() output doesn't match expected\")", "metadata": "root.Testcase_derivatives.test_first_derivative", "header": "['class', 'Testcase_derivatives', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 972 }, { "content": " def test_nested(self):\n\n top = set_as_top(Assembly())\n top.add('nest', Assembly())\n top.nest.add('comp', Paraboloid())\n\n # We shouldn't calculate a derivative of this\n top.nest.comp.add('unwanted', Float(12.34, iotype='in'))\n top.nest.comp.add('junk', Float(9.9, iotype='out'))\n\n top.driver.workflow.add(['nest'])\n top.nest.driver.workflow.add(['comp'])\n top.nest.create_passthrough('comp.x')\n top.nest.create_passthrough('comp.y')\n top.nest.create_passthrough('comp.unwanted')\n top.nest.create_passthrough('comp.f_xy')\n top.nest.x = 3\n top.nest.y = 5\n top.run()\n\n # Now we need to set a deriv policy to prevent squawking\n # about missing deriatives.\n top.nest.comp.missing_deriv_policy = 'assume_zero'\n\n J = top.driver.calc_gradient(inputs=['nest.x', 'nest.y'],\n outputs=['nest.f_xy'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 5.0, 0.0001)\n assert_rel_error(self, J[0, 1], 21.0, 0.0001)\n\n J = top.driver.calc_gradient(inputs=['nest.x', 'nest.y'],\n outputs=['nest.f_xy'],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 5.0, 0.0001)\n assert_rel_error(self, J[0, 1], 21.0, 0.0001)\n\n # Now, let's find the derivative of the unconnected. Behaviour depends\n # on deriv policy.\n top.nest.add('stuff', Float(1.0, iotype='in'))\n top.nest.add('junk', Float(1.0, iotype='out'))\n top.add('first', Paraboloid())\n top.add('last', Paraboloid())\n top.connect('first.f_xy', 'nest.stuff')\n top.connect('nest.junk', 'last.x')\n top.driver.workflow.clear()\n top.driver.workflow.add(['first', 'nest', 'last'])\n\n top.nest.comp.missing_deriv_policy = 'assume_zero'\n top.run()\n J = top.driver.calc_gradient(inputs=['nest.x', 'first.x'],\n outputs=['nest.f_xy', 'last.f_xy'],\n mode='forward')\n\n top.nest.missing_deriv_policy = 'assume_zero'\n J = top.driver.calc_gradient(inputs=['nest.x', 'first.x'],\n outputs=['nest.f_xy', 'last.f_xy'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 5.0, .001)\n assert_rel_error(self, J[0, 1], 0.0, .001)\n assert_rel_error(self, J[1, 0], 0.0, .001)\n assert_rel_error(self, J[1, 1], 0.0, .001)\n\n top.nest.missing_deriv_policy = 'error'\n\n J = top.driver.calc_gradient(inputs=['first.x'],\n outputs=['last.f_xy'],\n mode='forward')\n\n top.nest.missing_deriv_policy = 'assume_zero'\n J = top.driver.calc_gradient(inputs=['first.x'],\n outputs=['last.f_xy'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 0.0, .001)\n\n J = top.driver.calc_gradient(inputs=['nest.x', 'nest.stuff'],\n outputs=['nest.f_xy', 'nest.junk'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 5.0, .001)\n assert_rel_error(self, J[0, 1], 0.0, .001)\n assert_rel_error(self, J[1, 0], 0.0, .001)\n assert_rel_error(self, J[1, 1], 0.0, .001)\n\n J = top.driver.calc_gradient(inputs=['nest.stuff', 'nest.x'],\n outputs=['nest.junk', 'nest.f_xy', ],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 0.0, .001)\n assert_rel_error(self, J[0, 1], 0.0, .001)\n assert_rel_error(self, J[1, 0], 0.0, .001)\n assert_rel_error(self, J[1, 1], 5.0, .001)\n\n J = top.driver.calc_gradient(inputs=['nest.stuff', 'nest.x'],\n outputs=['nest.junk', 'nest.f_xy', ],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 0.0, .001)\n assert_rel_error(self, J[0, 1], 0.0, .001)\n assert_rel_error(self, J[1, 0], 0.0, .001)\n assert_rel_error(self, J[1, 1], 5.0, .001)\n\n J = top.driver.calc_gradient(inputs=['nest.stuff', 'nest.x'],\n outputs=['nest.f_xy', ],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 0.0, .001)\n assert_rel_error(self, J[0, 1], 5.0, .001)\n\n J = top.driver.calc_gradient(inputs=['nest.x', 'nest.stuff'],\n outputs=['nest.f_xy', ],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 5.0, .001)\n assert_rel_error(self, J[0, 1], 0.0, .001)\n\n J = top.driver.calc_gradient(inputs=['nest.x', 'nest.stuff'],\n outputs=['nest.f_xy', 'nest.junk'],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 5.0, .001)\n assert_rel_error(self, J[0, 1], 0.0, .001)\n assert_rel_error(self, J[1, 0], 0.0, .001)\n assert_rel_error(self, J[1, 1], 0.0, .001)\n\n J = top.driver.calc_gradient(inputs=['nest.stuff'],\n outputs=['nest.junk'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 0.0, .001)\n\n top.nest.missing_deriv_policy = 'error'\n J = top.driver.calc_gradient(inputs=['nest.stuff'],\n outputs=['nest.junk'],\n mode='forward')", "metadata": "root.Testcase_derivatives.test_nested", "header": "['class', 'Testcase_derivatives', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1247 }, { "content": " def test_nested_2Darray(self):\n\n top = set_as_top(Assembly())\n top.add('nest', Assembly())\n top.nest.add('comp', ArrayComp2D())\n\n top.driver.workflow.add(['nest'])\n top.nest.driver.workflow.add(['comp'])\n top.nest.create_passthrough('comp.x')\n top.nest.create_passthrough('comp.y')\n top.run()\n\n J = top.driver.calc_gradient(inputs=['nest.x',],\n outputs=['nest.y'],\n mode='forward')\n\n diff = J - top.nest.comp.J\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n J = top.driver.calc_gradient(inputs=['nest.x',],\n outputs=['nest.y'],\n mode='adjoint')\n diff = J - top.nest.comp.J\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n J = top.driver.calc_gradient(inputs=['nest.x[0, 0]',],\n outputs=['nest.y[0, 0]'],\n mode='forward')\n\n diff = J - top.nest.comp.J[0, 0]\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n J = top.driver.calc_gradient(inputs=['nest.x[0, 0]',],\n outputs=['nest.y[0, 0]'],\n mode='adjoint')\n\n diff = J - top.nest.comp.J[0, 0]\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n J = top.driver.calc_gradient(inputs=['nest.x[0, 1]',],\n outputs=['nest.y[1, 0]'],\n mode='forward')\n\n diff = J - top.nest.comp.J[1, 2]\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n J = top.driver.calc_gradient(inputs=['nest.x[0, 1]',],\n outputs=['nest.y[1, 0]'],\n mode='adjoint')\n\n diff = J - top.nest.comp.J[1, 2]\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n J = top.driver.calc_gradient(inputs=['nest.x[0, 1]',],\n outputs=['nest.y[1, 0]'],\n mode='fd')\n\n diff = J - top.nest.comp.J[1, 2]\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n J = top.driver.calc_gradient(inputs=['nest.x[0, -1]',],\n outputs=['nest.y[-1, 0]'],\n mode='forward')\n\n diff = J - top.nest.comp.J[1, 2]\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n J = top.driver.calc_gradient(inputs=['nest.x[0, -1]',],\n outputs=['nest.y[-1, 0]'],\n mode='adjoint')\n\n diff = J - top.nest.comp.J[1, 2]\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n J = top.driver.calc_gradient(inputs=['nest.x[0, -1]',],\n outputs=['nest.y[-1, 0]'],\n mode='fd')\n\n diff = J - top.nest.comp.J[1, 2]\n assert_rel_error(self, diff.max(), 0.0, .000001)\n\n Jsub = top.nest.comp.J[2:3, 2:3]\n J = top.driver.calc_gradient(inputs=['nest.x[1][:]',],\n outputs=['nest.y[1][:]'],\n mode='forward')\n\n diff = J - Jsub\n\n J = top.driver.calc_gradient(inputs=['nest.x[1][:]',],\n outputs=['nest.y[1][:]'],\n mode='adjoint')\n\n diff = J - Jsub\n\n top.run()\n J = top.driver.calc_gradient(inputs=['nest.x[1][:]',],\n outputs=['nest.y[1][:]'],\n mode='fd')\n diff = J - Jsub", "metadata": "root.Testcase_derivatives.test_nested_2Darray", "header": "['class', 'Testcase_derivatives', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2004 }, { "content": " def test_missing_derivs_error(self):\n self.top = set_as_top(Assembly())\n\n self.top.add('driver', SimpleDriver())\n self.top.add('dis2', SimpleCompMissingDeriv())\n self.top.driver.add_objective('(dis2.y)**2')\n self.top.driver.add_parameter('dis2.x', low=-10.0, high=10.0)\n self.top.driver.add_constraint('dis2.miss_out < 24.0')\n\n self.top.run()\n try:\n J = self.top.driver.calc_gradient(mode='forward')\n except Exception as err:\n self.assertEqual(str(err),\n \"'dis2 (1-dis2): does not provide analytical derivatives for\"\n \" miss_out'\")\n else:\n self.fail(\"exception expected\")\n\n self.top.driver.remove_constraint('dis2.miss_out < 24.0')\n self.top.driver.add_constraint('dis2.y < 24.0')\n self.top.driver.remove_parameter('dis2.x')\n self.top.driver.add_parameter('dis2.miss_in', low=-10.0, high=10.0)\n\n try:\n J = self.top.driver.calc_gradient(mode='forward')\n except Exception as err:\n self.assertEqual(str(err),\n \"'dis2 (1-dis2): does not provide analytical derivatives for\"\n \" miss_in'\")\n else:\n self.fail(\"exception expected\")", "metadata": "root.Testcase_derivatives.test_missing_derivs_error", "header": "['class', 'Testcase_derivatives', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2899 }, { "content": " def test_simple(self):\n\n top = set_as_top(Assembly())\n top.add('comp', PreComp())\n top.driver.workflow.add('comp')\n\n J = top.driver.calc_gradient(inputs=['comp.x1', 'comp.x2'],\n outputs=['comp.y1', 'comp.y2'],\n mode='forward')\n\n #print J\n # TODO: transform back to original coords\n #assert_rel_error(self, J[0, 0], 2.0, 0.0001)\n #assert_rel_error(self, J[0, 1], 7.0, 0.0001)\n #assert_rel_error(self, J[1, 0], 13.0, 0.0001)\n #assert_rel_error(self, J[1, 1], -3.0, 0.0001)\n\n J = top.driver.calc_gradient(inputs=['comp.x1', 'comp.x2'],\n outputs=['comp.y1', 'comp.y2'],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 2.0, 0.0001)\n assert_rel_error(self, J[0, 1], 7.0, 0.0001)\n assert_rel_error(self, J[1, 0], 13.0, 0.0001)\n assert_rel_error(self, J[1, 1], -3.0, 0.0001)", "metadata": "root.Testcase_preconditioning.test_simple", "header": "['class', 'Testcase_preconditioning', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3289 }, { "content": " def test_two_comp(self):\n\n top = set_as_top(Assembly())\n\n top.add('comp1', PreComp())\n top.add('comp2', PreComp())\n top.connect('comp1.y1', 'comp2.x1')\n top.connect('comp1.y2', 'comp2.x2')\n\n top.add('driver', SimpleDriver())\n top.driver.workflow.add(['comp1', 'comp2'])\n top.driver.add_parameter('comp1.x1', low=-10, high=10)\n top.driver.add_parameter('comp1.x2', low=-10, high=10)\n top.driver.add_objective('comp2.y1 + comp2.y2')\n\n top.run()\n\n J = top.driver.calc_gradient(mode='forward')\n #print J\n\n J = top.driver.calc_gradient(mode='adjoint')\n assert_rel_error(self, J[0, 0], 82.0, 0.0001)\n assert_rel_error(self, J[0, 1], 93.0, 0.0001)", "metadata": "root.Testcase_preconditioning.test_two_comp", "header": "['class', 'Testcase_preconditioning', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3315 }, { "content": " def test_two_comp_array(self):\n\n top = set_as_top(Assembly())\n\n top.add('comp1', PreCompArray())\n top.add('comp2', PreCompArray())\n top.connect('comp1.y', 'comp2.x')\n\n top.add('driver', SimpleDriver())\n top.driver.workflow.add(['comp1', 'comp2'])\n top.driver.add_parameter('comp1.x[0]', low=-10, high=10)\n top.driver.add_parameter('comp1.x[1]', low=-10, high=10)\n top.driver.add_objective('comp2.y[0]')\n\n top.run()\n\n J = top.driver.calc_gradient(mode='forward')\n #print J\n\n J = top.driver.calc_gradient(mode='adjoint')\n assert_rel_error(self, J[0, 0], 95.0, 0.0001)\n assert_rel_error(self, J[0, 1], -7.0, 0.0001)", "metadata": "root.Testcase_preconditioning.test_two_comp_array", "header": "['class', 'Testcase_preconditioning', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3339 }, { "content": " def test_nested_array_element(self):\n\n top = set_as_top(Assembly())\n top.add('nest', Assembly())\n\n top.nest.add('comp1', PreCompArray())\n top.nest.add('comp2', PreCompArray())\n top.nest.add('comp3', PreCompArray())\n top.nest.connect('comp1.y', 'comp2.x')\n top.nest.driver.workflow.add(['comp1', 'comp2', 'comp3'])\n top.nest.create_passthrough('comp1.x')\n top.nest.create_passthrough('comp2.y')\n top.nest.add('yyy', Array([0.0, 0.0], iotype='out'))\n top.nest.add('dumb', Array(array([2.0, 4.0]), iotype='in'))\n top.nest.connect('comp1.y', 'yyy')\n top.nest.connect('dumb', 'comp3.x')\n\n top.add('driver', SimpleDriver())\n top.driver.workflow.add(['nest'])\n top.driver.add_parameter('nest.x[0]', low=-10, high=10)\n top.driver.add_parameter('nest.x[1]', low=-10, high=10)\n top.driver.add_parameter('nest.dumb[0]', low=-10, high=10)\n top.driver.add_parameter('nest.dumb[1]', low=-10, high=10)\n top.driver.add_objective('nest.y[0]')\n top.driver.add_constraint('nest.yyy[0] + nest.yyy[1] < 0')\n\n top.run()\n\n J = top.driver.calc_gradient(mode='forward')\n #print J\n\n J = top.driver.calc_gradient(mode='adjoint')\n #print J\n\n\n assert_rel_error(self, J[0, 0], 95.0, 0.0001)\n assert_rel_error(self, J[0, 1], -7.0, 0.0001)\n assert_rel_error(self, J[0, 2], 0.0, 0.0001)\n assert_rel_error(self, J[0, 3], 0.0, 0.0001)\n assert_rel_error(self, J[1, 0], 15.0, 0.0001)\n assert_rel_error(self, J[1, 1], 4.0, 0.0001)\n assert_rel_error(self, J[1, 2], 0.0, 0.0001)\n assert_rel_error(self, J[1, 3], 0.0, 0.0001)", "metadata": "root.Testcase_preconditioning.test_nested_array_element", "header": "['class', 'Testcase_preconditioning', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3362 }, { "content": " def test_two_comp_bifurcation(self):\n\n top = set_as_top(Assembly())\n\n top.add('comp1', PreComp())\n top.add('comp2', PreComp())\n top.add('comp3', PreComp())\n top.add('comp4', PreComp())\n top.connect('comp1.y1', 'comp2.x1')\n top.connect('comp1.y2', 'comp2.x2')\n top.connect('comp1.y1', 'comp3.x1')\n top.connect('comp1.y2', 'comp3.x2')\n top.connect('comp2.y1 + comp3.y1', 'comp4.x1')\n top.connect('comp2.y2 - comp3.y2', 'comp4.x2')\n\n top.add('driver', SimpleDriver())\n top.driver.workflow.add(['comp1', 'comp2', 'comp3', 'comp4'])\n top.driver.add_parameter('comp1.x1', low=-10, high=10)\n top.driver.add_parameter('comp1.x2', low=-10, high=10)\n top.driver.add_objective('comp4.y1 + comp2.y1')\n top.driver.add_constraint('comp4.y2 + comp3.y2 < 0')\n\n top.run()\n\n J = top.driver.calc_gradient(mode='forward')\n #print J\n\n J = top.driver.calc_gradient(mode='adjoint')\n assert_rel_error(self, J[0, 0], 475.0, 0.0001)\n assert_rel_error(self, J[0, 1], -35.0, 0.0001)\n assert_rel_error(self, J[1, 0], 2457.0, 0.0001)\n assert_rel_error(self, J[1, 1], -82.0, 0.0001)", "metadata": "root.Testcase_preconditioning.test_two_comp_bifurcation", "header": "['class', 'Testcase_preconditioning', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 3406 } ]
[ { "span": "Jbase,", "start_line": 1066, "start_column": 8, "end_line": 1066, "end_column": 13 }, { "span": "J,", "start_line": 1066, "start_column": 15, "end_line": 1066, "end_column": 16 }, { "span": "io_pairs,", "start_line": 1066, "start_column": 18, "end_line": 1066, "end_column": 26 }, { "span": "suspects ", "start_line": 1066, "start_column": 28, "end_line": 1066, "end_column": 36 }, { "span": "J ", "start_line": 1298, "start_column": 8, "end_line": 1298, "end_column": 9 }, { "span": "J ", "start_line": 1314, "start_column": 8, "end_line": 1314, "end_column": 9 }, { "span": "diff ", "start_line": 2090, "start_column": 8, "end_line": 2090, "end_column": 12 }, { "span": "diff ", "start_line": 2096, "start_column": 8, "end_line": 2096, "end_column": 12 }, { "span": "J ", "start_line": 2910, "start_column": 12, "end_line": 2910, "end_column": 13 }, { "span": "J ", "start_line": 3295, "start_column": 8, "end_line": 3295, "end_column": 9 }, { "span": "J ", "start_line": 3332, "start_column": 8, "end_line": 3332, "end_column": 9 }, { "span": "J ", "start_line": 3355, "start_column": 8, "end_line": 3355, "end_column": 9 }, { "span": "J ", "start_line": 3390, "start_column": 8, "end_line": 3390, "end_column": 9 }, { "span": "J ", "start_line": 3430, "start_column": 8, "end_line": 3430, "end_column": 9 } ]
[ { "span": "Jbase,", "start_line": 1074, "start_column": 8, "end_line": 1074, "end_column": 13 }, { "span": "io_pairs,", "start_line": 1074, "start_column": 18, "end_line": 1074, "end_column": 26 }, { "span": "suspects ", "start_line": 1074, "start_column": 28, "end_line": 1074, "end_column": 36 }, { "span": "diff ", "start_line": 2102, "start_column": 8, "end_line": 2102, "end_column": 12 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "case", "\\u", "derivatives", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "first", "\\u", "derivative_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "'_", ",_", "Para", "bolo", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Simple", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "comp", ".", "x", "'_", ",_", "low_", "=_", "-_", "1000_", ",_", "high_", "=_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "comp", ".", "y", "'_", ",_", "low_", "=_", "-_", "1000_", ",_", "high_", "=_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "objective_", "(_", "'", "comp", ".", "f", "\\u", "xy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "comp_", "._", "x_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "comp_", "._", "y_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "outputs_", "=_", "[_", "'", "comp", ".", "f", "\\u", "xy", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "5.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "21.", "0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "\"\"\"", "\\\\", "\\", "10", ";", "--------------", "----------", "\\", "10", ";", "Calculat", "ed", " ", "Grad", "ient", "\\", "10", ";", "--------------", "----------", "\\", "10", ";\\\\", "[\\\\", "[", " ", " ", "5", ".", " ", " ", "21.", "\\\\]", "\\\\]", "\\", "10", ";", "--------------", "----------", "\\", "10", ";", "Fini", "te", " ", "Difference", " ", "Compari", "son", "\\", "10", ";", "--------------", "----------", "\\", "10", ";\\\\", "[\\\\", "[", " ", " ", "5", ".", "[", "0", "-", "9", "]+", "[", " ", "]+", "21.", "[", "0", "-", "9", "]+\\\\", "]\\\\", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", "Calculat", "ed", " ", " ", " ", " ", " ", "Fini", "te", "Diff", " ", " ", " ", " ", " ", "Rel", "Error", "[", "^", "\\\\", "n", "]+", "\\", "10", ";", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "\\", "10", ";", "comp", ".", "f", "\\u", "xy", " ", "/", " ", "comp", ".", "x", ":", " ", "5.0", " ", " ", " ", " ", "5", ".", "[", "0", "-", "9", "]+", "[", " ", "]+", "[", "^", "\\\\", "n", "]+", "\\", "10", ";", "comp", ".", "f", "\\u", "xy", " ", "/", " ", "comp", ".", "y", ":", " ", "21.", "0", " ", " ", " ", "21.", "[", "0", "-", "9", "]+", "[", " ", "]+", "[", "^", "\\\\", "n", "]+", "\\", "10", ";", "\\", "10", ";", "Average", " ", "Rel", "Error", ":", " ", "[", "^", "\\\\", "n", "]+", "\\", "10", ";", "Max", " ", "Rel", "Error", ":", " ", "[", "^", " ", "]+", " ", "for", " ", "comp", ".", "f", "\\u", "xy", " ", "/", " ", "comp", ".", "x", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "check", "\\u", "gradient_", "(_", "outputs_", "=_", "(_", "'", "comp", ".", "f", "\\u", "xy", "'_", ",_", ")_", ",_", "stream_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "expected_", ",_", "actual_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Expect", "ed", ":\\\\", "n", "%", "s", "'_", "%_", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Actual", ":\\\\", "n", "%", "s", "'_", "%_", "actual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "check", "\\u", "gradi", "ent", "()", " ", "output", " ", "doe", "sn", "'", "t", " ", "match", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "check", "\\u", "gradient_", "(_", "outputs_", "=_", "[_", "'", "comp", ".", "f", "\\u", "xy", "'_", "]_", ",_", "stream_", "=_", "stream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inputs_", "=_", "[_", "'", "comp", ".", "x", "'_", ",_", "'", "comp", ".", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "expected_", ",_", "actual_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Expect", "ed", ":\\\\", "n", "%", "s", "'_", "%_", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Actual", ":\\\\", "n", "%", "s", "'_", "%_", "actual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "check", "\\u", "gradi", "ent", "()", " ", "output", " ", "doe", "sn", "'", "t", " ", "match", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "check", "\\u", "gradient_", "(_", "inputs_", "=_", "(_", "'", "comp", ".", "x", "'_", ",_", "'", "comp", ".", "y", "'_", ")_", ",_", "outputs_", "=_", "(_", "'", "comp", ".", "f", "\\u", "xy", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stream_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "expected_", ",_", "actual_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Expect", "ed", ":\\\\", "n", "%", "s", "'_", "%_", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Actual", ":\\\\", "n", "%", "s", "'_", "%_", "actual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "check", "\\u", "gradi", "ent", "()", " ", "output", " ", "doe", "sn", "'", "t", " ", "match", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "check", "\\u", "gradient_", "(_", "name_", "=_", "'", "driver", "'_", ",_", "outputs_", "=_", "[_", "'", "comp", ".", "f", "\\u", "xy", "'_", "]_", ",_", "stream_", "=_", "stream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inputs_", "=_", "[_", "'", "comp", ".", "x", "'_", ",_", "'", "comp", ".", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "expected_", ",_", "actual_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Expect", "ed", ":\\\\", "n", "%", "s", "'_", "%_", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Actual", ":\\\\", "n", "%", "s", "'_", "%_", "actual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "check", "\\u", "gradi", "ent", "()", " ", "output", " ", "doe", "sn", "'", "t", " ", "match", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "check", "\\u", "gradient_", "(_", "name_", "=_", "'", "comp", "'_", ",_", "stream_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "expected_", ",_", "actual_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Expect", "ed", ":\\\\", "n", "%", "s", "'_", "%_", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Actual", ":\\\\", "n", "%", "s", "'_", "%_", "actual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "check", "\\u", "gradi", "ent", "()", " ", "output", " ", "doe", "sn", "'", "t", " ", "match", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "comp_", "._", "check", "\\u", "gradient_", "(_", "stream_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "expected_", ",_", "actual_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Expect", "ed", ":\\\\", "n", "%", "s", "'_", "%_", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Actual", ":\\\\", "n", "%", "s", "'_", "%_", "actual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "check", "\\u", "gradi", "ent", "()", " ", "output", " ", "doe", "sn", "'", "t", " ", "match", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "=_", "Para", "bolo", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "._", "x_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "._", "y_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J", "base_", ",_", "J_", ",_", "io", "\\u", "pairs_", ",_", "suspe", "cts_", "=_", "comp_", "._", "check", "\\u", "gradient_", "(_", "stream_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "expected_", ",_", "actual_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Expect", "ed", ":\\\\", "n", "%", "s", "'_", "%_", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Actual", ":\\\\", "n", "%", "s", "'_", "%_", "actual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "check", "\\u", "gradi", "ent", "()", " ", "output", " ", "doe", "sn", "'", "t", " ", "match", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "do", " ", "it", " ", "again", " ", "to", " ", "make", " ", "sure", " ", "name", " ", "and", " ", "parent", " ", "wer", "e", " ", "proper", "ly", " ", "reset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "J", "base_", ",_", "J_", ",_", "io", "\\u", "pairs_", ",_", "suspe", "cts_", "=_", "comp_", "._", "check", "\\u", "gradient_", "(_", "stream_", "=_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "stream_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "expected_", ",_", "actual_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Expect", "ed", ":\\\\", "n", "%", "s", "'_", "%_", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Actual", ":\\\\", "n", "%", "s", "'_", "%_", "actual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "check", "\\u", "gradi", "ent", "()", " ", "output", " ", "doe", "sn", "'", "t", " ", "match", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "derivatives", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nested_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "nest", "'_", ",_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "comp", "'_", ",_", "Para", "bolo", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", "n", "'", "t", " ", "calcul", "ate", " ", "a", " ", "deriv", "ative", " ", "of", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "nest_", "._", "comp_", "._", "add_", "(_", "'", "unwa", "nte", "d", "'_", ",_", "Float_", "(_", "12.3", "4_", ",_", "iot", "ype_", "=_", "'", "in", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "comp_", "._", "add_", "(_", "'", "junk", "'_", ",_", "Float_", "(_", "9.9", "_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "nest", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", ".", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", ".", "unwa", "nte", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", ".", "f", "\\u", "xy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "x_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "y_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "we", " ", "need", " ", "to", " ", "set", " ", "a", " ", "deriv", " ", "policy", " ", "to", " ", "prevent", " ", "squa", "wk", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "abo", "ut", " ", "missi", "ng", " ", "der", "iati", "ves", "._", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "nest_", "._", "comp_", "._", "missi", "ng", "\\u", "deriv", "\\u", "policy_", "=_", "'", "assume", "\\u", "zero", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "'_", ",_", "'", "nest", ".", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "f", "\\u", "xy", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "5.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "21.", "0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "'_", ",_", "'", "nest", ".", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "f", "\\u", "xy", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "5.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "21.", "0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "let", "'", "s", " ", "find", " ", "the", " ", "deriv", "ative", " ", "of", " ", "the", " ", "uncon", "nect", "ed", ".", " ", "Behavio", "ur", " ", "depends_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "deriv", " ", "policy", "._", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "stu", "ff", "'_", ",_", "Float_", "(_", "1.0_", ",_", "iot", "ype_", "=_", "'", "in", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "junk", "'_", ",_", "Float_", "(_", "1.0_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "first", "'_", ",_", "Para", "bolo", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "last", "'_", ",_", "Para", "bolo", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "first", ".", "f", "\\u", "xy", "'_", ",_", "'", "nest", ".", "stu", "ff", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "nest", ".", "junk", "'_", ",_", "'", "last", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "first", "'_", ",_", "'", "nest", "'_", ",_", "'", "last", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "nest_", "._", "comp_", "._", "missi", "ng", "\\u", "deriv", "\\u", "policy_", "=_", "'", "assume", "\\u", "zero", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "'_", ",_", "'", "first", ".", "x", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "f", "\\u", "xy", "'_", ",_", "'", "last", ".", "f", "\\u", "xy", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "nest_", "._", "missi", "ng", "\\u", "deriv", "\\u", "policy_", "=_", "'", "assume", "\\u", "zero", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "'_", ",_", "'", "first", ".", "x", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "f", "\\u", "xy", "'_", ",_", "'", "last", ".", "f", "\\u", "xy", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "5.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "1_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "nest_", "._", "missi", "ng", "\\u", "deriv", "\\u", "policy_", "=_", "'", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "first", ".", "x", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "last", ".", "f", "\\u", "xy", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "nest_", "._", "missi", "ng", "\\u", "deriv", "\\u", "policy_", "=_", "'", "assume", "\\u", "zero", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "first", ".", "x", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "last", ".", "f", "\\u", "xy", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "'_", ",_", "'", "nest", ".", "stu", "ff", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "f", "\\u", "xy", "'_", ",_", "'", "nest", ".", "junk", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "5.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "1_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "stu", "ff", "'_", ",_", "'", "nest", ".", "x", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "junk", "'_", ",_", "'", "nest", ".", "f", "\\u", "xy", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "1_", "]_", ",_", "5.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "stu", "ff", "'_", ",_", "'", "nest", ".", "x", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "junk", "'_", ",_", "'", "nest", ".", "f", "\\u", "xy", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "1_", "]_", ",_", "5.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "stu", "ff", "'_", ",_", "'", "nest", ".", "x", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "f", "\\u", "xy", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "5.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "'_", ",_", "'", "nest", ".", "stu", "ff", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "f", "\\u", "xy", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "5.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "'_", ",_", "'", "nest", ".", "stu", "ff", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "f", "\\u", "xy", "'_", ",_", "'", "nest", ".", "junk", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "5.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "1_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "stu", "ff", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "junk", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "nest_", "._", "missi", "ng", "\\u", "deriv", "\\u", "policy_", "=_", "'", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "stu", "ff", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "junk", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "derivatives", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nest", "ed", "\\u", "2", "Dar", "ray_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "nest", "'_", ",_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "comp", "'_", ",_", "Array", "Comp", "2", "D_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "nest", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", ".", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "0", ",", " ", "0", "]'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[", "0", ",", " ", "0", "]'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "0", ",", " ", "0", "]'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[", "0", ",", " ", "0", "]'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "0", ",", " ", "1", "]'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[", "1", ",", " ", "0", "]'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "[_", "1_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "0", ",", " ", "1", "]'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[", "1", ",", " ", "0", "]'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "[_", "1_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "0", ",", " ", "1", "]'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[", "1", ",", " ", "0", "]'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "fd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "[_", "1_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "0", ",", " ", "-1", "]'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[-", "1", ",", " ", "0", "]'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "[_", "1_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "0", ",", " ", "-1", "]'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[-", "1", ",", " ", "0", "]'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "[_", "1_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "0", ",", " ", "-1", "]'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[-", "1", ",", " ", "0", "]'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "fd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "[_", "1_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "diff_", "._", "max_", "(_", ")_", ",_", "0.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Js", "ub_", "=_", "top_", "._", "nest_", "._", "comp_", "._", "J_", "[_", "2_", ":_", "3_", ",_", "2_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "1", "][", ":]", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[", "1", "][", ":]", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "Js", "ub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "1", "][", ":]", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[", "1", "][", ":]", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "J_", "-_", "Js", "ub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "nest", ".", "x", "[", "1", "][", ":]", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "nest", ".", "y", "[", "1", "][", ":]", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "fd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff_", "=_", "J_", "-_", "Js", "ub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "derivatives", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "missi", "ng", "\\u", "deriv", "s", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Simple", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "add_", "(_", "'", "dis", "2", "'_", ",_", "Simple", "Comp", "Missing", "Der", "iv_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "add", "\\u", "objective_", "(_", "'(", "dis", "2", ".", "y", ")**", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "dis", "2", ".", "x", "'_", ",_", "low_", "=_", "-_", "10.0_", ",_", "high_", "=_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "dis", "2", ".", "miss", "\\u", "out", " ", "<", " ", "24.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "dis", "2", " ", "(", "1", "-", "dis", "2", "):", " ", "doe", "s", " ", "not", " ", "provide", " ", "analytic", "al", " ", "derivatives", " ", "for", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "miss", "\\u", "out", "'\"_", ")_", "\\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_", "(_", "\"", "exception", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "remove", "\\u", "constraint_", "(_", "'", "dis", "2", ".", "miss", "\\u", "out", " ", "<", " ", "24.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "dis", "2", ".", "y", " ", "<", " ", "24.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "remove", "\\u", "parameter_", "(_", "'", "dis", "2", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "dis", "2", ".", "miss", "\\u", "in", "'_", ",_", "low_", "=_", "-_", "10.0_", ",_", "high_", "=_", "10.0_", ")_", "\\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 ", " _", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "dis", "2", " ", "(", "1", "-", "dis", "2", "):", " ", "doe", "s", " ", "not", " ", "provide", " ", "analytic", "al", " ", "derivatives", " ", "for", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "miss", "\\u", "in", "'\"_", ")_", "\\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_", "(_", "\"", "exception", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "precondition", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "'_", ",_", "Pre", "Comp_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "'", "comp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", ".", "x1", "'_", ",_", "'", "comp", ".", "x2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", ".", "y1", "'_", ",_", "'", "comp", ".", "y2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "J_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "transform", " ", "back", " ", "to", " ", "original", " ", "coords_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", "\\u", "rel", "\\u", "error", "(", "self", ",", " ", "J", "[", "0", ",", " ", "0", "],", " ", "2.0", ",", " ", "0.0001", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", "\\u", "rel", "\\u", "error", "(", "self", ",", " ", "J", "[", "0", ",", " ", "1", "],", " ", "7.0", ",", " ", "0.0001", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", "\\u", "rel", "\\u", "error", "(", "self", ",", " ", "J", "[", "1", ",", " ", "0", "],", " ", "13.", "0", ",", " ", "0.0001", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", "\\u", "rel", "\\u", "error", "(", "self", ",", " ", "J", "[", "1", ",", " ", "1", "],", " ", "-", "3.0", ",", " ", "0.0001", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", ".", "x1", "'_", ",_", "'", "comp", ".", "x2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", ".", "y1", "'_", ",_", "'", "comp", ".", "y2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "2.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "7.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "13.", "0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "1_", "]_", ",_", "-_", "3.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "precondition", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "two", "\\u", "comp_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "1", "'_", ",_", "Pre", "Comp_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "2", "'_", ",_", "Pre", "Comp_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "comp", "1", ".", "y1", "'_", ",_", "'", "comp", "2", ".", "x1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "comp", "1", ".", "y2", "'_", ",_", "'", "comp", "2", ".", "x2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Simple", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "1", "'_", ",_", "'", "comp", "2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "comp", "1", ".", "x1", "'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "comp", "1", ".", "x2", "'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "objective_", "(_", "'", "comp", "2", ".", "y1", " ", "+", " ", "comp", "2", ".", "y2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "J_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "82.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "93.", "0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "precondition", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "two", "\\u", "comp", "\\u", "array_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "1", "'_", ",_", "Pre", "Comp", "Array_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "2", "'_", ",_", "Pre", "Comp", "Array_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "comp", "1", ".", "y", "'_", ",_", "'", "comp", "2", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Simple", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "1", "'_", ",_", "'", "comp", "2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "comp", "1", ".", "x", "[", "0", "]'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "comp", "1", ".", "x", "[", "1", "]'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "objective_", "(_", "'", "comp", "2", ".", "y", "[", "0", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "J_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "95.", "0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "-_", "7.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "precondition", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nest", "ed", "\\u", "array", "\\u", "element_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "nest", "'_", ",_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "comp", "1", "'_", ",_", "Pre", "Comp", "Array_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "comp", "2", "'_", ",_", "Pre", "Comp", "Array_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "comp", "3", "'_", ",_", "Pre", "Comp", "Array_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "connect_", "(_", "'", "comp", "1", ".", "y", "'_", ",_", "'", "comp", "2", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "1", "'_", ",_", "'", "comp", "2", "'_", ",_", "'", "comp", "3", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", "1", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", "2", ".", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "yyy", "'_", ",_", "Array_", "(_", "[_", "0.0_", ",_", "0.0_", "]_", ",_", "iot", "ype_", "=_", "'", "out", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "dumb", "'_", ",_", "Array_", "(_", "array_", "(_", "[_", "2.0_", ",_", "4.0_", "]_", ")_", ",_", "iot", "ype_", "=_", "'", "in", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "connect_", "(_", "'", "comp", "1", ".", "y", "'_", ",_", "'", "yyy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "connect_", "(_", "'", "dumb", "'_", ",_", "'", "comp", "3", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Simple", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "nest", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "nest", ".", "x", "[", "0", "]'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "nest", ".", "x", "[", "1", "]'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "nest", ".", "dumb", "[", "0", "]'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "nest", ".", "dumb", "[", "1", "]'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "objective_", "(_", "'", "nest", ".", "y", "[", "0", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "nest", ".", "yyy", "[", "0", "]", " ", "+", " ", "nest", ".", "yyy", "[", "1", "]", " ", "<", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "J_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "J_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "95.", "0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "-_", "7.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "2_", "]_", ",_", "0.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "3_", "]_", ",_", "0.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "15.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "1_", "]_", ",_", "4.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "2_", "]_", ",_", "0.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "3_", "]_", ",_", "0.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "precondition", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "two", "\\u", "comp", "\\u", "bi", "fur", "cation", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "1", "'_", ",_", "Pre", "Comp_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "2", "'_", ",_", "Pre", "Comp_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "3", "'_", ",_", "Pre", "Comp_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "4", "'_", ",_", "Pre", "Comp_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "comp", "1", ".", "y1", "'_", ",_", "'", "comp", "2", ".", "x1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "comp", "1", ".", "y2", "'_", ",_", "'", "comp", "2", ".", "x2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "comp", "1", ".", "y1", "'_", ",_", "'", "comp", "3", ".", "x1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "comp", "1", ".", "y2", "'_", ",_", "'", "comp", "3", ".", "x2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "comp", "2", ".", "y1", " ", "+", " ", "comp", "3", ".", "y1", "'_", ",_", "'", "comp", "4", ".", "x1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "connect_", "(_", "'", "comp", "2", ".", "y2", " ", "-", " ", "comp", "3", ".", "y2", "'_", ",_", "'", "comp", "4", ".", "x2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Simple", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "1", "'_", ",_", "'", "comp", "2", "'_", ",_", "'", "comp", "3", "'_", ",_", "'", "comp", "4", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "comp", "1", ".", "x1", "'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "comp", "1", ".", "x2", "'_", ",_", "low_", "=_", "-_", "10_", ",_", "high_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "objective_", "(_", "'", "comp", "4", ".", "y1", " ", "+", " ", "comp", "2", ".", "y1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "comp", "4", ".", "y2", " ", "+", " ", "comp", "3", ".", "y2", " ", "<", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "J_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "475", ".0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "1_", "]_", ",_", "-_", "35.", "0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "245", "7.0_", ",_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "1_", "]_", ",_", "-_", "82.0_", ",_", "0.0001_", ")_", "\\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, 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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, 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 ]
Unused import
coddingtonbear/jirafs/tests/base.py
[ { "content": "import io\nimport json\nimport os\nfrom unittest import TestCase\n\nfrom mock import patch\n\nfrom jira.resources import Issue\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseTestCase(TestCase):\n\n\n", "metadata": "root.BaseTestCase", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def get_asset_path(self, filename):\n return os.path.join(\n os.path.dirname(__file__),\n 'assets',\n filename\n )", "metadata": "root.BaseTestCase.get_asset_path", "header": "['class', 'BaseTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": " def get_asset_contents(self, filename, mode='r'):\n path = self.get_asset_path(filename)\n\n with io.open(path, mode, encoding='utf-8') as r:\n return r.read()", "metadata": "root.BaseTestCase.get_asset_contents", "header": "['class', 'BaseTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 18 }, { "content": " def rehydrate_issue(self, filename):\n stored = json.loads(self.get_asset_contents(filename))\n return Issue(\n stored['options'],\n None,\n stored['raw'],\n )", "metadata": "root.BaseTestCase.rehydrate_issue", "header": "['class', 'BaseTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def get_empty_status(self):\n return {\n 'ready': {\n 'files': [],\n 'links': {},\n 'fields': {},\n 'new_comment': '',\n },\n 'uncommitted': {\n 'files': [],\n 'links': {},\n 'fields': {},\n 'new_comment': '',\n },\n 'local_uncommitted': {\n 'files': [],\n },\n 'up_to_date': True,\n }", "metadata": "root.BaseTestCase.get_empty_status", "header": "['class', 'BaseTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "from mock import patch", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mock_", "import_", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "jira", "_", "._", "resources_", "import_", "Issue_", "\\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_", "Base", "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_", "[SEP]_", "class_", "Base", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "asset", "\\u", "path_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "asset", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "asset", "\\u", "contents_", "(_", "self_", ",_", "filename_", ",_", "mode_", "=_", "'", "r", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "self_", "._", "get", "\\u", "asset", "\\u", "path_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "io_", "._", "open_", "(_", "path_", ",_", "mode_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "as_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "r_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Test", "Case_", "(_", "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_", "re", "hydra", "te", "\\u", "issue_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stored_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "get", "\\u", "asset", "\\u", "contents_", "(_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Issue_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stored_", "[_", "'", "options", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stored_", "[_", "'", "raw", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "empty", "\\u", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "read", "y", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "files", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "s", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", "\\u", "comment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uncomm", "itte", "d", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "files", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "s", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", "\\u", "comment", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "uncomm", "itte", "d", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "files", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "up", "\\u", "to", "\\u", "date", "'_", ":_", "True_", ",_", "\\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, 0, 1, 1, 1, 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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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 ]
Suspicious unused loop iteration variable
CGATOxford/cgat/obsolete/pipeline_vitaminD.py
[ { "content": " @files( [( [\"%s%s.bed\" % (x,y) for y in REPLICATES], \"%s.reproducibility\" % x, x) for x in TRACKS_EXPERIMENTS ] )\n def makeReproducibility( infile, outfile, track ):\n '''compute overlap between intervals.\n\n Note the exon percentages are approxmations assuming that there are\n not more than one intervals in one set overlapping one in the other set.\n '''\n\n dbhandle = sqlite3.connect( PARAMS[\"database\"] )\n\n data = []\n for replicate in REPLICATES:\n cc = dbhandle.cursor()\n statement = \"SELECT contig, start, end, peakval FROM %(track)s%(replicate)s_intervals\" % locals()\n cc.execute( statement )\n data.append( cc.fetchall() )\n\n ma = int(max( [ x[3] for x in itertools.chain( *data ) ] ) + 1)\n\n nexons1, nexons2, nexons_overlapping = [0] * ma, [0] * ma, [0] * ma\n nbases1, nbases2, nbases_overlapping = [0] * ma, [0] * ma, [0] * ma\n\n idx = IndexedGenome.IndexedGenome()\n for contig, start, end, peakval in data[0]:\n peakval = int(peakval)\n for x in range( 0, peakval):\n nexons1[x] += 1\n nbases1[x] += end - start\n idx.add( contig, start, end, peakval )\n\n for contig, start, end, peakval in data[1]:\n peakval = int(peakval)\n for x in range( 0, peakval):\n nexons2[x] += 1\n nbases2[x] += end - start\n\n try:\n intervals = list(idx.get( contig, start, end ))\n except KeyError:\n continue\n\n if len(intervals) == 0: continue\n\n for other_start,other_end,other_peakval in intervals:\n ovl = min(end, other_end ) - max(start, other_start )\n for x in range( 0, min( other_peakval, peakval) ):\n nexons_overlapping[x] += 1\n nbases_overlapping[x] += ovl\n\n outs = open( outfile, \"w\" )\n outs.write(\"peakval\\tnexons1\\tnexons2\\tnexons_union\\tnexons_ovl\\tpexons_ovl\\tpexons_union\\tnbases1\\tnbases2\\tnbases_union\\tnbases_ovl\\tpbases_ovl\\tpbases_union\\n\" )\n total_bases = nbases1[0] + nbases2[0] - nbases_overlapping[0]\n for x in range(0, ma):\n bases_union = nbases1[x] + nbases2[x] - nbases_overlapping[x]\n exons_union = nexons1[x] + nexons2[x] - nexons_overlapping[x]\n outs.write( \"\\t\".join( (str(x),\n str(nexons1[x]),\n str(nexons2[x]),\n str(exons_union),\n str(nexons_overlapping[x]),\n IOTools.prettyPercent( nbases_overlapping[x], bases_union),\n IOTools.prettyPercent( bases_union, total_bases),\n str(nbases1[x]),\n str(nbases2[x]),\n str(bases_union),\n str(nbases_overlapping[x]),\n IOTools.prettyPercent( nbases_overlapping[x], bases_union),\n IOTools.prettyPercent( bases_union, total_bases),\n )) + \"\\n\" )\n\n outs.close()", "metadata": "root.makeReproducibility", "header": "['module', '___EOS___']", "index": 3067 }, { "content": "@follows( buildGeneRegions )\n@files( [ (\"%s.bed\" % x, \"%s.readcounts\" % x ) for x in TRACKS_NOT_UNSTIM ] )\ndef buildIntervalCounts( infile, outfile ):\n '''count read density in bed files.\n '''\n track = outfile[:-len(\".readcounts\")]\n\n cellline, condition, replicate = splitTrack( track )\n\n samfiles_fg, samfiles_bg = [], []\n\n # save original, because condition is later assigned to\n one = cellline and condition\n two = condition\n\n if REPLICATES:\n if one:\n for replicate in REPLICATES:\n samfiles_fg.append( FILEPATTERN % locals() + BAM_SUFFIX )\n condition = \"Unstim\"\n for replicate in REPLICATES:\n samfiles_bg.append( FILEPATTERN % locals() + BAM_SUFFIX )\n elif two:\n for cellline in CELLLINES:\n for replicate in REPLICATES:\n samfiles_fg.append( FILEPATTERN % locals() + BAM_SUFFIX )\n condition = \"Unstim\"\n for cellline in CELLLINES:\n for replicate in REPLICATES:\n samfiles_bg.append( FILEPATTERN % locals() + BAM_SUFFIX )\n\n else:\n samfiles_fg.append( FILEPATTERN % locals() + BAM_SUFFIX )\n condition = \"Unstim\"\n if os.path.exists(FILEPATTERN % locals() + BAM_SUFFIX ):\n samfiles_bg.append( FILEPATTERN % locals() + BAM_SUFFIX )\n else:\n samfiles_bg = samfiles_fg\n \n samfiles_fg = \",\".join(samfiles_fg)\n samfiles_bg = \",\".join(samfiles_bg)\n\n tmpfile1 = P.getTempFilename( os.getcwd() ) + \".fg\"\n tmpfile2 = P.getTempFilename( os.getcwd() ) + \".bg\"\n\n to_cluster = True\n\n statement = \"\"\"\n cat < %(infile)s |\\\n python %(scriptsdir)s/bed2gff.py --as-gtf |\\\n\tpython %(scriptsdir)s/gtf2table.py \\\n\t\t--counter=read-coverage \\\n\t\t--log=%(outfile)s.log \\\n\t\t--bam-file=%(samfiles_fg)s \\\n\t> %(tmpfile1)s\"\"\"\n\n P.run( **dict( locals().items() + PARAMS.items() ) )\n\n statement = \"\"\"\n cat < %(infile)s |\\\n python %(scriptsdir)s/bed2gff.py --as-gtf |\\\n\tpython %(scriptsdir)s/gtf2table.py \\\n\t\t--counter=read-coverage \\\n\t\t--log=%(outfile)s.log \\\n\t\t--bam-file=%(samfiles_bg)s \\\n\t> %(tmpfile2)s\"\"\"\n\n P.run( **dict( locals().items() + PARAMS.items() ) )\n\n statement = '''\n python %(toolsdir)s/combine_tables.py \\\n --add-file-prefix \\\n --regex-filename=\"[.](\\S+)$\" \\\n %(tmpfile1)s %(tmpfile2)s > %(outfile)s\n '''\n\n P.run( **dict( locals().items() + PARAMS.items() ) )\n os.unlink( tmpfile1 )\n os.unlink( tmpfile2 )", "metadata": "root.buildIntervalCounts", "header": "['module', '___EOS___']", "index": 4629 } ]
[ { "span": "for replicate in REPLICATES:", "start_line": 3078, "start_column": 8, "end_line": 3078, "end_column": 36 }, { "span": "for replicate in REPLICATES:", "start_line": 4646, "start_column": 12, "end_line": 4646, "end_column": 40 }, { "span": "for replicate in REPLICATES:", "start_line": 4649, "start_column": 12, "end_line": 4649, "end_column": 40 }, { "span": "for cellline in CELLLINES:", "start_line": 4652, "start_column": 12, "end_line": 4652, "end_column": 38 }, { "span": "for replicate in REPLICATES:", "start_line": 4653, "start_column": 16, "end_line": 4653, "end_column": 44 }, { "span": "for cellline in CELLLINES:", "start_line": 4656, "start_column": 12, "end_line": 4656, "end_column": 38 }, { "span": "for replicate in REPLICATES:", "start_line": 4657, "start_column": 16, "end_line": 4657, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "files_", "(_", "[_", "(_", "[_", "\"%", "s", "%", "s", ".", "bed", "\"_", "%_", "(_", "x_", ",_", "y_", ")_", "for_", "y_", "in_", "REPLICA", "TES", "_", "]_", ",_", "\"%", "s", ".", "repro", "duci", "bilit", "y", "\"_", "%_", "x_", ",_", "x_", ")_", "for_", "x_", "in_", "TRACK", "S", "\\u", "EXPERIMENT", "S_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "make", "Repr", "od", "uci", "bility_", "(_", "infile_", ",_", "outfile_", ",_", "track_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "compute", " ", "overl", "ap", " ", "bet", "ween", " ", "interval", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "the", " ", "exon", " ", "percentage", "s", " ", "are", " ", "approx", "mati", "ons", " ", "ass", "umi", "ng", " ", "tha", "t", " ", "there", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "more", " ", "than", " ", "one", " ", "interval", "s", " ", "in", " ", "one", " ", "set", " ", "overlapping", " ", "one", " ", "in", " ", "the", " ", "other", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "andle", "_", "=_", "sqlite3_", "._", "connect_", "(_", "PARAMS_", "[_", "\"", "databa", "se", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "replicate", "_", "in_", "REPLICA", "TES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cc_", "=_", "dbh", "andle", "_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "\"", "SELECT", " ", "conti", "g", ",", " ", "start", ",", " ", "end", ",", " ", "peak", "val", " ", "FROM", " ", "%", "(", "track", ")", "s", "%", "(", "replicate", ")", "s", "\\u", "interval", "s", "\"_", "%_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc_", "._", "execute_", "(_", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "append_", "(_", "cc_", "._", "fetchall_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ma_", "=_", "int_", "(_", "max_", "(_", "[_", "x_", "[_", "3_", "]_", "for_", "x_", "in_", "itertools_", "._", "chain_", "(_", "*_", "data_", ")_", "]_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nex", "ons", "1_", ",_", "nex", "ons", "2_", ",_", "nex", "ons", "\\u", "overlapping", "_", "=_", "[_", "0_", "]_", "*_", "ma_", ",_", "[_", "0_", "]_", "*_", "ma_", ",_", "[_", "0_", "]_", "*_", "ma_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nba", "ses", "1_", ",_", "nba", "ses", "2_", ",_", "nba", "ses", "\\u", "overlapping", "_", "=_", "[_", "0_", "]_", "*_", "ma_", ",_", "[_", "0_", "]_", "*_", "ma_", ",_", "[_", "0_", "]_", "*_", "ma_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "idx_", "=_", "Indexe", "d", "Genome", "_", "._", "Indexe", "d", "Genome", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "contig_", ",_", "start_", ",_", "end_", ",_", "peak", "val_", "in_", "data_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peak", "val_", "=_", "int_", "(_", "peak", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "peak", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nex", "ons", "1_", "[_", "x_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nba", "ses", "1_", "[_", "x_", "]_", "+=_", "end_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "idx_", "._", "add_", "(_", "contig_", ",_", "start_", ",_", "end_", ",_", "peak", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "contig_", ",_", "start_", ",_", "end_", ",_", "peak", "val_", "in_", "data_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peak", "val_", "=_", "int_", "(_", "peak", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "peak", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nex", "ons", "2_", "[_", "x_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nba", "ses", "2_", "[_", "x_", "]_", "+=_", "end_", "-_", "start_", "\\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 ", " _", "intervals_", "=_", "list_", "(_", "idx_", "._", "get_", "(_", "contig_", ",_", "start_", ",_", "end_", ")_", ")_", "\\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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "intervals_", ")_", "==_", "0_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "other", "\\u", "start_", ",_", "other", "\\u", "end_", ",_", "other", "\\u", "peak", "val_", "in_", "intervals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ov", "l_", "=_", "min_", "(_", "end_", ",_", "other", "\\u", "end_", ")_", "-_", "max_", "(_", "start_", ",_", "other", "\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "min_", "(_", "other", "\\u", "peak", "val_", ",_", "peak", "val_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "nex", "ons", "\\u", "overlapping", "_", "[_", "x_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nba", "ses", "\\u", "overlapping", "_", "[_", "x_", "]_", "+=_", "ov", "l_", "\\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_", "outs_", "=_", "open_", "(_", "outfile_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "._", "write_", "(_", "\"", "peak", "val", "\\\\", "tne", "xon", "s1", "\\\\", "tne", "xon", "s2", "\\\\", "tne", "xon", "s", "\\u", "uni", "on", "\\\\", "tne", "xon", "s", "\\u", "ov", "l", "\\\\", "tp", "exon", "s", "\\u", "ov", "l", "\\\\", "tp", "exon", "s", "\\u", "uni", "on", "\\\\", "tn", "base", "s1", "\\\\", "tn", "base", "s2", "\\\\", "tn", "bases\\u", "uni", "on", "\\\\", "tn", "bases\\u", "ov", "l", "\\\\", "tp", "bases\\u", "ov", "l", "\\\\", "tp", "bases\\u", "uni", "on", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "bases_", "=_", "nba", "ses", "1_", "[_", "0_", "]_", "+_", "nba", "ses", "2_", "[_", "0_", "]_", "-_", "nba", "ses", "\\u", "overlapping", "_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "ma_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bases\\u", "union_", "=_", "nba", "ses", "1_", "[_", "x_", "]_", "+_", "nba", "ses", "2_", "[_", "x_", "]_", "-_", "nba", "ses", "\\u", "overlapping", "_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "s", "\\u", "union_", "=_", "nex", "ons", "1_", "[_", "x_", "]_", "+_", "nex", "ons", "2_", "[_", "x_", "]_", "-_", "nex", "ons", "\\u", "overlapping", "_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outs_", "._", "write_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "(_", "str_", "(_", "x_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "nex", "ons", "1_", "[_", "x_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "nex", "ons", "2_", "[_", "x_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "exon", "s", "\\u", "union_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "nex", "ons", "\\u", "overlapping", "_", "[_", "x_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IO", "Tools_", "._", "pretty", "Percent_", "(_", "nba", "ses", "\\u", "overlapping", "_", "[_", "x_", "]_", ",_", "bases\\u", "union_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IO", "Tools_", "._", "pretty", "Percent_", "(_", "bases\\u", "union_", ",_", "total", "\\u", "bases_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "nba", "ses", "1_", "[_", "x_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "nba", "ses", "2_", "[_", "x_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "bases\\u", "union_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "nba", "ses", "\\u", "overlapping", "_", "[_", "x_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IO", "Tools_", "._", "pretty", "Percent_", "(_", "nba", "ses", "\\u", "overlapping", "_", "[_", "x_", "]_", ",_", "bases\\u", "union_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "IO", "Tools_", "._", "pretty", "Percent_", "(_", "bases\\u", "union_", ",_", "total", "\\u", "bases_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outs_", "._", "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_", "@_", "follow", "s_", "(_", "build", "Gene", "Regions", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "files_", "(_", "[_", "(_", "\"%", "s", ".", "bed", "\"_", "%_", "x_", ",_", "\"%", "s", ".", "read", "count", "s", "\"_", "%_", "x_", ")_", "for_", "x_", "in_", "TRACK", "S", "\\u", "NOT", "\\u", "UNS", "TI", "M_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "build", "Interv", "al", "Counts_", "(_", "infile_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "count", " ", "read", " ", "densit", "y", " ", "in", " ", "bed", " ", "files", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track_", "=_", "outfile_", "[_", ":_", "-_", "len_", "(_", "\".", "read", "count", "s", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cell", "line_", ",_", "condition_", ",_", "replicate", "_", "=_", "split", "Track_", "(_", "track_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sam", "files", "\\u", "fg_", ",_", "sam", "files", "\\u", "bg_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "original", ",", " ", "bec", "aus", "e", " ", "condition", " ", "is", " ", "late", "r", " ", "assign", "ed", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "one_", "=_", "cell", "line_", "and_", "condition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "two_", "=_", "condition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "REPLICA", "TES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "one_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "replicate", "_", "in_", "REPLICA", "TES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sam", "files", "\\u", "fg_", "._", "append_", "(_", "FILE", "PATTERN_", "%_", "locals_", "(_", ")_", "+_", "BAM", "\\u", "SUFFIX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "condition_", "=_", "\"", "Uns", "tim", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "replicate", "_", "in_", "REPLICA", "TES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sam", "files", "\\u", "bg_", "._", "append_", "(_", "FILE", "PATTERN_", "%_", "locals_", "(_", ")_", "+_", "BAM", "\\u", "SUFFIX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "two_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cell", "line_", "in_", "CELL", "LINES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "replicate", "_", "in_", "REPLICA", "TES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sam", "files", "\\u", "fg_", "._", "append_", "(_", "FILE", "PATTERN_", "%_", "locals_", "(_", ")_", "+_", "BAM", "\\u", "SUFFIX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "condition_", "=_", "\"", "Uns", "tim", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cell", "line_", "in_", "CELL", "LINES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "replicate", "_", "in_", "REPLICA", "TES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sam", "files", "\\u", "bg_", "._", "append_", "(_", "FILE", "PATTERN_", "%_", "locals_", "(_", ")_", "+_", "BAM", "\\u", "SUFFIX_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sam", "files", "\\u", "fg_", "._", "append_", "(_", "FILE", "PATTERN_", "%_", "locals_", "(_", ")_", "+_", "BAM", "\\u", "SUFFIX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "condition_", "=_", "\"", "Uns", "tim", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "FILE", "PATTERN_", "%_", "locals_", "(_", ")_", "+_", "BAM", "\\u", "SUFFIX_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sam", "files", "\\u", "bg_", "._", "append_", "(_", "FILE", "PATTERN_", "%_", "locals_", "(_", ")_", "+_", "BAM", "\\u", "SUFFIX_", ")_", "\\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 ", " _", "sam", "files", "\\u", "bg_", "=_", "sam", "files", "\\u", "fg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sam", "files", "\\u", "fg_", "=_", "\",\"_", "._", "join_", "(_", "sam", "files", "\\u", "fg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sam", "files", "\\u", "bg_", "=_", "\",\"_", "._", "join_", "(_", "sam", "files", "\\u", "bg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile", "1_", "=_", "P_", "._", "get", "Temp", "Filename_", "(_", "os_", "._", "getcwd_", "(_", ")_", ")_", "+_", "\".", "fg", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile", "2_", "=_", "P_", "._", "get", "Temp", "Filename_", "(_", "os_", "._", "getcwd_", "(_", ")_", ")_", "+_", "\".", "bg", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "cluster_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bed", "2g", "ff", ".", "py", " ", "--", "as", "-", "gtf", " ", "|\\\\", "\\", "10", ";", "\t", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "gtf", "2t", "able", ".", "py", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "counter", "=", "read", "-", "covera", "ge", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "bam", "-", "file", "=", "%", "(", "sam", "files", "\\u", "fg", ")", "s", " ", "\\\\", "\\", "10", ";", "\t", ">", " ", "%", "(", "tmpfile", "1", ")", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", "**_", "dict_", "(_", "locals_", "(_", ")_", "._", "items_", "(_", ")_", "+_", "PARAMS_", "._", "items_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "cat", " ", "<", " ", "%", "(", "infile", ")", "s", " ", "|\\\\", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "bed", "2g", "ff", ".", "py", " ", "--", "as", "-", "gtf", " ", "|\\\\", "\\", "10", ";", "\t", "python", " ", "%", "(", "scripts", "dir", ")", "s", "/", "gtf", "2t", "able", ".", "py", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "counter", "=", "read", "-", "covera", "ge", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "log", "=", "%", "(", "outfile", ")", "s", ".", "log", " ", "\\\\", "\\", "10", ";", "\t", "\t", "--", "bam", "-", "file", "=", "%", "(", "sam", "files", "\\u", "bg", ")", "s", " ", "\\\\", "\\", "10", ";", "\t", ">", " ", "%", "(", "tmpfile", "2", ")", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", "**_", "dict_", "(_", "locals_", "(_", ")_", "._", "items_", "(_", ")_", "+_", "PARAMS_", "._", "items_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "%", "(", "tool", "sdir", ")", "s", "/", "combin", "e\\u", "tables", ".", "py", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "add", "-", "file", "-", "prefix", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "--", "regex", "-", "filename", "=\"", "[.", "](", "\\\\", "S", "+)", "$", "\"", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "tmpfile", "1", ")", "s", " ", "%", "(", "tmpfile", "2", ")", "s", " ", ">", " ", "%", "(", "outfile", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "._", "run_", "(_", "**_", "dict_", "(_", "locals_", "(_", ")_", "._", "items_", "(_", ")_", "+_", "PARAMS_", "._", "items_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpfile", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmpfile", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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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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 ]
Except block handles 'BaseException'
ardekantur/pyglet/pyglet/input/x11_xinput_tablet.py
[ { "content": "#!/usr/bin/env python\n\n'''\n'''\n\n__docformat__ = 'restructuredtext'\n__version__ = '$Id: $'\n\nimport pyglet\nfrom pyglet.input.base import \\\n Tablet, TabletCanvas, TabletCursor, DeviceOpenException\nfrom pyglet.input.x11_xinput import \\\n get_devices, XInputWindowEventDispatcher, DeviceResponder\n\ntry:\n from pyglet.libs.x11 import xinput as xi\n _have_xinput = True\nexcept:\n _have_xinput = False\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[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", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "docformat", "\\u\\u_", "=_", "'", "restructur", "edt", "ext", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'$", "Id", ":", " ", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyglet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "input_", "._", "base_", "import_", "Table", "t_", ",_", "Table", "t", "Canvas_", ",_", "Table", "t", "Cursor_", ",_", "Dev", "ice", "Open", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "input_", "._", "x1", "1", "\\u", "xin", "put_", "import_", "get", "\\u", "devices_", ",_", "XI", "nput", "Window", "Event", "Dispatcher_", ",_", "Dev", "ice", "Responde", "r_", "\\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_", "pyglet_", "._", "libs_", "._", "x1", "1_", "import_", "xin", "put_", "as_", "xi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "have", "\\u", "xin", "put_", "=_", "True_", "\\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", "have", "\\u", "xin", "put_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
saltstack/salt/salt/modules/jboss7_cli.py
[ { "content": "def __process_tokens_internal(tokens, start_at=0):\n if __is_dict_start(tokens[start_at]) and start_at == 0: # the top object\n return __process_tokens_internal(tokens, start_at=1)\n\n log.debug(\"__process_tokens, start_at=\"+str(start_at))\n token_no = start_at\n result = {}\n current_key = None\n while token_no < len(tokens):\n token = tokens[token_no]\n log.debug(\"PROCESSING TOKEN %d: %s\", token_no, token)\n if __is_quoted_string(token):\n log.debug(\" TYPE: QUOTED STRING \")\n if current_key is None:\n current_key = __get_quoted_string(token)\n log.debug(\" KEY: %s\", current_key)\n else:\n result[current_key] = __get_quoted_string(token)\n log.debug(\" %s -> %s\", current_key, result[current_key])\n current_key = None\n elif __is_datatype(token):\n log.debug(\" TYPE: DATATYPE: %s \", token)\n result[current_key] = __get_datatype(token)\n log.debug(\" %s -> %s\", current_key, str(result[current_key]))\n current_key = None\n elif __is_boolean(token):\n log.debug(\" TYPE: BOOLEAN \")\n result[current_key] = __get_boolean(token)\n log.debug(\" %s -> %s\", current_key, str(result[current_key]))\n current_key = None\n elif __is_int(token):\n log.debug(\" TYPE: INT \")\n result[current_key] = __get_int(token)\n log.debug(\" %s -> %s\", current_key, str(result[current_key]))\n current_key = None\n elif __is_long(token):\n log.debug(\" TYPE: LONG \")\n result[current_key] = __get_long(token)\n log.debug(\" %s -> %s\", current_key, str(result[current_key]))\n current_key = None\n elif __is_undefined(token):\n log.debug(\" TYPE: UNDEFINED \")\n log.debug(\" %s -> undefined (Adding as None to map)\", current_key)\n result[current_key] = None\n current_key = None\n elif __is_dict_start(token):\n log.debug(\" TYPE: DICT START\")\n dict_value, token_no = __process_tokens_internal(tokens, start_at=token_no+1)\n log.debug(\" DICT = %s \", dict_value)\n result[current_key] = dict_value\n log.debug(\" %s -> %s\", current_key, str(result[current_key]))\n current_key = None\n elif __is_dict_end(token):\n log.debug(\" TYPE: DICT END\")\n return result, token_no\n elif __is_assignment(token):\n log.debug(\" TYPE: ASSIGNMENT\")\n is_assignment = True\n else:\n raise CommandExecutionError('Unknown token! Token: {0}'.format(token))\n\n token_no = token_no + 1", "metadata": "root.__process_tokens_internal", "header": "['module', '___EOS___']", "index": 242 } ]
[ { "span": "is_assignment ", "start_line": 299, "start_column": 12, "end_line": 299, "end_column": 25 } ]
[]
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_", "\\u\\u", "process", "\\u", "token", "s", "\\u", "internal_", "(_", "tokens_", ",_", "start", "\\u", "at_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "is", "\\u", "dict", "\\u", "start_", "(_", "tokens_", "[_", "start", "\\u", "at_", "]_", ")_", "and_", "start", "\\u", "at_", "==_", "0_", ":_", "#", " ", "the", " ", "top", " ", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u", "process", "\\u", "token", "s", "\\u", "internal_", "(_", "tokens_", ",_", "start", "\\u", "at_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"\\u\\u", "process", "\\u", "token", "s", ",", " ", "start", "\\u", "at", "=\"_", "+_", "str_", "(_", "start", "\\u", "at_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token", "\\u", "no_", "=_", "start", "\\u", "at_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "token", "\\u", "no_", "<_", "len_", "(_", "tokens_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token_", "=_", "tokens_", "[_", "token", "\\u", "no_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "PROCESS", "ING", " ", "TOKEN", " ", "%", "d", ":", " ", "%", "s", "\"_", ",_", "token", "\\u", "no_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "is", "\\u", "quoted", "\\u", "string_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "TYPE", ":", " ", "QUOTE", "D", " ", "STRING", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "key_", "=_", "\\u\\u", "get", "\\u", "quoted", "\\u", "string_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "KEY", ":", " ", "%", "s", "\"_", ",_", "current", "\\u", "key_", ")_", "\\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 ", " _", "result_", "[_", "current", "\\u", "key_", "]_", "=_", "\\u\\u", "get", "\\u", "quoted", "\\u", "string_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "%", "s", " ", "->", " ", "%", "s", "\"_", ",_", "current", "\\u", "key_", ",_", "result_", "[_", "current", "\\u", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u\\u", "is", "\\u", "datatype_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "TYPE", ":", " ", "DATA", "TYPE", ":", " ", "%", "s", " ", "\"_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "current", "\\u", "key_", "]_", "=_", "\\u\\u", "get", "\\u", "datatype_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "%", "s", " ", "->", " ", "%", "s", "\"_", ",_", "current", "\\u", "key_", ",_", "str_", "(_", "result_", "[_", "current", "\\u", "key_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u\\u", "is", "\\u", "boolean_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "TYPE", ":", " ", "BOOLEAN", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "current", "\\u", "key_", "]_", "=_", "\\u\\u", "get", "\\u", "boolean_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "%", "s", " ", "->", " ", "%", "s", "\"_", ",_", "current", "\\u", "key_", ",_", "str_", "(_", "result_", "[_", "current", "\\u", "key_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u\\u", "is", "\\u", "int_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "TYPE", ":", " ", "INT", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "current", "\\u", "key_", "]_", "=_", "\\u\\u", "get", "\\u", "int_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "%", "s", " ", "->", " ", "%", "s", "\"_", ",_", "current", "\\u", "key_", ",_", "str_", "(_", "result_", "[_", "current", "\\u", "key_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u\\u", "is", "\\u", "long_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "TYPE", ":", " ", "LONG", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "current", "\\u", "key_", "]_", "=_", "\\u\\u", "get", "\\u", "long_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "%", "s", " ", "->", " ", "%", "s", "\"_", ",_", "current", "\\u", "key_", ",_", "str_", "(_", "result_", "[_", "current", "\\u", "key_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u\\u", "is", "\\u", "undefined", "_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "TYPE", ":", " ", "UNDEFINED", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "%", "s", " ", "->", " ", "undefined", " ", "(", "Add", "ing", " ", "as", " ", "Non", "e", " ", "to", " ", "map", ")\"_", ",_", "current", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "current", "\\u", "key_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u\\u", "is", "\\u", "dict", "\\u", "start_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "TYPE", ":", " ", "DICT", " ", "START", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dict", "\\u", "value_", ",_", "token", "\\u", "no_", "=_", "\\u\\u", "process", "\\u", "token", "s", "\\u", "internal_", "(_", "tokens_", ",_", "start", "\\u", "at_", "=_", "token", "\\u", "no_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "DICT", " ", "=", " ", "%", "s", " ", "\"_", ",_", "dict", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "current", "\\u", "key_", "]_", "=_", "dict", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "%", "s", " ", "->", " ", "%", "s", "\"_", ",_", "current", "\\u", "key_", ",_", "str_", "(_", "result_", "[_", "current", "\\u", "key_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u\\u", "is", "\\u", "dict", "\\u", "end_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "TYPE", ":", " ", "DICT", " ", "END", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", ",_", "token", "\\u", "no_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u\\u", "is", "\\u", "assignment_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "TYPE", ":", " ", "ASSIGN", "MENT", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "assignment_", "=_", "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 ", " _", "raise_", "Command", "Execut", "ion", "Error_", "(_", "'", "Un", "know", "n", " ", "token", "!", " ", "Token", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "token_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "token", "\\u", "no_", "=_", "token", "\\u", "no_", "+_", "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, 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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, 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 ]
Imprecise assert
mozilla/inventory/vendor-local/src/django-tastypie/tests/core/tests/resources.py
[ { "content": " def test_full_hydrate(self):\n basic = BasicResource()\n basic_bundle_1 = Bundle(data={\n 'name': 'Daniel',\n 'view_count': 6,\n 'date_joined': aware_datetime(2010, 2, 15, 12, 0, 0)\n })\n\n # Now load up the data.\n hydrated = basic.full_hydrate(basic_bundle_1)\n\n self.assertEqual(hydrated.data['name'], 'Daniel')\n self.assertEqual(hydrated.data['view_count'], 6)\n self.assertEqual(hydrated.data['date_joined'], aware_datetime(2010, 2, 15, 12, 0, 0))\n self.assertEqual(hydrated.obj.name, 'Daniel')\n self.assertEqual(hydrated.obj.view_count, 6)\n self.assertEqual(hydrated.obj.date_joined, aware_datetime(2010, 2, 15, 12, 0, 0))\n\n another = AnotherBasicResource()\n another_bundle_1 = Bundle(data={\n 'name': 'Daniel',\n 'view_count': 6,\n 'date_joined': aware_datetime(2010, 2, 15, 12, 0, 0),\n 'aliases': ['test', 'test1'],\n 'meta': {'foo': 'bar'},\n 'owed': '12.53',\n })\n\n # Now load up the data (without the ``bar`` key).\n hydrated = another.full_hydrate(another_bundle_1)\n\n self.assertEqual(hydrated.data['name'], 'Daniel')\n self.assertEqual(hydrated.data['view_count'], 6)\n self.assertEqual(hydrated.data['date_joined'], aware_datetime(2010, 2, 15, 12, 0, 0))\n self.assertEqual(hydrated.data['aliases'], ['test', 'test1'])\n self.assertEqual(hydrated.data['meta'], {'foo': 'bar'})\n self.assertEqual(hydrated.data['owed'], '12.53')\n self.assertEqual(hydrated.obj.name, 'Daniel')\n self.assertEqual(hydrated.obj.view_count, 6)\n self.assertEqual(hydrated.obj.date_joined, aware_datetime(2010, 2, 15, 12, 0, 0))\n self.assertEqual(hasattr(hydrated.obj, 'bar'), False)\n\n another_bundle_2 = Bundle(data={\n 'name': 'Daniel',\n 'view_count': 6,\n 'date_joined': aware_datetime(2010, 2, 15, 12, 0, 0),\n 'bar': True,\n })\n\n # Now load up the data (this time with the ``bar`` key).\n hydrated = another.full_hydrate(another_bundle_2)\n\n self.assertEqual(hydrated.data['name'], 'Daniel')\n self.assertEqual(hydrated.data['view_count'], 6)\n self.assertEqual(hydrated.data['date_joined'], aware_datetime(2010, 2, 15, 12, 0, 0))\n self.assertEqual(hydrated.obj.name, 'Daniel')\n self.assertEqual(hydrated.obj.view_count, 6)\n self.assertEqual(hydrated.obj.date_joined, aware_datetime(2010, 2, 15, 12, 0, 0))\n self.assertEqual(hydrated.obj.bar, 'O HAI BAR!')\n\n # Test that a nullable value with a previous non-null value\n # can be set to None.\n nullable = NullableNameResource()\n obj = nullable._meta.object_class()\n obj.name = \"Daniel\"\n null_bundle = Bundle(obj=obj, data={'name': None})\n hydrated = nullable.full_hydrate(null_bundle)\n\n self.assertTrue(hydrated.obj.name is None)\n\n # Test that a nullable value with a previous non-null value\n # is not overridden if no value was given\n obj = nullable._meta.object_class()\n obj.name = \"Daniel\"\n empty_null_bundle = Bundle(obj=obj, data={})\n hydrated = nullable.full_hydrate(empty_null_bundle)\n\n self.assertEquals(hydrated.obj.name, \"Daniel\")", "metadata": "root.ResourceTestCase.test_full_hydrate", "header": "['class', 'ResourceTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 333 }, { "content": " def test_fields(self):\n # Different from the ``ResourceTestCase.test_fields``, we're checking\n # some related bits here & self-referential bits later on.\n resource_1 = RelatedNoteResource()\n self.assertEqual(len(resource_1.fields), 8)\n self.assert_('author' in resource_1.fields)\n self.assertTrue(isinstance(resource_1.fields['author'], fields.ToOneField))\n self.assertEqual(resource_1.fields['author']._resource, resource_1.__class__)\n self.assertEqual(resource_1.fields['author'].instance_name, 'author')\n self.assertTrue('subjects' in resource_1.fields)\n self.assertTrue(isinstance(resource_1.fields['subjects'], fields.ToManyField))\n self.assertEqual(resource_1.fields['subjects']._resource, resource_1.__class__)\n self.assertEqual(resource_1.fields['subjects'].instance_name, 'subjects')\n\n # Sanity check the other introspected fields.\n annr = AutoNowNoteResource()\n self.assertEqual(len(annr.fields), 8)\n self.assertEqual(sorted(annr.fields.keys()), ['content', 'created', 'id', 'is_active', 'resource_uri', 'slug', 'title', 'updated'])\n\n self.assertTrue(isinstance(annr.fields['content'], fields.CharField))\n self.assertEqual(annr.fields['content'].attribute, 'content')\n self.assertEqual(annr.fields['content'].blank, True)\n self.assertEqual(annr.fields['content']._default, '')\n self.assertEqual(annr.fields['content'].instance_name, 'content')\n self.assertEqual(annr.fields['content'].null, False)\n self.assertEqual(annr.fields['content'].readonly, False)\n self.assertEqual(annr.fields['content'].unique, False)\n self.assertEqual(annr.fields['content'].value, None)\n\n self.assertTrue(isinstance(annr.fields['created'], fields.DateTimeField))\n self.assertEqual(annr.fields['created'].attribute, 'created')\n self.assertEqual(annr.fields['created'].blank, False)\n self.assertTrue(isinstance(annr.fields['created']._default(), datetime.datetime))\n self.assertEqual(annr.fields['created'].instance_name, 'created')\n self.assertEqual(annr.fields['created'].null, True)\n self.assertEqual(annr.fields['created'].readonly, False)\n self.assertEqual(annr.fields['created'].unique, False)\n self.assertEqual(annr.fields['created'].value, None)\n\n self.assertTrue(isinstance(annr.fields['id'], fields.IntegerField))\n self.assertEqual(annr.fields['id'].attribute, 'id')\n self.assertEqual(annr.fields['id'].blank, True)\n self.assertEqual(annr.fields['id']._default, '')\n self.assertEqual(annr.fields['id'].instance_name, 'id')\n self.assertEqual(annr.fields['id'].null, False)\n self.assertEqual(annr.fields['id'].readonly, False)\n self.assertEqual(annr.fields['id'].unique, True)\n self.assertEqual(annr.fields['id'].value, None)\n\n self.assertTrue(isinstance(annr.fields['is_active'], fields.BooleanField))\n self.assertEqual(annr.fields['is_active'].attribute, 'is_active')\n self.assertEqual(annr.fields['is_active'].blank, True)\n self.assertEqual(annr.fields['is_active']._default, True)\n self.assertEqual(annr.fields['is_active'].instance_name, 'is_active')\n self.assertEqual(annr.fields['is_active'].null, False)\n self.assertEqual(annr.fields['is_active'].readonly, False)\n self.assertEqual(annr.fields['is_active'].unique, False)\n self.assertEqual(annr.fields['is_active'].value, None)\n\n self.assertTrue(isinstance(annr.fields['resource_uri'], fields.CharField))\n self.assertEqual(annr.fields['resource_uri'].attribute, None)\n self.assertEqual(annr.fields['resource_uri'].blank, False)\n self.assertEqual(annr.fields['resource_uri']._default, fields.NOT_PROVIDED)\n self.assertEqual(annr.fields['resource_uri'].instance_name, 'resource_uri')\n self.assertEqual(annr.fields['resource_uri'].null, False)\n self.assertEqual(annr.fields['resource_uri'].readonly, True)\n self.assertEqual(annr.fields['resource_uri'].unique, False)\n self.assertEqual(annr.fields['resource_uri'].value, None)\n\n self.assertTrue(isinstance(annr.fields['slug'], fields.CharField))\n self.assertEqual(annr.fields['slug'].attribute, 'slug')\n self.assertEqual(annr.fields['slug'].blank, False)\n self.assertEqual(annr.fields['slug']._default, fields.NOT_PROVIDED)\n self.assertEqual(annr.fields['slug'].instance_name, 'slug')\n self.assertEqual(annr.fields['slug'].null, False)\n self.assertEqual(annr.fields['slug'].readonly, False)\n self.assertEqual(annr.fields['slug'].unique, True)\n self.assertEqual(annr.fields['slug'].value, None)\n\n self.assertTrue(isinstance(annr.fields['title'], fields.CharField))\n self.assertEqual(annr.fields['title'].attribute, 'title')\n self.assertEqual(annr.fields['title'].blank, False)\n self.assertEqual(annr.fields['title']._default, fields.NOT_PROVIDED)\n self.assertEqual(annr.fields['title'].instance_name, 'title')\n self.assertEqual(annr.fields['title'].null, False)\n self.assertEqual(annr.fields['title'].readonly, False)\n self.assertEqual(annr.fields['title'].unique, False)\n self.assertEqual(annr.fields['title'].value, None)\n\n self.assertTrue(isinstance(annr.fields['updated'], fields.DateTimeField))\n self.assertEqual(annr.fields['updated'].attribute, 'updated')\n self.assertEqual(annr.fields['updated'].blank, True)\n self.assertTrue(isinstance(annr.fields['updated']._default(), datetime.datetime))\n self.assertEqual(annr.fields['updated'].instance_name, 'updated')\n self.assertEqual(annr.fields['updated'].null, False)\n self.assertEqual(annr.fields['updated'].readonly, False)\n self.assertEqual(annr.fields['updated'].unique, False)\n self.assertEqual(annr.fields['updated'].value, None)", "metadata": "root.ModelResourceTestCase.test_fields", "header": "['class', 'ModelResourceTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 1114 }, { "content": " def test_put_detail(self):\n self.assertEqual(Note.objects.count(), 6)\n resource = NoteResource()\n request = MockRequest()\n request.GET = {'format': 'json'}\n request.method = 'PUT'\n request.raw_post_data = '{\"content\": \"The cat is back. The dog coughed him up out back.\", \"created\": \"2010-04-03 20:05:00\", \"is_active\": true, \"slug\": \"cat-is-back\", \"title\": \"The Cat Is Back\", \"updated\": \"2010-04-03 20:05:00\"}'\n\n resp = resource.put_detail(request, pk=10)\n self.assertEqual(resp.status_code, 201)\n self.assertEqual(Note.objects.count(), 7)\n new_note = Note.objects.get(slug='cat-is-back')\n self.assertEqual(new_note.content, \"The cat is back. The dog coughed him up out back.\")\n\n request.raw_post_data = '{\"content\": \"The cat is gone again. I think it was the rabbits that ate him this time.\", \"created\": \"2010-04-03 20:05:00\", \"is_active\": true, \"slug\": \"cat-is-back\", \"title\": \"The Cat Is Gone\", \"updated\": \"2010-04-03 20:05:00\"}'\n\n resp = resource.put_detail(request, pk=10)\n self.assertEqual(resp.status_code, 204)\n self.assertEqual(Note.objects.count(), 7)\n new_note = Note.objects.get(slug='cat-is-back')\n self.assertEqual(new_note.content, u'The cat is gone again. I think it was the rabbits that ate him this time.')\n\n always_resource = AlwaysDataNoteResource()\n resp = always_resource.put_detail(request, pk=10)\n self.assertEqual(resp.status_code, 202)\n data = json.loads(resp.content)\n self.assertTrue(\"id\" in data)\n self.assertEqual(data[\"id\"], 10)\n self.assertTrue(\"content\" in data)\n self.assertEqual(data[\"content\"], \"The cat is gone again. I think it was the rabbits that ate him this time.\")\n self.assertTrue(\"resource_uri\" in data)\n self.assertTrue(\"title\" in data)\n self.assertTrue(\"is_active\" in data)\n\n # Now make sure we can null-out a relation.\n # Associate some data first.\n new_note = Note.objects.get(slug='cat-is-back')\n new_note.author = User.objects.get(username='johndoe')\n new_note.save()\n nullable_resource = NullableRelatedNoteResource()\n request = MockRequest()\n request.GET = {'format': 'json'}\n request.method = 'PUT'\n request.raw_post_data = '{\"content\": \"The cat is back. The dog coughed him up out back.\", \"created\": \"2010-04-03 20:05:00\", \"is_active\": true, \"slug\": \"cat-is-back\", \"title\": \"The Cat Is Back\", \"updated\": \"2010-04-03 20:05:00\", \"author\": null}'\n\n resp = nullable_resource.put_detail(request, pk=10)\n self.assertEqual(resp.status_code, 204)\n self.assertEqual(Note.objects.count(), 7)\n new_note = Note.objects.get(slug='cat-is-back')\n self.assertEqual(new_note.author, None)", "metadata": "root.ModelResourceTestCase.test_put_detail", "header": "['class', 'ModelResourceTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 1720 }, { "content": " def test_post_list(self):\n self.assertEqual(Note.objects.count(), 6)\n resource = NoteResource()\n request = MockRequest()\n request.GET = {'format': 'json'}\n request.method = 'POST'\n request.raw_post_data = '{\"content\": \"The cat is back. The dog coughed him up out back.\", \"created\": \"2010-04-03 20:05:00\", \"is_active\": true, \"slug\": \"cat-is-back\", \"title\": \"The Cat Is Back\", \"updated\": \"2010-04-03 20:05:00\"}'\n\n resp = resource.post_list(request)\n self.assertEqual(resp.status_code, 201)\n self.assertEqual(Note.objects.count(), 7)\n new_note = Note.objects.get(slug='cat-is-back')\n self.assertEqual(new_note.content, \"The cat is back. The dog coughed him up out back.\")\n\n always_resource = AlwaysDataNoteResource()\n resp = always_resource.post_list(request)\n self.assertEqual(resp.status_code, 201)\n data = json.loads(resp.content)\n self.assertTrue(\"id\" in data)\n self.assertEqual(data[\"id\"], 8)\n self.assertTrue(\"content\" in data)\n self.assertEqual(data[\"content\"], \"The cat is back. The dog coughed him up out back.\")\n self.assertTrue(\"resource_uri\" in data)\n self.assertTrue(\"title\" in data)\n self.assertTrue(\"is_active\" in data)", "metadata": "root.ModelResourceTestCase.test_post_list", "header": "['class', 'ModelResourceTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 1771 }, { "content": " def test_patch_detail(self):\n self.assertEqual(Note.objects.count(), 6)\n resource = NoteResource()\n request = HttpRequest()\n request.GET = {'format': 'json'}\n request.method = 'PATCH'\n request._read_started = False\n request._raw_post_data = request._body = '{\"content\": \"The cat is back. The dog coughed him up out back.\", \"created\": \"2010-04-03 20:05:00\"}'\n\n resp = resource.patch_detail(request, pk=10)\n self.assertEqual(resp.status_code, 404)\n\n resp = resource.patch_detail(request, pk=1)\n self.assertEqual(resp.status_code, 202)\n self.assertEqual(Note.objects.count(), 6)\n note = Note.objects.get(pk=1)\n self.assertEqual(note.content, \"The cat is back. The dog coughed him up out back.\")\n self.assertEqual(note.created, aware_datetime(2010, 4, 3, 20, 5))\n\n request._raw_post_data = request._body = '{\"content\": \"The cat is gone again. I think it was the rabbits that ate him this time.\"}'\n\n resp = resource.patch_detail(request, pk=1)\n self.assertEqual(resp.status_code, 202)\n self.assertEqual(Note.objects.count(), 6)\n new_note = Note.objects.get(pk=1)\n self.assertEqual(new_note.content, u'The cat is gone again. I think it was the rabbits that ate him this time.')\n\n always_resource = AlwaysDataNoteResource()\n request._raw_post_data = request._body = '{\"content\": \"Wait, now the cat is back.\"}'\n resp = always_resource.patch_detail(request, pk=1)\n self.assertEqual(resp.status_code, 202)\n data = json.loads(resp.content)\n self.assertTrue(\"id\" in data)\n self.assertEqual(data[\"id\"], 1)\n self.assertTrue(\"content\" in data)\n self.assertEqual(data[\"content\"], u'Wait, now the cat is back.')\n self.assertTrue(\"resource_uri\" in data)\n self.assertTrue(\"title\" in data)\n self.assertTrue(\"is_active\" in data)", "metadata": "root.ModelResourceTestCase.test_patch_detail", "header": "['class', 'ModelResourceTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 1883 }, { "content": " def test_readonly_full_hydrate(self):\n rornr = ReadOnlyRelatedNoteResource()\n note = Note.objects.get(pk=1)\n dbundle = Bundle(obj=note)\n\n # Make sure the field is there on read.\n dehydrated = rornr.full_dehydrate(dbundle)\n self.assertTrue('author' in dehydrated.data)\n\n # Now check that it can be omitted in ``full_hydrate``\n hbundle = Bundle(obj=note, data={\n 'name': 'Daniel',\n 'view_count': 6,\n 'date_joined': aware_datetime(2010, 2, 15, 12, 0, 0),\n })\n hydrated = rornr.full_hydrate(hbundle)\n self.assertEqual(hydrated.obj.author.username, 'johndoe')\n\n # It also shouldn't accept a new value & should silently ignore it.\n hbundle_2 = Bundle(obj=note, data={\n 'name': 'Daniel',\n 'view_count': 6,\n 'date_joined': aware_datetime(2010, 2, 15, 12, 0, 0),\n 'author': '/api/v1/users/2/',\n })\n hydrated_2 = rornr.full_hydrate(hbundle_2)\n self.assertEqual(hydrated_2.obj.author.username, 'johndoe')", "metadata": "root.ModelResourceTestCase.test_readonly_full_hydrate", "header": "['class', 'ModelResourceTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 2923 }, { "content": " def test_debug_on_without_full(self):\n settings.DEBUG = True\n settings.TASTYPIE_FULL_DEBUG = False\n mail.outbox = []\n\n resp = self.resource.wrap_view('get_list')(self.request, pk=1)\n self.assertEqual(resp.status_code, 500)\n content = json.loads(resp.content)\n self.assertEqual(content['error_message'], 'Something blew up.')\n self.assertTrue(len(content['traceback']) > 0)\n self.assertEqual(len(mail.outbox), 0)", "metadata": "root.BustedResourceTestCase.test_debug_on_without_full", "header": "['class', 'BustedResourceTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 3051 } ]
[ { "span": "self.assertTrue(hydrated.obj.name is None)", "start_line": 401, "start_column": 8, "end_line": 401, "end_column": 50 }, { "span": "self.assertTrue('subjects' in resource_1.fields)", "start_line": 1123, "start_column": 8, "end_line": 1123, "end_column": 56 }, { "span": "self.assertTrue(\"id\" in data)", "start_line": 1746, "start_column": 8, "end_line": 1746, "end_column": 37 }, { "span": "self.assertTrue(\"content\" in data)", "start_line": 1748, "start_column": 8, "end_line": 1748, "end_column": 42 }, { "span": "self.assertTrue(\"resource_uri\" in data)", "start_line": 1750, "start_column": 8, "end_line": 1750, "end_column": 47 }, { "span": "self.assertTrue(\"title\" in data)", "start_line": 1751, "start_column": 8, "end_line": 1751, "end_column": 40 }, { "span": "self.assertTrue(\"is_active\" in data)", "start_line": 1752, "start_column": 8, "end_line": 1752, "end_column": 44 }, { "span": "self.assertTrue(\"id\" in data)", "start_line": 1789, "start_column": 8, "end_line": 1789, "end_column": 37 }, { "span": "self.assertTrue(\"content\" in data)", "start_line": 1791, "start_column": 8, "end_line": 1791, "end_column": 42 }, { "span": "self.assertTrue(\"resource_uri\" in data)", "start_line": 1793, "start_column": 8, "end_line": 1793, "end_column": 47 }, { "span": "self.assertTrue(\"title\" in data)", "start_line": 1794, "start_column": 8, "end_line": 1794, "end_column": 40 }, { "span": "self.assertTrue(\"is_active\" in data)", "start_line": 1795, "start_column": 8, "end_line": 1795, "end_column": 44 }, { "span": "self.assertTrue(\"id\" in data)", "start_line": 1915, "start_column": 8, "end_line": 1915, "end_column": 37 }, { "span": "self.assertTrue(\"content\" in data)", "start_line": 1917, "start_column": 8, "end_line": 1917, "end_column": 42 }, { "span": "self.assertTrue(\"resource_uri\" in data)", "start_line": 1919, "start_column": 8, "end_line": 1919, "end_column": 47 }, { "span": "self.assertTrue(\"title\" in data)", "start_line": 1920, "start_column": 8, "end_line": 1920, "end_column": 40 }, { "span": "self.assertTrue(\"is_active\" in data)", "start_line": 1921, "start_column": 8, "end_line": 1921, "end_column": 44 }, { "span": "self.assertTrue('author' in dehydrated.data)", "start_line": 2930, "start_column": 8, "end_line": 2930, "end_column": 52 }, { "span": "self.assertTrue(len(content['traceback']) > 0)", "start_line": 3060, "start_column": 8, "end_line": 3060, "end_column": 54 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Reso", "urc", "e", "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", "full", "\\u", "hydra", "te_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basic_", "=_", "Basic", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basic", "\\u", "bundle", "\\u", "1_", "=_", "Bundle_", "(_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Dan", "iel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "count", "'_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "load", " ", "up", " ", "the", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "hydra", "ted_", "=_", "basic_", "._", "full", "\\u", "hydra", "te_", "(_", "basic", "\\u", "bundle", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "name", "'_", "]_", ",_", "'", "Dan", "iel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "view", "\\u", "count", "'_", "]_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "date", "\\u", "joine", "d", "'_", "]_", ",_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "name_", ",_", "'", "Dan", "iel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "view", "\\u", "count_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "date", "\\u", "joined_", ",_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "anot", "her_", "=_", "Ano", "ther", "Basic", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anot", "her", "\\u", "bundle", "\\u", "1_", "=_", "Bundle_", "(_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Dan", "iel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "count", "'_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alias", "es", "'_", ":_", "[_", "'", "test", "'_", ",_", "'", "test", "1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "meta", "'_", ":_", "{_", "'", "foo", "'_", ":_", "'", "bar", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owe", "d", "'_", ":_", "'", "12.", "5", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "load", " ", "up", " ", "the", " ", "data", " ", "(", "with", "out", " ", "the", " ", "``", "bar", "``", " ", "key", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "hydra", "ted_", "=_", "anot", "her_", "._", "full", "\\u", "hydra", "te_", "(_", "anot", "her", "\\u", "bundle", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "name", "'_", "]_", ",_", "'", "Dan", "iel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "view", "\\u", "count", "'_", "]_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "date", "\\u", "joine", "d", "'_", "]_", ",_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "alias", "es", "'_", "]_", ",_", "[_", "'", "test", "'_", ",_", "'", "test", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "meta", "'_", "]_", ",_", "{_", "'", "foo", "'_", ":_", "'", "bar", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "owe", "d", "'_", "]_", ",_", "'", "12.", "5", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "name_", ",_", "'", "Dan", "iel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "view", "\\u", "count_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "date", "\\u", "joined_", ",_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hasattr_", "(_", "hydra", "ted_", "._", "obj_", ",_", "'", "bar", "'_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "anot", "her", "\\u", "bundle", "\\u", "2_", "=_", "Bundle_", "(_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Dan", "iel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "count", "'_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bar", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "load", " ", "up", " ", "the", " ", "data", " ", "(", "this", " ", "time", " ", "with", " ", "the", " ", "``", "bar", "``", " ", "key", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "hydra", "ted_", "=_", "anot", "her_", "._", "full", "\\u", "hydra", "te_", "(_", "anot", "her", "\\u", "bundle", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "name", "'_", "]_", ",_", "'", "Dan", "iel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "view", "\\u", "count", "'_", "]_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "data_", "[_", "'", "date", "\\u", "joine", "d", "'_", "]_", ",_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "name_", ",_", "'", "Dan", "iel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "view", "\\u", "count_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "date", "\\u", "joined_", ",_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "bar_", ",_", "'", "O", " ", "HA", "I", " ", "BAR", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "a", " ", "null", "able", " ", "value", " ", "with", " ", "a", " ", "previ", "ous", " ", "non", "-", "null", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "be", " ", "set", " ", "to", " ", "Non", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "nullable_", "=_", "Null", "able", "Name", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "nullable_", "._", "\\u", "meta_", "._", "object\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "name_", "=_", "\"", "Dan", "iel", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "null", "\\u", "bundle_", "=_", "Bundle_", "(_", "obj_", "=_", "obj_", ",_", "data_", "=_", "{_", "'", "name", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hydra", "ted_", "=_", "nullable_", "._", "full", "\\u", "hydra", "te_", "(_", "null", "\\u", "bundle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "hydra", "ted_", "._", "obj_", "._", "name_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "a", " ", "null", "able", " ", "value", " ", "with", " ", "a", " ", "previ", "ous", " ", "non", "-", "null", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "not", " ", "overrid", "den", " ", "if", " ", "no", " ", "value", " ", "was", " ", "given_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "nullable_", "._", "\\u", "meta_", "._", "object\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "name_", "=_", "\"", "Dan", "iel", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empty", "\\u", "null", "\\u", "bundle_", "=_", "Bundle_", "(_", "obj_", "=_", "obj_", ",_", "data_", "=_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hydra", "ted_", "=_", "nullable_", "._", "full", "\\u", "hydra", "te_", "(_", "empty", "\\u", "null", "\\u", "bundle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "hydra", "ted_", "._", "obj_", "._", "name_", ",_", "\"", "Dan", "iel", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Reso", "urc", "e", "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", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Different", " ", "from", " ", "the", " ", "``", "Reso", "urc", "e", "Test", "Case", ".", "test\\u", "fields", "``", ",", " ", "we", "'", "re", " ", "checking", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "relate", "d", " ", "bits", " ", "here", " ", "&", " ", "self", "-", "referen", "tial", " ", "bits", " ", "late", "r", " ", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "1_", "=_", "Rela", "ted", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "resource", "\\u", "1_", "._", "fields_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "'", "author", "'_", "in_", "resource", "\\u", "1_", "._", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "resource", "\\u", "1_", "._", "fields_", "[_", "'", "author", "'_", "]_", ",_", "fields_", "._", "To", "One", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resource", "\\u", "1_", "._", "fields_", "[_", "'", "author", "'_", "]_", "._", "\\u", "resource_", ",_", "resource", "\\u", "1_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resource", "\\u", "1_", "._", "fields_", "[_", "'", "author", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "author", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "subject", "s", "'_", "in_", "resource", "\\u", "1_", "._", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "resource", "\\u", "1_", "._", "fields_", "[_", "'", "subject", "s", "'_", "]_", ",_", "fields_", "._", "To", "Many", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resource", "\\u", "1_", "._", "fields_", "[_", "'", "subject", "s", "'_", "]_", "._", "\\u", "resource_", ",_", "resource", "\\u", "1_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resource", "\\u", "1_", "._", "fields_", "[_", "'", "subject", "s", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "subject", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "check", " ", "the", " ", "other", " ", "introspect", "ed", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "ann", "r_", "=_", "Auto", "No", "w", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ann", "r_", "._", "fields_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "ann", "r_", "._", "fields_", "._", "keys_", "(_", ")_", ")_", ",_", "[_", "'", "content", "'_", ",_", "'", "created", "'_", ",_", "'", "id", "'_", ",_", "'", "is", "\\u", "active", "'_", ",_", "'", "resource", "\\u", "uri", "'_", ",_", "'", "slug", "'_", ",_", "'", "title", "'_", ",_", "'", "update", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "content", "'_", "]_", ",_", "fields_", "._", "Char", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "attribute_", ",_", "'", "content", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "blank_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "\\u", "default_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "content", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "null_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "readonly_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "unique_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "content", "'_", "]_", "._", "value_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "created", "'_", "]_", ",_", "fields_", "._", "Date", "Time", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "created", "'_", "]_", "._", "attribute_", ",_", "'", "created", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "created", "'_", "]_", "._", "blank_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "created", "'_", "]_", "._", "\\u", "default_", "(_", ")_", ",_", "datetime_", "._", "datetime_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "created", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "created", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "created", "'_", "]_", "._", "null_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "created", "'_", "]_", "._", "readonly_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "created", "'_", "]_", "._", "unique_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "created", "'_", "]_", "._", "value_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "id", "'_", "]_", ",_", "fields_", "._", "Integer", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "id", "'_", "]_", "._", "attribute_", ",_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "id", "'_", "]_", "._", "blank_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "id", "'_", "]_", "._", "\\u", "default_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "id", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "id", "'_", "]_", "._", "null_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "id", "'_", "]_", "._", "readonly_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "id", "'_", "]_", "._", "unique_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "id", "'_", "]_", "._", "value_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "is", "\\u", "active", "'_", "]_", ",_", "fields_", "._", "Boo", "lean", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "is", "\\u", "active", "'_", "]_", "._", "attribute_", ",_", "'", "is", "\\u", "active", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "is", "\\u", "active", "'_", "]_", "._", "blank_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "is", "\\u", "active", "'_", "]_", "._", "\\u", "default_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "is", "\\u", "active", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "is", "\\u", "active", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "is", "\\u", "active", "'_", "]_", "._", "null_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "is", "\\u", "active", "'_", "]_", "._", "readonly_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "is", "\\u", "active", "'_", "]_", "._", "unique_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "is", "\\u", "active", "'_", "]_", "._", "value_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "resource", "\\u", "uri", "'_", "]_", ",_", "fields_", "._", "Char", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "resource", "\\u", "uri", "'_", "]_", "._", "attribute_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "resource", "\\u", "uri", "'_", "]_", "._", "blank_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "resource", "\\u", "uri", "'_", "]_", "._", "\\u", "default_", ",_", "fields_", "._", "NOT", "\\u", "PROVI", "DED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "resource", "\\u", "uri", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "resource", "\\u", "uri", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "resource", "\\u", "uri", "'_", "]_", "._", "null_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "resource", "\\u", "uri", "'_", "]_", "._", "readonly_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "resource", "\\u", "uri", "'_", "]_", "._", "unique_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "resource", "\\u", "uri", "'_", "]_", "._", "value_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "slug", "'_", "]_", ",_", "fields_", "._", "Char", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "slug", "'_", "]_", "._", "attribute_", ",_", "'", "slug", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "slug", "'_", "]_", "._", "blank_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "slug", "'_", "]_", "._", "\\u", "default_", ",_", "fields_", "._", "NOT", "\\u", "PROVI", "DED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "slug", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "slug", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "slug", "'_", "]_", "._", "null_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "slug", "'_", "]_", "._", "readonly_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "slug", "'_", "]_", "._", "unique_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "slug", "'_", "]_", "._", "value_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "title", "'_", "]_", ",_", "fields_", "._", "Char", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "title", "'_", "]_", "._", "attribute_", ",_", "'", "title", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "title", "'_", "]_", "._", "blank_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "title", "'_", "]_", "._", "\\u", "default_", ",_", "fields_", "._", "NOT", "\\u", "PROVI", "DED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "title", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "title", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "title", "'_", "]_", "._", "null_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "title", "'_", "]_", "._", "readonly_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "title", "'_", "]_", "._", "unique_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "title", "'_", "]_", "._", "value_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "update", "d", "'_", "]_", ",_", "fields_", "._", "Date", "Time", "Field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "update", "d", "'_", "]_", "._", "attribute_", ",_", "'", "update", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "update", "d", "'_", "]_", "._", "blank_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "update", "d", "'_", "]_", "._", "\\u", "default_", "(_", ")_", ",_", "datetime_", "._", "datetime_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "update", "d", "'_", "]_", "._", "instance", "\\u", "name_", ",_", "'", "update", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "update", "d", "'_", "]_", "._", "null_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "update", "d", "'_", "]_", "._", "readonly_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "update", "d", "'_", "]_", "._", "unique_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ann", "r_", "._", "fields_", "[_", "'", "update", "d", "'_", "]_", "._", "value_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Reso", "urc", "e", "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", "put", "\\u", "detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Note_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "=_", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Moc", "k", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "'", "format", "'_", ":_", "'", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "method_", "=_", "'", "PU", "T", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "raw", "\\u", "post", "\\u", "data_", "=_", "'{", "\"", "content", "\":", " ", "\"", "The", " ", "cat", " ", "is", " ", "back", ".", " ", "The", " ", "dog", " ", "cou", "ghe", "d", " ", "him", " ", "up", " ", "out", " ", "back", ".\",", " ", "\"", "created", "\":", " ", "\"", "2010", "-0", "4", "-0", "3", " ", "20", ":", "05", ":", "00", "\",", " ", "\"", "is", "\\u", "active", "\":", " ", "true", ",", " ", "\"", "slug", "\":", " ", "\"", "cat", "-", "is", "-", "back", "\",", " ", "\"", "title", "\":", " ", "\"", "The", " ", "Cat", " ", "Is", " ", "Back", "\",", " ", "\"", "update", "d", "\":", " ", "\"", "2010", "-0", "4", "-0", "3", " ", "20", ":", "05", ":", "00", "\"}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "resource_", "._", "put", "\\u", "detail_", "(_", "request_", ",_", "pk_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "201_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Note_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "note_", "=_", "Note_", "._", "objects_", "._", "get_", "(_", "slug_", "=_", "'", "cat", "-", "is", "-", "back", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "note_", "._", "content_", ",_", "\"", "The", " ", "cat", " ", "is", " ", "back", ".", " ", "The", " ", "dog", " ", "cou", "ghe", "d", " ", "him", " ", "up", " ", "out", " ", "back", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "raw", "\\u", "post", "\\u", "data_", "=_", "'{", "\"", "content", "\":", " ", "\"", "The", " ", "cat", " ", "is", " ", "gone", " ", "again", ".", " ", "I", " ", "think", " ", "it", " ", "was", " ", "the", " ", "rabbit", "s", " ", "tha", "t", " ", "ate", " ", "him", " ", "this", " ", "time", ".\",", " ", "\"", "created", "\":", " ", "\"", "2010", "-0", "4", "-0", "3", " ", "20", ":", "05", ":", "00", "\",", " ", "\"", "is", "\\u", "active", "\":", " ", "true", ",", " ", "\"", "slug", "\":", " ", "\"", "cat", "-", "is", "-", "back", "\",", " ", "\"", "title", "\":", " ", "\"", "The", " ", "Cat", " ", "Is", " ", "Gon", "e", "\",", " ", "\"", "update", "d", "\":", " ", "\"", "2010", "-0", "4", "-0", "3", " ", "20", ":", "05", ":", "00", "\"}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "resource_", "._", "put", "\\u", "detail_", "(_", "request_", ",_", "pk_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "204_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Note_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "note_", "=_", "Note_", "._", "objects_", "._", "get_", "(_", "slug_", "=_", "'", "cat", "-", "is", "-", "back", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "note_", "._", "content_", ",_", "u", "'", "The", " ", "cat", " ", "is", " ", "gone", " ", "again", ".", " ", "I", " ", "think", " ", "it", " ", "was", " ", "the", " ", "rabbit", "s", " ", "tha", "t", " ", "ate", " ", "him", " ", "this", " ", "time", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alw", "ay", "s", "\\u", "resource_", "=_", "Al", "way", "s", "Data", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "alw", "ay", "s", "\\u", "resource_", "._", "put", "\\u", "detail_", "(_", "request_", ",_", "pk_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "id", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "\"", "id", "\"_", "]_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "content", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "\"", "content", "\"_", "]_", ",_", "\"", "The", " ", "cat", " ", "is", " ", "gone", " ", "again", ".", " ", "I", " ", "think", " ", "it", " ", "was", " ", "the", " ", "rabbit", "s", " ", "tha", "t", " ", "ate", " ", "him", " ", "this", " ", "time", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "resource", "\\u", "uri", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "title", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "is", "\\u", "active", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "make", " ", "sure", " ", "we", " ", "can", " ", "null", "-", "out", " ", "a", " ", "relation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Associate", " ", "some", " ", "data", " ", "first", "._", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "note_", "=_", "Note_", "._", "objects_", "._", "get_", "(_", "slug_", "=_", "'", "cat", "-", "is", "-", "back", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "note_", "._", "author_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "username_", "=_", "'", "john", "doe", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "note_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "null", "able", "\\u", "resource_", "=_", "Null", "able", "Rela", "ted", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Moc", "k", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "'", "format", "'_", ":_", "'", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "method_", "=_", "'", "PU", "T", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "raw", "\\u", "post", "\\u", "data_", "=_", "'{", "\"", "content", "\":", " ", "\"", "The", " ", "cat", " ", "is", " ", "back", ".", " ", "The", " ", "dog", " ", "cou", "ghe", "d", " ", "him", " ", "up", " ", "out", " ", "back", ".\",", " ", "\"", "created", "\":", " ", "\"", "2010", "-0", "4", "-0", "3", " ", "20", ":", "05", ":", "00", "\",", " ", "\"", "is", "\\u", "active", "\":", " ", "true", ",", " ", "\"", "slug", "\":", " ", "\"", "cat", "-", "is", "-", "back", "\",", " ", "\"", "title", "\":", " ", "\"", "The", " ", "Cat", " ", "Is", " ", "Back", "\",", " ", "\"", "update", "d", "\":", " ", "\"", "2010", "-0", "4", "-0", "3", " ", "20", ":", "05", ":", "00", "\",", " ", "\"", "author", "\":", " ", "null", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "null", "able", "\\u", "resource_", "._", "put", "\\u", "detail_", "(_", "request_", ",_", "pk_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "204_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Note_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "note_", "=_", "Note_", "._", "objects_", "._", "get_", "(_", "slug_", "=_", "'", "cat", "-", "is", "-", "back", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "note_", "._", "author_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Reso", "urc", "e", "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", "post", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Note_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "=_", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Moc", "k", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "'", "format", "'_", ":_", "'", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "method_", "=_", "'", "POST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "raw", "\\u", "post", "\\u", "data_", "=_", "'{", "\"", "content", "\":", " ", "\"", "The", " ", "cat", " ", "is", " ", "back", ".", " ", "The", " ", "dog", " ", "cou", "ghe", "d", " ", "him", " ", "up", " ", "out", " ", "back", ".\",", " ", "\"", "created", "\":", " ", "\"", "2010", "-0", "4", "-0", "3", " ", "20", ":", "05", ":", "00", "\",", " ", "\"", "is", "\\u", "active", "\":", " ", "true", ",", " ", "\"", "slug", "\":", " ", "\"", "cat", "-", "is", "-", "back", "\",", " ", "\"", "title", "\":", " ", "\"", "The", " ", "Cat", " ", "Is", " ", "Back", "\",", " ", "\"", "update", "d", "\":", " ", "\"", "2010", "-0", "4", "-0", "3", " ", "20", ":", "05", ":", "00", "\"}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "resource_", "._", "post", "\\u", "list_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "201_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Note_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "note_", "=_", "Note_", "._", "objects_", "._", "get_", "(_", "slug_", "=_", "'", "cat", "-", "is", "-", "back", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "note_", "._", "content_", ",_", "\"", "The", " ", "cat", " ", "is", " ", "back", ".", " ", "The", " ", "dog", " ", "cou", "ghe", "d", " ", "him", " ", "up", " ", "out", " ", "back", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alw", "ay", "s", "\\u", "resource_", "=_", "Al", "way", "s", "Data", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "alw", "ay", "s", "\\u", "resource_", "._", "post", "\\u", "list_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "201_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "id", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "\"", "id", "\"_", "]_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "content", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "\"", "content", "\"_", "]_", ",_", "\"", "The", " ", "cat", " ", "is", " ", "back", ".", " ", "The", " ", "dog", " ", "cou", "ghe", "d", " ", "him", " ", "up", " ", "out", " ", "back", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "resource", "\\u", "uri", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "title", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "is", "\\u", "active", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Reso", "urc", "e", "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", "patch", "\\u", "detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Note_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource_", "=_", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Http", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "'", "format", "'_", ":_", "'", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "method_", "=_", "'", "PATCH", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "read", "\\u", "started_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "raw", "\\u", "post", "\\u", "data_", "=_", "request_", "._", "\\u", "body_", "=_", "'{", "\"", "content", "\":", " ", "\"", "The", " ", "cat", " ", "is", " ", "back", ".", " ", "The", " ", "dog", " ", "cou", "ghe", "d", " ", "him", " ", "up", " ", "out", " ", "back", ".\",", " ", "\"", "created", "\":", " ", "\"", "2010", "-0", "4", "-0", "3", " ", "20", ":", "05", ":", "00", "\"}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "resource_", "._", "patch", "\\u", "detail_", "(_", "request_", ",_", "pk_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "resource_", "._", "patch", "\\u", "detail_", "(_", "request_", ",_", "pk_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Note_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note_", "=_", "Note_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "note_", "._", "content_", ",_", "\"", "The", " ", "cat", " ", "is", " ", "back", ".", " ", "The", " ", "dog", " ", "cou", "ghe", "d", " ", "him", " ", "up", " ", "out", " ", "back", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "note_", "._", "created_", ",_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "4_", ",_", "3_", ",_", "20_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "\\u", "raw", "\\u", "post", "\\u", "data_", "=_", "request_", "._", "\\u", "body_", "=_", "'{", "\"", "content", "\":", " ", "\"", "The", " ", "cat", " ", "is", " ", "gone", " ", "again", ".", " ", "I", " ", "think", " ", "it", " ", "was", " ", "the", " ", "rabbit", "s", " ", "tha", "t", " ", "ate", " ", "him", " ", "this", " ", "time", ".\"", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "resource_", "._", "patch", "\\u", "detail_", "(_", "request_", ",_", "pk_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Note_", "._", "objects_", "._", "count_", "(_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "note_", "=_", "Note_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "note_", "._", "content_", ",_", "u", "'", "The", " ", "cat", " ", "is", " ", "gone", " ", "again", ".", " ", "I", " ", "think", " ", "it", " ", "was", " ", "the", " ", "rabbit", "s", " ", "tha", "t", " ", "ate", " ", "him", " ", "this", " ", "time", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alw", "ay", "s", "\\u", "resource_", "=_", "Al", "way", "s", "Data", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "raw", "\\u", "post", "\\u", "data_", "=_", "request_", "._", "\\u", "body_", "=_", "'{", "\"", "content", "\":", " ", "\"", "Wait", ",", " ", "now", " ", "the", " ", "cat", " ", "is", " ", "back", ".\"", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "alw", "ay", "s", "\\u", "resource_", "._", "patch", "\\u", "detail_", "(_", "request_", ",_", "pk_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "id", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "\"", "id", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "content", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "\"", "content", "\"_", "]_", ",_", "u", "'", "Wait", ",", " ", "now", " ", "the", " ", "cat", " ", "is", " ", "back", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "resource", "\\u", "uri", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "title", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "is", "\\u", "active", "\"_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Reso", "urc", "e", "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", "read", "only", "\\u", "full", "\\u", "hydra", "te_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ror", "nr_", "=_", "Read", "On", "ly", "Rela", "ted", "Not", "e", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "note_", "=_", "Note_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbu", "ndl", "e_", "=_", "Bundle_", "(_", "obj_", "=_", "note_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "field", " ", "is", " ", "there", " ", "on", " ", "read", "._", "\\u\\u\\uNL\\u\\u\\u_", "de", "hydra", "ted_", "=_", "ror", "nr_", "._", "full", "\\u", "de", "hydra", "te_", "(_", "dbu", "ndl", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "author", "'_", "in_", "de", "hydra", "ted_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "check", " ", "tha", "t", " ", "it", " ", "can", " ", "be", " ", "omit", "ted", " ", "in", " ", "``", "full", "\\u", "hydra", "te", "``", "_", "\\u\\u\\uNL\\u\\u\\u_", "hb", "und", "le_", "=_", "Bundle_", "(_", "obj_", "=_", "note_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Dan", "iel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "count", "'_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hydra", "ted_", "=_", "ror", "nr_", "._", "full", "\\u", "hydra", "te_", "(_", "hb", "und", "le_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted_", "._", "obj_", "._", "author_", "._", "username_", ",_", "'", "john", "doe", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "als", "o", " ", "shou", "ld", "n", "'", "t", " ", "accept", " ", "a", " ", "new", " ", "value", " ", "&", " ", "shou", "ld", " ", "silently", " ", "ignore", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "hb", "und", "le", "\\u", "2_", "=_", "Bundle_", "(_", "obj_", "=_", "note_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Dan", "iel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "count", "'_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "awa", "re", "\\u", "datetime_", "(_", "2010_", ",_", "2_", ",_", "15_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "'_", ":_", "'/", "api", "/", "v1", "/", "users", "/", "2", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hydra", "ted", "\\u", "2_", "=_", "ror", "nr_", "._", "full", "\\u", "hydra", "te_", "(_", "hb", "und", "le", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hydra", "ted", "\\u", "2_", "._", "obj_", "._", "author_", "._", "username_", ",_", "'", "john", "doe", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bus", "ted", "Reso", "urc", "e", "Test", "Case_", "(_", "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", "debug", "\\u", "on", "\\u", "with", "out", "\\u", "full_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "TA", "ST", "YP", "IE", "\\u", "FULL", "\\u", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail_", "._", "outbox_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "resource_", "._", "wrap", "\\u", "view_", "(_", "'", "get", "\\u", "list", "'_", ")_", "(_", "self_", "._", "request_", ",_", "pk_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "json_", "._", "loads_", "(_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "content_", "[_", "'", "error", "\\u", "message", "'_", "]_", ",_", "'", "Some", "thing", " ", "ble", "w", " ", "up", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "content_", "[_", "'", "traceback", "'_", "]_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "mail_", "._", "outbox_", ")_", ",_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 0, 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 ]
Except block handles 'BaseException'
mrknow/filmkodi/plugin.video.specto/resources/lib/resolvers/regex.py
[ { "content": "def resolve(url):\n try:\n data = str(url).replace('\\r','').replace('\\n','').replace('\\t','')\n doregex = re.compile('\\$doregex\\[(.+?)\\]').findall(data)\n\n for i in range(0, 5):\n for x in doregex:\n try:\n if not '$doregex[%s]' % x in data: raise Exception()\n\n regex = re.compile('<regex>(.+?)</regex>').findall(data)\n regex = [r for r in regex if '<name>%s</name>' % x in r][0]\n\n if '$doregex' in regex: raise Exception()\n\n expres = re.compile('<expres>(.+?)</expres>').findall(regex)[0]\n\n try: referer = re.compile('<referer>(.+?)</referer>').findall(regex)[0]\n except: referer = ''\n referer = urllib.unquote_plus(referer)\n referer = client.replaceHTMLCodes(referer)\n referer = referer.encode('utf-8')\n\n page = re.compile('<page>(.+?)</page>').findall(regex)[0]\n page = urllib.unquote_plus(page)\n page = client.replaceHTMLCodes(page)\n page = page.encode('utf-8')\n\n result = client.request(page, referer=referer)\n result = str(result).replace('\\r','').replace('\\n','').replace('\\t','')\n result = str(result).replace('\\/','/')\n\n r = re.compile(expres).findall(result)[0]\n data = data.replace('$doregex[%s]' % x, r)\n except:\n pass\n\n url = re.compile('(.+?)<regex>').findall(data)[0]\n url = client.replaceHTMLCodes(url)\n url = url.encode('utf-8')\n\n if not '$doregex' in url: return url\n except:\n return", "metadata": "root.resolve", "header": "['module', '___EOS___']", "index": 25 } ]
[ { "span": "except: ", "start_line": 43, "start_column": 20, "end_line": 43, "end_column": 27 }, { "span": "except:", "start_line": 59, "start_column": 16, "end_line": 59, "end_column": 23 }, { "span": "except:", "start_line": 67, "start_column": 4, "end_line": 67, "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_", "resolve_", "(_", "url_", ")_", ":_", "\\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 ", " _", "data_", "=_", "str_", "(_", "url_", ")_", "._", "replace_", "(_", "'\\\\", "r", "'_", ",_", "''_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "._", "replace_", "(_", "'\\\\", "t", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dor", "ege", "x_", "=_", "re_", "._", "compile_", "(_", "'\\\\", "$", "dor", "ege", "x", "\\\\[", "(.+?)", "\\\\]", "'_", ")_", "._", "findall_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "dor", "ege", "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 ", " ", "_", "if_", "not_", "'$", "dor", "ege", "x", "[", "%", "s", "]'_", "%_", "x_", "in_", "data_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "regex_", "=_", "re_", "._", "compile_", "(_", "'<", "regex", ">(.", "+?)", "</", "regex", ">'_", ")_", "._", "findall_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regex_", "=_", "[_", "r_", "for_", "r_", "in_", "regex_", "if_", "'<", "name", ">", "%", "s", "</", "name", ">'_", "%_", "x_", "in_", "r_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'$", "dor", "ege", "x", "'_", "in_", "regex_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expr", "es_", "=_", "re_", "._", "compile_", "(_", "'<", "expr", "es", ">(.", "+?)", "</", "expr", "es", ">'_", ")_", "._", "findall_", "(_", "regex_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "referer_", "=_", "re_", "._", "compile_", "(_", "'<", "refere", "r", ">(.", "+?)", "</", "refere", "r", ">'_", ")_", "._", "findall_", "(_", "regex_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "referer_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "referer_", "=_", "urllib_", "._", "unqu", "ote", "\\u", "plus_", "(_", "referer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "referer_", "=_", "client_", "._", "replace", "HTM", "LC", "odes_", "(_", "referer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "referer_", "=_", "referer_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "page_", "=_", "re_", "._", "compile_", "(_", "'<", "page", ">(.", "+?)", "</", "page", ">'_", ")_", "._", "findall_", "(_", "regex_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "urllib_", "._", "unqu", "ote", "\\u", "plus_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "client_", "._", "replace", "HTM", "LC", "odes_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "page_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "client_", "._", "request_", "(_", "page_", ",_", "referer_", "=_", "referer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "str_", "(_", "result_", ")_", "._", "replace_", "(_", "'\\\\", "r", "'_", ",_", "''_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "._", "replace_", "(_", "'\\\\", "t", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "str_", "(_", "result_", ")_", "._", "replace_", "(_", "'\\\\", "/'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "re_", "._", "compile_", "(_", "expr", "es_", ")_", "._", "findall_", "(_", "result_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "._", "replace_", "(_", "'$", "dor", "ege", "x", "[", "%", "s", "]'_", "%_", "x_", ",_", "r_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "re_", "._", "compile_", "(_", "'(", ".+?)", "<", "regex", ">'_", ")_", "._", "findall_", "(_", "data_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "client_", "._", "replace", "HTM", "LC", "odes_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "url_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "'$", "dor", "ege", "x", "'_", "in_", "url_", ":_", "return_", "url_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
jazdev/genreXpose/genreXpose/classifier.py
[ { "content": "import os\nimport timeit\nimport numpy as np\nfrom collections import defaultdict\nfrom sklearn.metrics import roc_curve\nfrom sklearn.metrics import auc\nfrom sklearn.cross_validation import ShuffleSplit\nfrom sklearn.linear_model.logistic import LogisticRegression\nfrom sklearn.metrics import confusion_matrix\nfrom sklearn.externals import joblib\nfrom utils import GENRE_LIST, GENRE_DIR, TEST_DIR\nfrom utils import plot_confusion_matrix, plot_roc_curves\nfrom ceps import read_ceps, read_ceps_test\n\ngenre_list = GENRE_LIST\n\n\n\nif __name__ == \"__main__\":\n start = timeit.default_timer()\n print\n print \" Starting classification \\n\"\n print \" Classification running ... \\n\" \n X, y = read_ceps(genre_list)\n train_avg, test_avg, cms = train_model(X, y, \"ceps\", plot=True)\n cm_avg = np.mean(cms, axis=0)\n cm_norm = cm_avg / np.sum(cm_avg, axis=0)\n print \" Classification finished \\n\"\n stop = timeit.default_timer()\n print \" Total time taken (s) = \", (stop - start)\n print \"\\n Plotting confusion matrix ... \\n\"\n plot_confusion_matrix(cm_norm, genre_list, \"ceps\",\"CEPS classifier - Confusion matrix\")\n print \" All Done\\n\"\n print \" See plots in 'graphs' directory \\n\"\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def train_model(X, Y, name, plot=False):\n \"\"\"\n train_model(vector, vector, name[, plot=False])\n \n Trains and saves model to disk.\n \"\"\"\n labels = np.unique(Y)\n\n cv = ShuffleSplit(n=len(X), n_iterations=1, test_fraction=0.3, indices=True, random_state=0)\n\n train_errors = []\n test_errors = []\n\n scores = []\n pr_scores = defaultdict(list)\n precisions, recalls, thresholds = defaultdict(list), defaultdict(list), defaultdict(list)\n\n roc_scores = defaultdict(list)\n tprs = defaultdict(list)\n fprs = defaultdict(list)\n\n clfs = [] # for the median\n\n cms = []\n\n for train, test in cv:\n X_train, y_train = X[train], Y[train]\n X_test, y_test = X[test], Y[test]\n\n clf = LogisticRegression()\n clf.fit(X_train, y_train)\n clfs.append(clf)\n\n train_score = clf.score(X_train, y_train)\n test_score = clf.score(X_test, y_test)\n scores.append(test_score)\n\n train_errors.append(1 - train_score)\n test_errors.append(1 - test_score)\n\n y_pred = clf.predict(X_test)\n cm = confusion_matrix(y_test, y_pred)\n cms.append(cm)\n\n for label in labels:\n y_label_test = np.asarray(y_test == label, dtype=int)\n proba = clf.predict_proba(X_test)\n proba_label = proba[:, label]\n\n fpr, tpr, roc_thresholds = roc_curve(y_label_test, proba_label)\n roc_scores[label].append(auc(fpr, tpr))\n tprs[label].append(tpr)\n fprs[label].append(fpr)\n\n if plot:\n for label in labels:\n scores_to_sort = roc_scores[label]\n median = np.argsort(scores_to_sort)[len(scores_to_sort) / 2]\n desc = \"%s %s\" % (name, genre_list[label])\n plot_roc_curves(roc_scores[label][median], desc, tprs[label][median],fprs[label][median], label='%s vs rest' % genre_list[label])\n\n all_pr_scores = np.asarray(pr_scores.values()).flatten()\n summary = (np.mean(scores), np.std(scores), np.mean(all_pr_scores), np.std(all_pr_scores))\n #print(\"%.3f\\t%.3f\\t%.3f\\t%.3f\\t\" % summary)\n\n #save the trained model to disk\n joblib.dump(clf, 'saved_model/model_ceps.pkl')\n \n return np.mean(train_errors), np.mean(test_errors), np.asarray(cms)", "metadata": "root.train_model", "header": "['module', '___EOS___']", "index": 16 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 }, { "span": "from utils import GENRE_LIST, GENRE_DIR, TEST_DIR", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 49 }, { "span": "from ceps import read_ceps, read_ceps_test", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 42 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "timeit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "metrics_", "import_", "roc", "\\u", "curve_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "metrics_", "import_", "auc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "cross", "\\u", "validation_", "import_", "Shuffle", "Split_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "linear", "\\u", "model_", "._", "logistic", "_", "import_", "Logi", "stic", "Regression_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "metrics_", "import_", "confusion", "\\u", "matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "externals", "_", "import_", "joblib", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "GEN", "RE", "\\u", "LIST_", ",_", "GEN", "RE", "\\u", "DIR_", ",_", "TEST", "\\u", "DIR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "plot", "\\u", "confusion", "\\u", "matrix_", ",_", "plot", "\\u", "roc", "\\u", "curves_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ce", "ps_", "import_", "read", "\\u", "ce", "ps_", ",_", "read", "\\u", "ce", "ps", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "genre\\u", "list_", "=_", "GEN", "RE", "\\u", "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\\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 ", " _", "start_", "=_", "timeit_", "._", "default", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "Start", "ing", " ", "classificati", "on", " ", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "Classificat", "ion", " ", "runn", "ing", " ", "...", " ", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", ",_", "y_", "=_", "read", "\\u", "ce", "ps_", "(_", "genre\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "avg_", ",_", "test\\u", "avg_", ",_", "cms_", "=_", "train", "\\u", "model_", "(_", "X_", ",_", "y_", ",_", "\"", "ce", "ps", "\"_", ",_", "plot_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm", "\\u", "avg_", "=_", "np_", "._", "mean_", "(_", "cms_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm", "\\u", "norm_", "=_", "cm", "\\u", "avg_", "/_", "np_", "._", "sum_", "(_", "cm", "\\u", "avg_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "Classificat", "ion", " ", "finish", "ed", " ", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop_", "=_", "timeit_", "._", "default", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "Total", " ", "time", " ", "take", "n", " ", "(", "s", ")", " ", "=", " ", "\"_", ",_", "(_", "stop_", "-_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", " ", "Plott", "ing", " ", "confusion", " ", "matrix", " ", "...", " ", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "\\u", "confusion", "\\u", "matrix_", "(_", "cm", "\\u", "norm_", ",_", "genre\\u", "list_", ",_", "\"", "ce", "ps", "\"_", ",_", "\"", "CE", "PS", " ", "classif", "ier", " ", "-", " ", "Conf", "usion", " ", "matrix", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "All", " ", "Don", "e", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "See", " ", "plots", " ", "in", " ", "'", "graph", "s", "'", " ", "director", "y", " ", "\\\\", "n", "\"_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "train", "\\u", "model_", "(_", "X_", ",_", "Y_", ",_", "name_", ",_", "plot_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "train", "\\u", "model", "(", "vector", ",", " ", "vector", ",", " ", "name", "[", ",", " ", "plot", "=", "Fal", "se", "])", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Train", "s", " ", "and", " ", "save", "s", " ", "model", " ", "to", " ", "disk", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "np_", "._", "unique_", "(_", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cv_", "=_", "Shuffle", "Split_", "(_", "n_", "=_", "len_", "(_", "X_", ")_", ",_", "n", "\\u", "iterations_", "=_", "1_", ",_", "test\\u", "fraction_", "=_", "0.3_", ",_", "indices_", "=_", "True_", ",_", "random", "\\u", "state_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scores_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pr", "\\u", "scores_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "preci", "sions_", ",_", "reca", "lls_", ",_", "thresholds_", "=_", "defaultdict_", "(_", "list_", ")_", ",_", "defaultdict_", "(_", "list_", ")_", ",_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "roc", "\\u", "scores_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tpr", "s_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fpr", "s_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clf", "s_", "=_", "[_", "]_", "#", " ", "for", " ", "the", " ", "median_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "train_", ",_", "test_", "in_", "cv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X", "\\u", "train_", ",_", "y", "\\u", "train_", "=_", "X_", "[_", "train_", "]_", ",_", "Y_", "[_", "train_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X", "\\u", "test_", ",_", "y", "\\u", "test_", "=_", "X_", "[_", "test_", "]_", ",_", "Y_", "[_", "test_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clf_", "=_", "Logi", "stic", "Regression_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clf_", "._", "fit_", "(_", "X", "\\u", "train_", ",_", "y", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clf", "s_", "._", "append_", "(_", "clf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "score_", "=_", "clf_", "._", "score_", "(_", "X", "\\u", "train_", ",_", "y", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "score_", "=_", "clf_", "._", "score_", "(_", "X", "\\u", "test_", ",_", "y", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scores_", "._", "append_", "(_", "test\\u", "score_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "errors_", "._", "append_", "(_", "1_", "-_", "train", "\\u", "score_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "errors_", "._", "append_", "(_", "1_", "-_", "test\\u", "score_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "y", "\\u", "pred_", "=_", "clf_", "._", "predict_", "(_", "X", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", "=_", "confusion", "\\u", "matrix_", "(_", "y", "\\u", "test_", ",_", "y", "\\u", "pred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cms_", "._", "append_", "(_", "cm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "label_", "in_", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y", "\\u", "label", "\\u", "test_", "=_", "np_", "._", "asarray_", "(_", "y", "\\u", "test_", "==_", "label_", ",_", "dtype_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proba_", "=_", "clf_", "._", "predi", "ct", "\\u", "proba_", "(_", "X", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proba", "\\u", "label_", "=_", "proba_", "[_", ":_", ",_", "label_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fpr", "_", ",_", "tpr", "_", ",_", "roc", "\\u", "thresholds_", "=_", "roc", "\\u", "curve_", "(_", "y", "\\u", "label", "\\u", "test_", ",_", "proba", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roc", "\\u", "scores_", "[_", "label_", "]_", "._", "append_", "(_", "auc_", "(_", "fpr", "_", ",_", "tpr", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tpr", "s_", "[_", "label_", "]_", "._", "append_", "(_", "tpr", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fpr", "s_", "[_", "label_", "]_", "._", "append_", "(_", "fpr", "_", ")_", "\\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_", "plot_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "label_", "in_", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "score", "s", "\\u", "to", "\\u", "sort_", "=_", "roc", "\\u", "scores_", "[_", "label_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "median_", "=_", "np_", "._", "argsort_", "(_", "score", "s", "\\u", "to", "\\u", "sort_", ")_", "[_", "len_", "(_", "score", "s", "\\u", "to", "\\u", "sort_", ")_", "/_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "name_", ",_", "genre\\u", "list_", "[_", "label_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "\\u", "roc", "\\u", "curves_", "(_", "roc", "\\u", "scores_", "[_", "label_", "]_", "[_", "median_", "]_", ",_", "desc_", ",_", "tpr", "s_", "[_", "label_", "]_", "[_", "median_", "]_", ",_", "fpr", "s_", "[_", "label_", "]_", "[_", "median_", "]_", ",_", "label_", "=_", "'%", "s", " ", "vs", " ", "rest", "'_", "%_", "genre\\u", "list_", "[_", "label_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "pr", "\\u", "scores_", "=_", "np_", "._", "asarray_", "(_", "pr", "\\u", "scores_", "._", "values_", "(_", ")_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summary_", "=_", "(_", "np_", "._", "mean_", "(_", "scores_", ")_", ",_", "np_", "._", "std_", "(_", "scores_", ")_", ",_", "np_", "._", "mean_", "(_", "all", "\\u", "pr", "\\u", "scores_", ")_", ",_", "np_", "._", "std_", "(_", "all", "\\u", "pr", "\\u", "scores_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(\"", "%", ".3", "f", "\\\\", "t", "%", ".3", "f", "\\\\", "t", "%", ".3", "f", "\\\\", "t", "%", ".3", "f", "\\\\", "t", "\"", " ", "%", " ", "summar", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "save", " ", "the", " ", "trained", " ", "model", " ", "to", " ", "disk_", "\\u\\u\\uNL\\u\\u\\u_", "joblib", "_", "._", "dump_", "(_", "clf_", ",_", "'", "saved", "\\u", "model", "/", "model", "\\u", "ce", "ps", ".", "pkl", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "np_", "._", "mean_", "(_", "train", "\\u", "errors_", ")_", ",_", "np_", "._", "mean_", "(_", "test\\u", "errors_", ")_", ",_", "np_", "._", "asarray_", "(_", "cms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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,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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 ]
Variable defined multiple times
PyHDI/veriloggen/tests/core/instance_/multiple_instances/multiple_instances.py
[ { "content": "def mkTop():\n m = Module('top')\n led = mkLed()\n\n clk = m.Input('CLK')\n rst = m.Input('RST')\n \n params = m.copy_params(led, prefix='A_')\n ports = m.copy_ports(led, prefix='A_', exclude=('CLK', 'RST'))\n \n params = m.copy_params(led, prefix='B_')\n ports = m.copy_ports(led, prefix='B_', exclude=('CLK', 'RST'))\n \n m.Instance(led, 'inst_blinkled_a',\n m.connect_params(led, prefix='A_'),\n m.connect_ports(led, prefix='') + m.connect_ports(led, prefix='A_'))\n \n m.Instance(led, 'inst_blinkled_b',\n m.connect_params(led, prefix='B_'),\n m.connect_ports(led, prefix='') + m.connect_ports(led, prefix='B_'))\n\n return m", "metadata": "root.mkTop", "header": "['module', '___EOS___']", "index": 41 } ]
[ { "span": "params ", "start_line": 48, "start_column": 4, "end_line": 48, "end_column": 10 }, { "span": "ports ", "start_line": 49, "start_column": 4, "end_line": 49, "end_column": 9 } ]
[ { "span": "params ", "start_line": 51, "start_column": 4, "end_line": 51, "end_column": 10 }, { "span": "ports ", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 9 } ]
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_", "def_", "mk", "Top_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "Module_", "(_", "'", "top", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "led_", "=_", "mk", "Led", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clk_", "=_", "m_", "._", "Input_", "(_", "'", "CLK", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rst_", "=_", "m_", "._", "Input_", "(_", "'", "RST", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "m_", "._", "copy", "\\u", "params_", "(_", "led_", ",_", "prefix_", "=_", "'", "A", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ports_", "=_", "m_", "._", "copy", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "'", "A", "\\u'_", ",_", "exclude_", "=_", "(_", "'", "CLK", "'_", ",_", "'", "RST", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "m_", "._", "copy", "\\u", "params_", "(_", "led_", ",_", "prefix_", "=_", "'", "B", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ports_", "=_", "m_", "._", "copy", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "'", "B", "\\u'_", ",_", "exclude_", "=_", "(_", "'", "CLK", "'_", ",_", "'", "RST", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "Instance_", "(_", "led_", ",_", "'", "inst", "\\u", "blink", "led", "\\u", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "connect", "\\u", "params_", "(_", "led_", ",_", "prefix_", "=_", "'", "A", "\\u'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "connect", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "''_", ")_", "+_", "m_", "._", "connect", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "'", "A", "\\u'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "Instance_", "(_", "led_", ",_", "'", "inst", "\\u", "blink", "led", "\\u", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "connect", "\\u", "params_", "(_", "led_", ",_", "prefix_", "=_", "'", "B", "\\u'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "._", "connect", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "''_", ")_", "+_", "m_", "._", "connect", "\\u", "ports_", "(_", "led_", ",_", "prefix_", "=_", "'", "B", "\\u'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "m_", "\\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, 0, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
djc/runa/doc/grammar.py
[ { "content": "def get_tokens():\n\t\n\ttokens = {'INDENT': 'INDENT', 'DEDENT': 'DEDENT'}\n\tfor rule in parser.LEXER.rules:\n\t\tname, pattern = rule.name, rule.re.pattern\n\t\ttokens[rule.name] = rule.re.pattern\n\t\n\tfor word in parser.NAME_LIKE:\n\t\ttokens[word.upper()] = word\n\t\n\treturn tokens", "metadata": "root.get_tokens", "header": "['module', '___EOS___']", "index": 44 } ]
[ { "span": "name,", "start_line": 48, "start_column": 2, "end_line": 48, "end_column": 6 }, { "span": "pattern ", "start_line": 48, "start_column": 8, "end_line": 48, "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_", "get", "\\u", "tokens_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "tokens_", "=_", "{_", "'", "INDENT", "'_", ":_", "'", "INDENT", "'_", ",_", "'", "DED", "ENT", "'_", ":_", "'", "DED", "ENT", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rule_", "in_", "parser_", "._", "LEX", "ER_", "._", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "name_", ",_", "pattern_", "=_", "rule_", "._", "name_", ",_", "rule_", "._", "re_", "._", "pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "[_", "rule_", "._", "name_", "]_", "=_", "rule_", "._", "re_", "._", "pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "word_", "in_", "parser_", "._", "NAME", "\\u", "LI", "KE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "tokens_", "[_", "word_", "._", "upper_", "(_", ")_", "]_", "=_", "word_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tokens_", "\\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, 0, 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 ]
Unused import
sakura-internet/saklient.python/saklient/cloud/resources/lbvirtualip.py
[ { "content": "# -*- coding:utf-8 -*-\n\n# This code is automatically transpiled by Saklient Translator\n\nimport six\nfrom ...util import Util\nfrom .lbserver import LbServer\nimport saklient\n\nstr = six.text_type\n# module saklient.cloud.resources.lbvirtualip\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LbVirtualIp(object):\n ## ロードバランサの仮想IPアドレス設定。\n \n # (instance field) _virtual_ip_address\n \n ## @return {str}\n \n ## @param {str} v\n # @return {str}\n \n ## VIPアドレス\n virtual_ip_address = property(get_virtual_ip_address, set_virtual_ip_address, None)\n \n # (instance field) _port\n \n ## @return {int}\n \n ## @param {int} v\n # @return {int}\n \n ## ポート番号\n port = property(get_port, set_port, None)\n \n # (instance field) _delay_loop\n \n ## @return {int}\n \n ## @param {int} v\n # @return {int}\n \n ## チェック間隔 [秒]\n delay_loop = property(get_delay_loop, set_delay_loop, None)\n \n # (instance field) _servers\n \n ## @return {saklient.cloud.resources.lbserver.LbServer[]}\n \n ## 実サーバ {@link LbServer} の配列\n servers = property(get_servers, None, None)\n \n ## @ignore\n # @param {any} obj=None\n \n ## 監視対象サーバ設定を追加します。\n # \n # @param {any} settings=None 設定オブジェクト\n # @return {saklient.cloud.resources.lbserver.LbServer}\n \n ## @return {any}\n \n ## 指定したIPアドレスにマッチする監視対象サーバ設定のうち、最初にマッチしたものを取得します。\n # \n # @param {str} address 検索するIPアドレス\n # @return {saklient.cloud.resources.lbserver.LbServer} 監視対象サーバ設定(見つからなかった場合はnull)\n \n ## 指定したIPアドレスにマッチする監視対象サーバ設定をすべて削除します。\n # \n # @param {str} address\n # @return {saklient.cloud.resources.lbvirtualip.LbVirtualIp}\n \n ## @ignore\n # @param {any[]} srvs\n # @return {saklient.cloud.resources.lbvirtualip.LbVirtualIp}", "metadata": "root.LbVirtualIp", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def get_virtual_ip_address(self):\n return self._virtual_ip_address", "metadata": "root.LbVirtualIp.get_virtual_ip_address", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 18 }, { "content": " def set_virtual_ip_address(self, v):\n Util.validate_type(v, \"str\")\n self._virtual_ip_address = v\n return self._virtual_ip_address", "metadata": "root.LbVirtualIp.set_virtual_ip_address", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 23 }, { "content": " def get_port(self):\n return self._port", "metadata": "root.LbVirtualIp.get_port", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 34 }, { "content": " def set_port(self, v):\n Util.validate_type(v, \"int\")\n self._port = v\n return self._port", "metadata": "root.LbVirtualIp.set_port", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 39 }, { "content": " def get_delay_loop(self):\n return self._delay_loop", "metadata": "root.LbVirtualIp.get_delay_loop", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 50 }, { "content": " def set_delay_loop(self, v):\n Util.validate_type(v, \"int\")\n self._delay_loop = v\n return self._delay_loop", "metadata": "root.LbVirtualIp.set_delay_loop", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 55 }, { "content": " def get_servers(self):\n return self._servers", "metadata": "root.LbVirtualIp.get_servers", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 66 }, { "content": " def __init__(self, obj=None):\n if obj is None:\n obj = {}\n vip = Util.get_by_path_any([obj], [\"VirtualIPAddress\", \"virtualIpAddress\", \"virtual_ip_address\", \"vip\"])\n self._virtual_ip_address = vip\n port = Util.get_by_path_any([obj], [\"Port\", \"port\"])\n self._port = None\n if port is not None:\n self._port = int(port)\n if self._port == 0:\n self._port = None\n delayLoop = Util.get_by_path_any([obj], [\"DelayLoop\", \"delayLoop\", \"delay_loop\", \"delay\"])\n self._delay_loop = None\n if delayLoop is not None:\n self._delay_loop = int(delayLoop)\n if self._delay_loop == 0:\n self._delay_loop = None\n self._servers = []\n serversDyn = Util.get_by_path_any([obj], [\"Servers\", \"servers\"])\n if serversDyn is not None:\n servers = serversDyn\n for server in servers:\n self._servers.append(LbServer(server))", "metadata": "root.LbVirtualIp.__init__", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 74 }, { "content": " def add_server(self, settings=None):\n ret = LbServer(settings)\n self._servers.append(ret)\n return ret", "metadata": "root.LbVirtualIp.add_server", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 102 }, { "content": " def to_raw_settings(self):\n servers = []\n for server in self._servers:\n servers.append(server.to_raw_settings())\n return {\n 'VirtualIPAddress': self._virtual_ip_address,\n 'Port': self._port,\n 'DelayLoop': self._delay_loop,\n 'Servers': servers\n }", "metadata": "root.LbVirtualIp.to_raw_settings", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 108 }, { "content": " def get_server_by_address(self, address):\n Util.validate_type(address, \"str\")\n for srv in self._servers:\n if srv.ip_address == address:\n return srv\n return None", "metadata": "root.LbVirtualIp.get_server_by_address", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 123 }, { "content": " def remove_server_by_address(self, address):\n Util.validate_type(address, \"str\")\n servers = []\n for srv in self._servers:\n if srv.ip_address != address:\n servers.append(srv)\n self._servers = servers\n return self", "metadata": "root.LbVirtualIp.remove_server_by_address", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 134 }, { "content": " def update_status(self, srvs):\n Util.validate_type(srvs, \"list\")\n for srvDyn in srvs:\n ip = (srvDyn[\"IPAddress\"] if \"IPAddress\" in srvDyn else None)\n srv = self.get_server_by_address(ip)\n if srv is None:\n next\n srv.update_status(srvDyn)\n return self", "metadata": "root.LbVirtualIp.update_status", "header": "['class', 'LbVirtualIp', '(', 'object', ')', ':', '___NEWLINE___', '## ロードバランサの仮想IPアドレス設定。', '___NL___', '___NL___', '# (instance field) _virtual_ip_address', '___NL___', '___NL___', '## @return {str}', '___NL___', '___EOS___']", "index": 146 } ]
[ { "span": "import saklient", "start_line": 7, "start_column": 0, "end_line": 7, "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "code", " ", "is", " ", "automati", "call", "y", " ", "transp", "ile", "d", " ", "by", " ", "Sa", "kli", "ent", " ", "Translator_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "util_", "import_", "Util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "lb", "server_", "import_", "Lb", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sak", "lient_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "=_", "six_", "._", "text", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "module", " ", "sak", "lien", "t", ".", "cloud", ".", "resource", "s", ".", "lb", "virtual", "ip_", "\\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_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "param", " ", "{", "str", "}", " ", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "{", "str", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "VI", "P", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "virtual", "\\u", "ip", "\\u", "address_", "=_", "property_", "(_", "get", "\\u", "virtual", "\\u", "ip", "\\u", "address_", ",_", "set\\u", "virtual", "\\u", "ip", "\\u", "address_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "port_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "int", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "param", " ", "{", "int", "}", " ", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "{", "int", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\\", "1250", "9", ";", "\\", "125", "40", ";", "\\", "124", "88", ";", "\\", "300", "5", "8", ";", "\\", "214", "9", "5", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port_", "=_", "property_", "(_", "get", "\\u", "port_", ",_", "set\\u", "port_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "dela", "y", "\\u", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "int", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "param", " ", "{", "int", "}", " ", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "{", "int", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\\", "124", "8", "1", ";", "\\", "124", "5", "5", ";", "\\", "124", "8", "3", ";", "\\", "124", "6", "3", ";", "\\", "382", "9", "1", ";", "\\", "385", "4", "8", ";", " ", "[", "\\", "311", "86", ";", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dela", "y", "\\u", "loop_", "=_", "property_", "(_", "get", "\\u", "dela", "y", "\\u", "loop_", ",_", "set\\u", "dela", "y", "\\u", "loop_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "servers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "sak", "lien", "t", ".", "cloud", ".", "resource", "s", ".", "lb", "server", ".", "Lb", "Server", "[]", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\\", "2345", "5", ";", "\\", "124", "6", "9", ";", "\\", "125", "40", ";", "\\", "124", "96", ";", " ", "{", "@", "link", " ", "Lb", "Server", "}", " ", "\\", "123", "98", ";", "\\", "371", "9", "7", ";", "\\", "210", "15", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "servers_", "=_", "property_", "(_", "get", "\\u", "servers_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "ignore_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "{", "any", "}", " ", "obj", "=", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\\", "304", "3", "5", ";", "\\", "352", "2", "2", ";", "\\", "235", "50", ";", "\\", "359", "3", "7", ";", "\\", "124", "6", "9", ";", "\\", "125", "40", ";", "\\", "124", "96", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "124", "3", "4", ";", "\\", "368", "6", "1", ";", "\\", "211", "5", "2", ";", "\\", "123", "7", "5", ";", "\\", "124", "14", ";", "\\", "123", "7", "7", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "{", "any", "}", " ", "settings", "=", "Non", "e", " ", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "124", "5", "8", ";", "\\", "1250", "2", ";", "\\", "124", "7", "2", ";", "\\", "124", "5", "5", ";", "\\", "124", "6", "3", ";", "\\", "124", "88", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "{", "sak", "lien", "t", ".", "cloud", ".", "resource", "s", ".", "lb", "server", ".", "Lb", "Server", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "any", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\\", "253", "5", "1", ";", "\\", "2345", "0", ";", "\\", "123", "7", "5", ";", "\\", "123", "8", "3", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "123", "9", "5", ";", "\\", "1251", "0", ";", "\\", "124", "8", "3", ";", "\\", "124", "8", "1", ";", "\\", "123", "7", "7", ";", "\\", "124", "2", "7", ";", "\\", "304", "3", "5", ";", "\\", "352", "2", "2", ";", "\\", "235", "50", ";", "\\", "359", "3", "7", ";", "\\", "124", "6", "9", ";", "\\", "125", "40", ";", "\\", "124", "96", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "123", "98", ";", "\\", "123", "5", "8", ";", "\\", "123", "85", ";", "\\", "122", "89", ";", "\\", "263", "6", "8", ";", "\\", "210", "21", ";", "\\", "123", "9", "5", ";", "\\", "1251", "0", ";", "\\", "124", "8", "3", ";", "\\", "124", "8", "1", ";", "\\", "123", "7", "5", ";", "\\", "123", "8", "3", ";", "\\", "124", "1", "8", ";", "\\", "123", "98", ";", "\\", "124", "3", "4", ";", "\\", "214", "6", "2", ";", "\\", "244", "7", "1", ";", "\\", "123", "7", "5", ";", "\\", "124", "14", ";", "\\", "123", "7", "7", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "{", "str", "}", " ", "address", " ", "\\", "269", "0", "8", ";", "\\", "320", "3", "4", ";", "\\", "123", "7", "7", ";", "\\", "124", "2", "7", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "{", "sak", "lien", "t", ".", "cloud", ".", "resource", "s", ".", "lb", "server", ".", "Lb", "Server", "}", " ", "\\", "304", "3", "5", ";", "\\", "352", "2", "2", ";", "\\", "235", "50", ";", "\\", "359", "3", "7", ";", "\\", "124", "6", "9", ";", "\\", "125", "40", ";", "\\", "124", "96", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "652", "88", ";", "\\", "352", "11", ";", "\\", "123", "88", ";", "\\", "123", "6", "3", ";", "\\", "124", "25", ";", "\\", "123", "9", "4", ";", "\\", "123", "6", "3", ";", "\\", "123", "87", ";", "\\", "123", "8", "3", ";", "\\", "225", "80", ";", "\\", "215", "1", "2", ";", "\\", "123", "9", "9", ";", "null", "\\", "652", "89", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\\", "253", "5", "1", ";", "\\", "2345", "0", ";", "\\", "123", "7", "5", ";", "\\", "123", "8", "3", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "123", "9", "5", ";", "\\", "1251", "0", ";", "\\", "124", "8", "3", ";", "\\", "124", "8", "1", ";", "\\", "123", "7", "7", ";", "\\", "124", "2", "7", ";", "\\", "304", "3", "5", ";", "\\", "352", "2", "2", ";", "\\", "235", "50", ";", "\\", "359", "3", "7", ";", "\\", "124", "6", "9", ";", "\\", "125", "40", ";", "\\", "124", "96", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "124", "3", "4", ";", "\\", "123", "7", "7", ";", "\\", "124", "09", ";", "\\", "123", "90", ";", "\\", "210", "6", "6", ";", "\\", "385", "00", ";", "\\", "123", "7", "5", ";", "\\", "124", "14", ";", "\\", "123", "7", "7", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "{", "str", "}", " ", "address_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "{", "sak", "lien", "t", ".", "cloud", ".", "resource", "s", ".", "lb", "virtual", "ip", ".", "Lb", "Virt", "ual", "Ip", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "ignore_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "{", "any", "[]", "}", " ", "srv", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "{", "sak", "lien", "t", ".", "cloud", ".", "resource", "s", ".", "lb", "virtual", "ip", ".", "Lb", "Virt", "ual", "Ip", "}_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\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", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\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_", "set\\u", "virtual", "\\u", "ip", "\\u", "address_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Util_", "._", "validat", "e\\u", "type_", "(_", "v_", ",_", "\"", "str", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "port_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\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_", "set\\u", "port_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Util_", "._", "validat", "e\\u", "type_", "(_", "v_", ",_", "\"", "int", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "port_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "dela", "y", "\\u", "loop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "dela", "y", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\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_", "set\\u", "dela", "y", "\\u", "loop_", "(_", "self_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Util_", "._", "validat", "e\\u", "type_", "(_", "v_", ",_", "\"", "int", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dela", "y", "\\u", "loop_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "dela", "y", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "servers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "servers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vip_", "=_", "Util_", "._", "get", "\\u", "by", "\\u", "path", "\\u", "any_", "(_", "[_", "obj_", "]_", ",_", "[_", "\"", "Virt", "ual", "IPA", "ddress", "\"_", ",_", "\"", "virtual", "Ip", "Address", "\"_", ",_", "\"", "virtual", "\\u", "ip", "\\u", "address", "\"_", ",_", "\"", "vip", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "=_", "vip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "Util_", "._", "get", "\\u", "by", "\\u", "path", "\\u", "any_", "(_", "[_", "obj_", "]_", ",_", "[_", "\"", "Port", "\"_", ",_", "\"", "port", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "port_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "port_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "port_", "=_", "int_", "(_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "port_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "port_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dela", "y", "Loop_", "=_", "Util_", "._", "get", "\\u", "by", "\\u", "path", "\\u", "any_", "(_", "[_", "obj_", "]_", ",_", "[_", "\"", "Delay", "Loop", "\"_", ",_", "\"", "dela", "y", "Loop", "\"_", ",_", "\"", "dela", "y", "\\u", "loop", "\"_", ",_", "\"", "dela", "y", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dela", "y", "\\u", "loop_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dela", "y", "Loop_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dela", "y", "\\u", "loop_", "=_", "int_", "(_", "dela", "y", "Loop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "dela", "y", "\\u", "loop_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dela", "y", "\\u", "loop_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "servers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "s", "Dyn", "_", "=_", "Util_", "._", "get", "\\u", "by", "\\u", "path", "\\u", "any_", "(_", "[_", "obj_", "]_", ",_", "[_", "\"", "Server", "s", "\"_", ",_", "\"", "server", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server", "s", "Dyn", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "servers_", "=_", "server", "s", "Dyn", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "server_", "in_", "servers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "servers_", "._", "append_", "(_", "Lb", "Server_", "(_", "server_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\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_", "add", "\\u", "server_", "(_", "self_", ",_", "settings_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "Lb", "Server_", "(_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "servers_", "._", "append_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\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_", "to", "\\u", "raw", "\\u", "settings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "servers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "server_", "in_", "self_", "._", "\\u", "servers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "servers_", "._", "append_", "(_", "server_", "._", "to", "\\u", "raw", "\\u", "settings_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Virt", "ual", "IPA", "ddress", "'_", ":_", "self_", "._", "\\u", "virtual", "\\u", "ip", "\\u", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Port", "'_", ":_", "self_", "._", "\\u", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Delay", "Loop", "'_", ":_", "self_", "._", "\\u", "dela", "y", "\\u", "loop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Server", "s", "'_", ":_", "servers_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\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_", "get", "\\u", "server", "\\u", "by", "\\u", "address_", "(_", "self_", ",_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Util_", "._", "validat", "e\\u", "type_", "(_", "address_", ",_", "\"", "str", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "srv_", "in_", "self_", "._", "\\u", "servers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "srv_", "._", "ip", "\\u", "address_", "==_", "address_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "srv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\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_", "remove", "\\u", "server", "\\u", "by", "\\u", "address_", "(_", "self_", ",_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Util_", "._", "validat", "e\\u", "type_", "(_", "address_", ",_", "\"", "str", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "servers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "srv_", "in_", "self_", "._", "\\u", "servers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "srv_", "._", "ip", "\\u", "address_", "!=_", "address_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "servers_", "._", "append_", "(_", "srv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "servers_", "=_", "servers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lb", "Virt", "ual", "Ip_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\", "1252", "5", ";", "\\", "125", "40", ";", "\\", "124", "89", ";", "\\", "124", "96", ";", "\\", "1252", "1", ";", "\\", "125", "3", "1", ";", "\\", "124", "6", "9", ";", "\\", "123", "98", ";", "\\", "2020", "6", ";", "\\", "248", "1", "9", ";", "IP", "\\", "124", "50", ";", "\\", "124", "89", ";", "\\", "1252", "4", ";", "\\", "124", "7", "3", ";", "\\", "353", "7", "3", ";", "\\", "2345", "0", ";", "\\", "122", "90", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "instance", " ", "field", ")", " ", "\\u", "virtual", "\\u", "ip", "\\u", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "return", " ", "{", "str", "}_", "\\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_", "update", "\\u", "status_", "(_", "self_", ",_", "srv", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Util_", "._", "validat", "e\\u", "type_", "(_", "srv", "s_", ",_", "\"", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "srv", "Dyn", "_", "in_", "srv", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip_", "=_", "(_", "srv", "Dyn", "_", "[_", "\"", "IPA", "ddress", "\"_", "]_", "if_", "\"", "IPA", "ddress", "\"_", "in_", "srv", "Dyn", "_", "else_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srv_", "=_", "self_", "._", "get", "\\u", "server", "\\u", "by", "\\u", "address_", "(_", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "srv_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "srv_", "._", "update", "\\u", "status_", "(_", "srv", "Dyn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_" ]
[ 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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07():\n pth = os.path.join(pth2005, 'P07')\n namfile = 'p7mf2005.nam'\n mf = flopy.modflow.Modflow.load(namfile, model_ws=pth, verbose=True)\n namfile = 'p7mt.nam'\n mt = flopy.mt3d.mt.Mt3dms.load(namfile, model_ws=pth, verbose=True)\n mt.model_ws = newpth\n mt.write_input()\n return", "metadata": "root.test_mf2005_p07", "header": "['module', '___EOS___']", "index": 9 }, { "content": "def test_mf2000_p07():\n pth = os.path.join(pth2000, 'P07')\n namfile = 'p7mf2k.nam'\n mf = flopy.modflow.Modflow.load(namfile, model_ws=pth, verbose=True)\n namfile = 'p7mt.nam'\n mt = flopy.mt3d.mt.Mt3dms.load(namfile, model_ws=pth, verbose=True)\n mt.model_ws = newpth\n mt.write_input()\n return", "metadata": "root.test_mf2000_p07", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def test_mf2000_HSSTest():\n pth = os.path.join(pth2000, 'HSSTest')\n namfile = 'hsstest_mf2k.nam'\n mf = flopy.modflow.Modflow.load(namfile, model_ws=pth, verbose=True)\n namfile = 'hsstest_mt.nam'\n mt = flopy.mt3d.mt.Mt3dms.load(namfile, model_ws=pth, verbose=True)\n mt.model_ws = newpth\n mt.write_input()\n return", "metadata": "root.test_mf2000_HSSTest", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def test_mf2000_MultiDiffusion():\n pth = os.path.join(pth2000, 'MultiDiffusion')\n namfile = 'p7mf2k.nam'\n mf = flopy.modflow.Modflow.load(namfile, model_ws=pth, verbose=True)\n namfile = 'P7MT.NAM'\n mt = flopy.mt3d.mt.Mt3dms.load(namfile, model_ws=pth, verbose=True)\n mt.model_ws = newpth\n mt.write_input()\n return", "metadata": "root.test_mf2000_MultiDiffusion", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def test_mf2000_P07():\n pth = os.path.join(pth2000, 'P07')\n namfile = 'p7mf2k.nam'\n mf = flopy.modflow.Modflow.load(namfile, model_ws=pth, verbose=True)\n namfile = 'p7mt.nam'\n mt = flopy.mt3d.mt.Mt3dms.load(namfile, model_ws=pth, verbose=True)\n mt.model_ws = newpth\n mt.write_input()\n return", "metadata": "root.test_mf2000_P07", "header": "['module', '___EOS___']", "index": 62 }, { "content": "def test_mf2000_reinject():\n pth = os.path.join(pth2000, 'reinject')\n namfile = 'P3MF2K.NAM'\n mf = flopy.modflow.Modflow.load(namfile, model_ws=pth, verbose=True)\n namfile = 'P3MT.NAM'\n mt = flopy.mt3d.mt.Mt3dms.load(namfile, model_ws=pth, verbose=True)\n mt.model_ws = newpth\n mt.write_input()\n return", "metadata": "root.test_mf2000_reinject", "header": "['module', '___EOS___']", "index": 72 }, { "content": "def test_mf2000_SState():\n pth = os.path.join(pth2000, 'SState')\n namfile = 'SState_mf2k.nam'\n mf = flopy.modflow.Modflow.load(namfile, model_ws=pth, verbose=True)\n namfile = 'SState_mt.nam'\n mt = flopy.mt3d.mt.Mt3dms.load(namfile, model_ws=pth, verbose=True)\n mt.model_ws = newpth\n mt.write_input()\n return", "metadata": "root.test_mf2000_SState", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def test_mf2000_tob():\n pth = os.path.join(pth2000, 'tob')\n namfile = 'p7mf2k.nam'\n mf = flopy.modflow.Modflow.load(namfile, model_ws=pth, verbose=True)\n namfile = 'p7mt.nam'\n mt = flopy.mt3d.mt.Mt3dms.load(namfile, model_ws=pth, verbose=True)\n mt.model_ws = newpth\n mt.write_input()\n return", "metadata": "root.test_mf2000_tob", "header": "['module', '___EOS___']", "index": 92 }, { "content": "def test_mf2000_zeroth():\n pth = os.path.join(pth2000, 'zeroth')\n namfile = 'z0mf2k.nam'\n mf = flopy.modflow.Modflow.load(namfile, model_ws=pth, verbose=True)\n namfile = 'z0mt.nam'\n mt = flopy.mt3d.mt.Mt3dms.load(namfile, model_ws=pth, verbose=True)\n mt.model_ws = newpth\n mt.write_input()\n return", "metadata": "root.test_mf2000_zeroth", "header": "['module', '___EOS___']", "index": 102 } ]
[ { "span": "mf ", "start_line": 12, "start_column": 4, "end_line": 12, "end_column": 6 }, { "span": "mf ", "start_line": 22, "start_column": 4, "end_line": 22, "end_column": 6 }, { "span": "mf ", "start_line": 32, "start_column": 4, "end_line": 32, "end_column": 6 }, { "span": "mf ", "start_line": 55, "start_column": 4, "end_line": 55, "end_column": 6 }, { "span": "mf ", "start_line": 65, "start_column": 4, "end_line": 65, "end_column": 6 }, { "span": "mf ", "start_line": 75, "start_column": 4, "end_line": 75, "end_column": 6 }, { "span": "mf ", "start_line": 85, "start_column": 4, "end_line": 85, "end_column": 6 }, { "span": "mf ", "start_line": 95, "start_column": 4, "end_line": 95, "end_column": 6 }, { "span": "mf ", "start_line": 105, "start_column": 4, "end_line": 105, "end_column": 6 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "mf", "2005", "\\u", "p0", "7_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pth_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pth", "2005", "_", ",_", "'", "P0", "7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "p", "7", "mf", "2005", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "p", "7", "mt", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "flop", "y_", "._", "mt", "3d_", "._", "mt_", "._", "Mt", "3d", "ms_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "model", "\\u", "ws_", "=_", "newp", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "write", "\\u", "input_", "(_", ")_", "\\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_", "test\\u", "mf", "2000", "\\u", "p0", "7_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pth_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pth", "2000_", ",_", "'", "P0", "7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "p", "7", "mf", "2", "k", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "p", "7", "mt", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "flop", "y_", "._", "mt", "3d_", "._", "mt_", "._", "Mt", "3d", "ms_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "model", "\\u", "ws_", "=_", "newp", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "write", "\\u", "input_", "(_", ")_", "\\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_", "test\\u", "mf", "2000", "\\u", "HS", "ST", "est_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pth_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pth", "2000_", ",_", "'", "HS", "ST", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "hs", "ste", "st", "\\u", "mf", "2", "k", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "hs", "ste", "st", "\\u", "mt", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "flop", "y_", "._", "mt", "3d_", "._", "mt_", "._", "Mt", "3d", "ms_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "model", "\\u", "ws_", "=_", "newp", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "write", "\\u", "input_", "(_", ")_", "\\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_", "def_", "test\\u", "mf", "2000", "\\u", "Multi", "Diffus", "ion_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pth_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pth", "2000_", ",_", "'", "Multi", "Diffus", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "p", "7", "mf", "2", "k", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "P", "7", "MT", ".", "NAM", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "flop", "y_", "._", "mt", "3d_", "._", "mt_", "._", "Mt", "3d", "ms_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "model", "\\u", "ws_", "=_", "newp", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "write", "\\u", "input_", "(_", ")_", "\\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_", "test\\u", "mf", "2000", "\\u", "P0", "7_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pth_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pth", "2000_", ",_", "'", "P0", "7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "p", "7", "mf", "2", "k", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "p", "7", "mt", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "flop", "y_", "._", "mt", "3d_", "._", "mt_", "._", "Mt", "3d", "ms_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "model", "\\u", "ws_", "=_", "newp", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "write", "\\u", "input_", "(_", ")_", "\\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_", "test\\u", "mf", "2000", "\\u", "rein", "ject_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pth_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pth", "2000_", ",_", "'", "rein", "ject", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "P3", "MF", "2", "K", ".", "NAM", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "P3", "MT", ".", "NAM", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "flop", "y_", "._", "mt", "3d_", "._", "mt_", "._", "Mt", "3d", "ms_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "model", "\\u", "ws_", "=_", "newp", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "write", "\\u", "input_", "(_", ")_", "\\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_", "test\\u", "mf", "2000", "\\u", "SS", "tate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pth_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pth", "2000_", ",_", "'", "SS", "tate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "SS", "tate", "\\u", "mf", "2", "k", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "SS", "tate", "\\u", "mt", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "flop", "y_", "._", "mt", "3d_", "._", "mt_", "._", "Mt", "3d", "ms_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "model", "\\u", "ws_", "=_", "newp", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "write", "\\u", "input_", "(_", ")_", "\\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_", "test\\u", "mf", "2000", "\\u", "tob", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pth_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pth", "2000_", ",_", "'", "tob", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "p", "7", "mf", "2", "k", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "p", "7", "mt", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "flop", "y_", "._", "mt", "3d_", "._", "mt_", "._", "Mt", "3d", "ms_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "model", "\\u", "ws_", "=_", "newp", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "write", "\\u", "input_", "(_", ")_", "\\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_", "test\\u", "mf", "2000", "\\u", "zero", "th_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pth_", "=_", "os_", "._", "path_", "._", "join_", "(_", "pth", "2000_", ",_", "'", "zero", "th", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "z", "0", "mf", "2", "k", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mf_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam", "file_", "=_", "'", "z", "0", "mt", ".", "nam", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "=_", "flop", "y_", "._", "mt", "3d_", "._", "mt_", "._", "Mt", "3d", "ms_", "._", "load_", "(_", "nam", "file_", ",_", "model", "\\u", "ws_", "=_", "pth_", ",_", "verbose_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "model", "\\u", "ws_", "=_", "newp", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mt_", "._", "write", "\\u", "input_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\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, 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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, 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 ]
Variable defined multiple times
ktbyers/netmiko/examples/scp_example.py
[ { "content": "def main():\n '''\n SCP transfer cisco_logging.txt to network device\n\n Use ssh_conn as ssh channel into network device\n scp_conn must be closed after file transfer\n '''\n ssh_conn = ConnectHandler(**cisco_881)\n scp_conn = SCPConn(ssh_conn)\n s_file = 'cisco_logging.txt'\n d_file = 'cisco_logging.txt'\n\n print \"\\n\\n\"\n\n scp_conn.scp_transfer_file(s_file, d_file)\n scp_conn.close()\n\n output = ssh_conn.send_command(\"show flash: | inc cisco_logging\")\n print \">> \" + output + '\\n'\n\n # Disable file copy confirmation\n output = ssh_conn.send_config_set([\"file prompt quiet\"])\n\n # Execute config merge\n print \"Performing config merge\\n\"\n output = ssh_conn.send_command(\"copy flash:cisco_logging.txt running-config\")\n\n # Verify change\n print \"Verifying logging buffer change\"\n output = ssh_conn.send_command(\"show run | inc logging buffer\")\n print \">> \" + output + '\\n'\n\n # Restore copy confirmation\n output = ssh_conn.send_config_set([\"file prompt alert\"])", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 10 } ]
[ { "span": "output ", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 10 }, { "span": "output ", "start_line": 35, "start_column": 4, "end_line": 35, "end_column": 10 } ]
[ { "span": "output ", "start_line": 39, "start_column": 4, "end_line": 39, "end_column": 10 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "SCP", " ", "transfer", " ", "cis", "co", "\\u", "logg", "ing", ".", "txt", " ", "to", " ", "network", " ", "device", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "ssh", "\\u", "conn", " ", "as", " ", "ssh", " ", "channel", " ", "int", "o", " ", "network", " ", "device", "\\", "10", ";", " ", " ", " ", " ", "scp", "\\u", "conn", " ", "must", " ", "be", " ", "close", "d", " ", "after", " ", "file", " ", "transfer", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssh", "\\u", "conn_", "=_", "Connect", "Handler_", "(_", "**_", "cis", "co", "\\u", "881", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scp", "\\u", "conn_", "=_", "SCP", "Conn_", "(_", "ssh", "\\u", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s", "\\u", "file_", "=_", "'", "cis", "co", "\\u", "logg", "ing", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "file_", "=_", "'", "cis", "co", "\\u", "logg", "ing", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scp", "\\u", "conn_", "._", "scp", "\\u", "transfer", "\\u", "file_", "(_", "s", "\\u", "file_", ",_", "d\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scp", "\\u", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "ssh", "\\u", "conn_", "._", "send", "\\u", "command_", "(_", "\"", "show", " ", "flash", ":", " ", "|", " ", "inc", " ", "cis", "co", "\\u", "logg", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\">>", " ", "\"_", "+_", "output_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Disa", "ble", " ", "file", " ", "copy", " ", "confirmation_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "ssh", "\\u", "conn_", "._", "send", "\\u", "config", "\\u", "set_", "(_", "[_", "\"", "file", " ", "prompt", " ", "quie", "t", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "e", " ", "config", " ", "merge_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Perform", "ing", " ", "config", " ", "merge", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "ssh", "\\u", "conn_", "._", "send", "\\u", "command_", "(_", "\"", "copy", " ", "flash", ":", "cis", "co", "\\u", "logg", "ing", ".", "txt", " ", "runn", "ing", "-", "config", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Verify", "ing", " ", "logg", "ing", " ", "buffer", " ", "change", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "ssh", "\\u", "conn_", "._", "send", "\\u", "command_", "(_", "\"", "show", " ", "run", " ", "|", " ", "inc", " ", "logg", "ing", " ", "buffer", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\">>", " ", "\"_", "+_", "output_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Restor", "e", " ", "copy", " ", "confirmation_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "ssh", "\\u", "conn_", "._", "send", "\\u", "config", "\\u", "set_", "(_", "[_", "\"", "file", " ", "prompt", " ", "alert", "\"_", "]_", ")_", "\\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, 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, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Non-callable called
azoft-dev-team/imagrium/env/Lib/decimal.py
[ { "content": "class Decimal(object):\n \"\"\"Floating point class for decimal arithmetic.\"\"\"\n\n __slots__ = ('_exp','_int','_sign', '_is_special')\n # Generally, the value of the Decimal instance is given by\n # (-1)**_sign * _int * 10**_exp\n # Special values are signified by _is_special == True\n\n # We're immutable, so use __new__ not __init__\n\n # @classmethod, but @decorator is not valid Python 2.3 syntax, so\n # don't use it (see notes on Py2.3 compatibility at top of file)\n from_float = classmethod(from_float)\n\n\n\n\n\n\n\n # Note: The Decimal standard doesn't cover rich comparisons for\n # Decimals. In particular, the specification is silent on the\n # subject of what should happen for a comparison involving a NaN.\n # We take the following approach:\n #\n # == comparisons involving a quiet NaN always return False\n # != comparisons involving a quiet NaN always return True\n # == or != comparisons involving a signaling NaN signal\n # InvalidOperation, and return False or True as above if the\n # InvalidOperation is not trapped.\n # <, >, <= and >= comparisons involving a (quiet or signaling)\n # NaN signal InvalidOperation, and return False if the\n # InvalidOperation is not trapped.\n #\n # This behavior is designed to conform as closely as possible to\n # that specified by IEEE 754.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n __radd__ = __add__\n\n\n\n __rmul__ = __mul__\n\n\n\n\n __div__ = __truediv__\n __rdiv__ = __rtruediv__\n\n\n\n\n\n\n\n\n\n\n __trunc__ = __int__\n\n real = property(real)\n\n imag = property(imag)\n\n\n\n\n\n\n _pick_rounding_function = {}\n\n # for each of the rounding functions below:\n # self is a finite, nonzero Decimal\n # prec is an integer satisfying 0 <= prec < len(self._int)\n #\n # each function returns either -1, 0, or 1, as follows:\n # 1 indicates that self should be rounded up (away from zero)\n # 0 indicates that self should be truncated, and that all the\n # digits to be truncated are zeros (so the value is unchanged)\n # -1 indicates that there are nonzero digits to be truncated\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # the method name changed, but we provide also the old one, for compatibility\n to_integral = to_integral_value\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # Support for pickling, copy, and deepcopy\n\n\n\n # PEP 3101 support. the _localeconv keyword argument should be\n # considered private: it's provided for ease of testing only.\n\n # support for Jython __tojava__:", "metadata": "root.Decimal", "header": "['module', '___EOS___']", "index": 513 }, { "content": " def __new__(cls, value=\"0\", context=None):\n \"\"\"Create a decimal point instance.\n\n >>> Decimal('3.14') # string input\n Decimal('3.14')\n >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent)\n Decimal('3.14')\n >>> Decimal(314) # int or long\n Decimal('314')\n >>> Decimal(Decimal(314)) # another decimal instance\n Decimal('314')\n >>> Decimal(' 3.14 \\\\n') # leading and trailing whitespace okay\n Decimal('3.14')\n \"\"\"\n\n # Note that the coefficient, self._int, is actually stored as\n # a string rather than as a tuple of digits. This speeds up\n # the \"digits to integer\" and \"integer to digits\" conversions\n # that are used in almost every arithmetic operation on\n # Decimals. This is an internal detail: the as_tuple function\n # and the Decimal constructor still deal with tuples of\n # digits.\n\n self = object.__new__(cls)\n\n # From a string\n # REs insist on real strings, so we can too.\n if isinstance(value, basestring):\n m = _parser(value.strip())\n if m is None:\n if context is None:\n context = getcontext()\n return context._raise_error(ConversionSyntax,\n \"Invalid literal for Decimal: %r\" % value)\n\n if m.group('sign') == \"-\":\n self._sign = 1\n else:\n self._sign = 0\n intpart = m.group('int')\n if intpart is not None:\n # finite number\n fracpart = m.group('frac') or ''\n exp = int(m.group('exp') or '0')\n self._int = str(int(intpart+fracpart))\n self._exp = exp - len(fracpart)\n self._is_special = False\n else:\n diag = m.group('diag')\n if diag is not None:\n # NaN\n self._int = str(int(diag or '0')).lstrip('0')\n if m.group('signal'):\n self._exp = 'N'\n else:\n self._exp = 'n'\n else:\n # infinity\n self._int = '0'\n self._exp = 'F'\n self._is_special = True\n return self\n\n # From an integer\n if isinstance(value, (int,long)):\n if value >= 0:\n self._sign = 0\n else:\n self._sign = 1\n self._exp = 0\n self._int = str(abs(value))\n self._is_special = False\n return self\n\n # From another decimal\n if isinstance(value, Decimal):\n self._exp = value._exp\n self._sign = value._sign\n self._int = value._int\n self._is_special = value._is_special\n return self\n\n # From an internal working value\n if isinstance(value, _WorkRep):\n self._sign = value.sign\n self._int = str(value.int)\n self._exp = int(value.exp)\n self._is_special = False\n return self\n\n # tuple/list conversion (possibly from as_tuple())\n if isinstance(value, (list,tuple)):\n if len(value) != 3:\n raise ValueError('Invalid tuple size in creation of Decimal '\n 'from list or tuple. The list or tuple '\n 'should have exactly three elements.')\n # process sign. The isinstance test rejects floats\n if not (isinstance(value[0], (int, long)) and value[0] in (0,1)):\n raise ValueError(\"Invalid sign. The first value in the tuple \"\n \"should be an integer; either 0 for a \"\n \"positive number or 1 for a negative number.\")\n self._sign = value[0]\n if value[2] == 'F':\n # infinity: value[1] is ignored\n self._int = '0'\n self._exp = value[2]\n self._is_special = True\n else:\n # process and validate the digits in value[1]\n digits = []\n for digit in value[1]:\n if isinstance(digit, (int, long)) and 0 <= digit <= 9:\n # skip leading zeros\n if digits or digit != 0:\n digits.append(digit)\n else:\n raise ValueError(\"The second value in the tuple must \"\n \"be composed of integers in the range \"\n \"0 through 9.\")\n if value[2] in ('n', 'N'):\n # NaN: digits form the diagnostic\n self._int = ''.join(map(str, digits))\n self._exp = value[2]\n self._is_special = True\n elif isinstance(value[2], (int, long)):\n # finite number: digits give the coefficient\n self._int = ''.join(map(str, digits or [0]))\n self._exp = value[2]\n self._is_special = False\n else:\n raise ValueError(\"The third value in the tuple must \"\n \"be an integer, or one of the \"\n \"strings 'F', 'n', 'N'.\")\n return self\n\n if isinstance(value, float):\n value = Decimal.from_float(value)\n self._exp = value._exp\n self._sign = value._sign\n self._int = value._int\n self._is_special = value._is_special\n return self\n\n raise TypeError(\"Cannot convert %r to Decimal\" % value)", "metadata": "root.Decimal.__new__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 522 }, { "content": " def from_float(cls, f):\n \"\"\"Converts a float to a decimal number, exactly.\n\n Note that Decimal.from_float(0.1) is not the same as Decimal('0.1').\n Since 0.1 is not exactly representable in binary floating point, the\n value is stored as the nearest representable value which is\n 0x1.999999999999ap-4. The exact equivalent of the value in decimal\n is 0.1000000000000000055511151231257827021181583404541015625.\n\n >>> Decimal.from_float(0.1)\n Decimal('0.1000000000000000055511151231257827021181583404541015625')\n >>> Decimal.from_float(float('nan'))\n Decimal('NaN')\n >>> Decimal.from_float(float('inf'))\n Decimal('Infinity')\n >>> Decimal.from_float(-float('inf'))\n Decimal('-Infinity')\n >>> Decimal.from_float(-0.0)\n Decimal('-0')\n\n \"\"\"\n if isinstance(f, (int, long)): # handle integer inputs\n return cls(f)\n if _math.isinf(f) or _math.isnan(f): # raises TypeError if not a float\n return cls(repr(f))\n if _math.copysign(1.0, f) == 1.0:\n sign = 0\n else:\n sign = 1\n n, d = abs(f).as_integer_ratio()\n k = d.bit_length() - 1\n result = _dec_from_triple(sign, str(n*5**k), -k)\n if cls is Decimal:\n return result\n else:\n return cls(result)", "metadata": "root.Decimal.from_float", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 669 }, { "content": " def _isnan(self):\n \"\"\"Returns whether the number is not actually one.\n\n 0 if a number\n 1 if NaN\n 2 if sNaN\n \"\"\"\n if self._is_special:\n exp = self._exp\n if exp == 'n':\n return 1\n elif exp == 'N':\n return 2\n return 0", "metadata": "root.Decimal._isnan", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 707 }, { "content": " def _isinfinity(self):\n \"\"\"Returns whether the number is infinite\n\n 0 if finite or not a number\n 1 if +INF\n -1 if -INF\n \"\"\"\n if self._exp == 'F':\n if self._sign:\n return -1\n return 1\n return 0", "metadata": "root.Decimal._isinfinity", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 722 }, { "content": " def _check_nans(self, other=None, context=None):\n \"\"\"Returns whether the number is not actually one.\n\n if self, other are sNaN, signal\n if self, other are NaN return nan\n return 0\n\n Done before operations.\n \"\"\"\n\n self_is_nan = self._isnan()\n if other is None:\n other_is_nan = False\n else:\n other_is_nan = other._isnan()\n\n if self_is_nan or other_is_nan:\n if context is None:\n context = getcontext()\n\n if self_is_nan == 2:\n return context._raise_error(InvalidOperation, 'sNaN',\n self)\n if other_is_nan == 2:\n return context._raise_error(InvalidOperation, 'sNaN',\n other)\n if self_is_nan:\n return self._fix_nan(context)\n\n return other._fix_nan(context)\n return 0", "metadata": "root.Decimal._check_nans", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 735 }, { "content": " def _compare_check_nans(self, other, context):\n \"\"\"Version of _check_nans used for the signaling comparisons\n compare_signal, __le__, __lt__, __ge__, __gt__.\n\n Signal InvalidOperation if either self or other is a (quiet\n or signaling) NaN. Signaling NaNs take precedence over quiet\n NaNs.\n\n Return 0 if neither operand is a NaN.\n\n \"\"\"\n if context is None:\n context = getcontext()\n\n if self._is_special or other._is_special:\n if self.is_snan():\n return context._raise_error(InvalidOperation,\n 'comparison involving sNaN',\n self)\n elif other.is_snan():\n return context._raise_error(InvalidOperation,\n 'comparison involving sNaN',\n other)\n elif self.is_qnan():\n return context._raise_error(InvalidOperation,\n 'comparison involving NaN',\n self)\n elif other.is_qnan():\n return context._raise_error(InvalidOperation,\n 'comparison involving NaN',\n other)\n return 0", "metadata": "root.Decimal._compare_check_nans", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 767 }, { "content": " def __nonzero__(self):\n \"\"\"Return True if self is nonzero; otherwise return False.\n\n NaNs and infinities are considered nonzero.\n \"\"\"\n return self._is_special or self._int != '0'", "metadata": "root.Decimal.__nonzero__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 800 }, { "content": " def _cmp(self, other):\n \"\"\"Compare the two non-NaN decimal instances self and other.\n\n Returns -1 if self < other, 0 if self == other and 1\n if self > other. This routine is for internal use only.\"\"\"\n\n if self._is_special or other._is_special:\n self_inf = self._isinfinity()\n other_inf = other._isinfinity()\n if self_inf == other_inf:\n return 0\n elif self_inf < other_inf:\n return -1\n else:\n return 1\n\n # check for zeros; Decimal('0') == Decimal('-0')\n if not self:\n if not other:\n return 0\n else:\n return -((-1)**other._sign)\n if not other:\n return (-1)**self._sign\n\n # If different signs, neg one is less\n if other._sign < self._sign:\n return -1\n if self._sign < other._sign:\n return 1\n\n self_adjusted = self.adjusted()\n other_adjusted = other.adjusted()\n if self_adjusted == other_adjusted:\n self_padded = self._int + '0'*(self._exp - other._exp)\n other_padded = other._int + '0'*(other._exp - self._exp)\n if self_padded == other_padded:\n return 0\n elif self_padded < other_padded:\n return -(-1)**self._sign\n else:\n return (-1)**self._sign\n elif self_adjusted > other_adjusted:\n return (-1)**self._sign\n else: # self_adjusted < other_adjusted\n return -((-1)**self._sign)", "metadata": "root.Decimal._cmp", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 807 }, { "content": " def __eq__(self, other, context=None):\n other = _convert_other(other, allow_float=True)\n if other is NotImplemented:\n return other\n if self._check_nans(other, context):\n return False\n return self._cmp(other) == 0", "metadata": "root.Decimal.__eq__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 871 }, { "content": " def __ne__(self, other, context=None):\n other = _convert_other(other, allow_float=True)\n if other is NotImplemented:\n return other\n if self._check_nans(other, context):\n return True\n return self._cmp(other) != 0", "metadata": "root.Decimal.__ne__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 879 }, { "content": " def __lt__(self, other, context=None):\n other = _convert_other(other, allow_float=True)\n if other is NotImplemented:\n return other\n ans = self._compare_check_nans(other, context)\n if ans:\n return False\n return self._cmp(other) < 0", "metadata": "root.Decimal.__lt__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 887 }, { "content": " def __le__(self, other, context=None):\n other = _convert_other(other, allow_float=True)\n if other is NotImplemented:\n return other\n ans = self._compare_check_nans(other, context)\n if ans:\n return False\n return self._cmp(other) <= 0", "metadata": "root.Decimal.__le__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 896 }, { "content": " def __gt__(self, other, context=None):\n other = _convert_other(other, allow_float=True)\n if other is NotImplemented:\n return other\n ans = self._compare_check_nans(other, context)\n if ans:\n return False\n return self._cmp(other) > 0", "metadata": "root.Decimal.__gt__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 905 }, { "content": " def __ge__(self, other, context=None):\n other = _convert_other(other, allow_float=True)\n if other is NotImplemented:\n return other\n ans = self._compare_check_nans(other, context)\n if ans:\n return False\n return self._cmp(other) >= 0", "metadata": "root.Decimal.__ge__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 914 }, { "content": " def compare(self, other, context=None):\n \"\"\"Compares one to another.\n\n -1 => a < b\n 0 => a = b\n 1 => a > b\n NaN => one is NaN\n Like __cmp__, but returns Decimal instances.\n \"\"\"\n other = _convert_other(other, raiseit=True)\n\n # Compare(NaN, NaN) = NaN\n if (self._is_special or other and other._is_special):\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n return Decimal(self._cmp(other))", "metadata": "root.Decimal.compare", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 923 }, { "content": " def __hash__(self):\n \"\"\"x.__hash__() <==> hash(x)\"\"\"\n # Decimal integers must hash the same as the ints\n #\n # The hash of a nonspecial noninteger Decimal must depend only\n # on the value of that Decimal, and not on its representation.\n # For example: hash(Decimal('100E-1')) == hash(Decimal('10')).\n\n # Equality comparisons involving signaling nans can raise an\n # exception; since equality checks are implicitly and\n # unpredictably used when checking set and dict membership, we\n # prevent signaling nans from being used as set elements or\n # dict keys by making __hash__ raise an exception.\n if self._is_special:\n if self.is_snan():\n raise TypeError('Cannot hash a signaling NaN value.')\n elif self.is_nan():\n # 0 to match hash(float('nan'))\n return 0\n else:\n # values chosen to match hash(float('inf')) and\n # hash(float('-inf')).\n if self._sign:\n return -271828\n else:\n return 314159\n\n # In Python 2.7, we're allowing comparisons (but not\n # arithmetic operations) between floats and Decimals; so if\n # a Decimal instance is exactly representable as a float then\n # its hash should match that of the float.\n self_as_float = float(self)\n if Decimal.from_float(self_as_float) == self:\n return hash(self_as_float)\n\n if self._isinteger():\n # We do this differently in Jython due to the different maxint.\n return hash(long(self.to_integral_value()))\n # The value of a nonzero nonspecial Decimal instance is\n # faithfully represented by the triple consisting of its sign,\n # its adjusted exponent, and its coefficient with trailing\n # zeros removed.\n return hash((self._sign,\n self._exp+len(self._int),\n self._int.rstrip('0')))", "metadata": "root.Decimal.__hash__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 942 }, { "content": " def as_tuple(self):\n \"\"\"Represents the number as a triple tuple.\n\n To show the internals exactly as they are.\n \"\"\"\n return DecimalTuple(self._sign, tuple(map(int, self._int)), self._exp)", "metadata": "root.Decimal.as_tuple", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 988 }, { "content": " def __repr__(self):\n \"\"\"Represents the number as an instance of Decimal.\"\"\"\n # Invariant: eval(repr(d)) == d\n return \"Decimal('%s')\" % str(self)", "metadata": "root.Decimal.__repr__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 995 }, { "content": " def __str__(self, eng=False, context=None):\n \"\"\"Return string representation of the number in scientific notation.\n\n Captures all of the information in the underlying representation.\n \"\"\"\n\n sign = ['', '-'][self._sign]\n if self._is_special:\n if self._exp == 'F':\n return sign + 'Infinity'\n elif self._exp == 'n':\n return sign + 'NaN' + self._int\n else: # self._exp == 'N'\n return sign + 'sNaN' + self._int\n\n # number of digits of self._int to left of decimal point\n leftdigits = self._exp + len(self._int)\n\n # dotplace is number of digits of self._int to the left of the\n # decimal point in the mantissa of the output string (that is,\n # after adjusting the exponent)\n if self._exp <= 0 and leftdigits > -6:\n # no exponent required\n dotplace = leftdigits\n elif not eng:\n # usual scientific notation: 1 digit on left of the point\n dotplace = 1\n elif self._int == '0':\n # engineering notation, zero\n dotplace = (leftdigits + 1) % 3 - 1\n else:\n # engineering notation, nonzero\n dotplace = (leftdigits - 1) % 3 + 1\n\n if dotplace <= 0:\n intpart = '0'\n fracpart = '.' + '0'*(-dotplace) + self._int\n elif dotplace >= len(self._int):\n intpart = self._int+'0'*(dotplace-len(self._int))\n fracpart = ''\n else:\n intpart = self._int[:dotplace]\n fracpart = '.' + self._int[dotplace:]\n if leftdigits == dotplace:\n exp = ''\n else:\n if context is None:\n context = getcontext()\n exp = ['e', 'E'][context.capitals] + \"%+d\" % (leftdigits-dotplace)\n\n return sign + intpart + fracpart + exp", "metadata": "root.Decimal.__str__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1000 }, { "content": " def to_eng_string(self, context=None):\n \"\"\"Convert to engineering-type string.\n\n Engineering notation has an exponent which is a multiple of 3, so there\n are up to 3 digits left of the decimal place.\n\n Same rules for when in exponential and when as a value as in __str__.\n \"\"\"\n return self.__str__(eng=True, context=context)", "metadata": "root.Decimal.to_eng_string", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1052 }, { "content": " def __neg__(self, context=None):\n \"\"\"Returns a copy with the sign switched.\n\n Rounds, if it has reason.\n \"\"\"\n if self._is_special:\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n if not self:\n # -Decimal('0') is Decimal('0'), not Decimal('-0')\n ans = self.copy_abs()\n else:\n ans = self.copy_negate()\n\n if context is None:\n context = getcontext()\n return ans._fix(context)", "metadata": "root.Decimal.__neg__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1062 }, { "content": " def __pos__(self, context=None):\n \"\"\"Returns a copy, unless it is a sNaN.\n\n Rounds the number (if more then precision digits)\n \"\"\"\n if self._is_special:\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n if not self:\n # + (-0) = 0\n ans = self.copy_abs()\n else:\n ans = Decimal(self)\n\n if context is None:\n context = getcontext()\n return ans._fix(context)", "metadata": "root.Decimal.__pos__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1082 }, { "content": " def __abs__(self, round=True, context=None):\n \"\"\"Returns the absolute value of self.\n\n If the keyword argument 'round' is false, do not round. The\n expression self.__abs__(round=False) is equivalent to\n self.copy_abs().\n \"\"\"\n if not round:\n return self.copy_abs()\n\n if self._is_special:\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n if self._sign:\n ans = self.__neg__(context=context)\n else:\n ans = self.__pos__(context=context)\n\n return ans", "metadata": "root.Decimal.__abs__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1102 }, { "content": " def __add__(self, other, context=None):\n \"\"\"Returns self + other.\n\n -INF + INF (or the reverse) cause InvalidOperation errors.\n \"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n\n if context is None:\n context = getcontext()\n\n if self._is_special or other._is_special:\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n if self._isinfinity():\n # If both INF, same sign => same as both, opposite => error.\n if self._sign != other._sign and other._isinfinity():\n return context._raise_error(InvalidOperation, '-INF + INF')\n return Decimal(self)\n if other._isinfinity():\n return Decimal(other) # Can't both be infinity here\n\n exp = min(self._exp, other._exp)\n negativezero = 0\n if context.rounding == ROUND_FLOOR and self._sign != other._sign:\n # If the answer is 0, the sign should be negative, in this case.\n negativezero = 1\n\n if not self and not other:\n sign = min(self._sign, other._sign)\n if negativezero:\n sign = 1\n ans = _dec_from_triple(sign, '0', exp)\n ans = ans._fix(context)\n return ans\n if not self:\n exp = max(exp, other._exp - context.prec-1)\n ans = other._rescale(exp, context.rounding)\n ans = ans._fix(context)\n return ans\n if not other:\n exp = max(exp, self._exp - context.prec-1)\n ans = self._rescale(exp, context.rounding)\n ans = ans._fix(context)\n return ans\n\n op1 = _WorkRep(self)\n op2 = _WorkRep(other)\n op1, op2 = _normalize(op1, op2, context.prec)\n\n result = _WorkRep()\n if op1.sign != op2.sign:\n # Equal and opposite\n if op1.int == op2.int:\n ans = _dec_from_triple(negativezero, '0', exp)\n ans = ans._fix(context)\n return ans\n if op1.int < op2.int:\n op1, op2 = op2, op1\n # OK, now abs(op1) > abs(op2)\n if op1.sign == 1:\n result.sign = 1\n op1.sign, op2.sign = op2.sign, op1.sign\n else:\n result.sign = 0\n # So we know the sign, and op1 > 0.\n elif op1.sign == 1:\n result.sign = 1\n op1.sign, op2.sign = (0, 0)\n else:\n result.sign = 0\n # Now, op1 > abs(op2) > 0\n\n if op2.sign == 0:\n result.int = op1.int + op2.int\n else:\n result.int = op1.int - op2.int\n\n result.exp = op1.exp\n ans = Decimal(result)\n ans = ans._fix(context)\n return ans", "metadata": "root.Decimal.__add__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1124 }, { "content": " def __sub__(self, other, context=None):\n \"\"\"Return self - other\"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n\n if self._is_special or other._is_special:\n ans = self._check_nans(other, context=context)\n if ans:\n return ans\n\n # self - other is computed as self + other.copy_negate()\n return self.__add__(other.copy_negate(), context=context)", "metadata": "root.Decimal.__sub__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1212 }, { "content": " def __rsub__(self, other, context=None):\n \"\"\"Return other - self\"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n\n return other.__sub__(self, context=context)", "metadata": "root.Decimal.__rsub__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1226 }, { "content": " def __mul__(self, other, context=None):\n \"\"\"Return self * other.\n\n (+-) INF * 0 (or its reverse) raise InvalidOperation.\n \"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n\n if context is None:\n context = getcontext()\n\n resultsign = self._sign ^ other._sign\n\n if self._is_special or other._is_special:\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n if self._isinfinity():\n if not other:\n return context._raise_error(InvalidOperation, '(+-)INF * 0')\n return _SignedInfinity[resultsign]\n\n if other._isinfinity():\n if not self:\n return context._raise_error(InvalidOperation, '0 * (+-)INF')\n return _SignedInfinity[resultsign]\n\n resultexp = self._exp + other._exp\n\n # Special case for multiplying by zero\n if not self or not other:\n ans = _dec_from_triple(resultsign, '0', resultexp)\n # Fixing in case the exponent is out of bounds\n ans = ans._fix(context)\n return ans\n\n # Special case for multiplying by power of 10\n if self._int == '1':\n ans = _dec_from_triple(resultsign, other._int, resultexp)\n ans = ans._fix(context)\n return ans\n if other._int == '1':\n ans = _dec_from_triple(resultsign, self._int, resultexp)\n ans = ans._fix(context)\n return ans\n\n op1 = _WorkRep(self)\n op2 = _WorkRep(other)\n\n ans = _dec_from_triple(resultsign, str(op1.int * op2.int), resultexp)\n ans = ans._fix(context)\n\n return ans", "metadata": "root.Decimal.__mul__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1234 }, { "content": " def __truediv__(self, other, context=None):\n \"\"\"Return self / other.\"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return NotImplemented\n\n if context is None:\n context = getcontext()\n\n sign = self._sign ^ other._sign\n\n if self._is_special or other._is_special:\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n if self._isinfinity() and other._isinfinity():\n return context._raise_error(InvalidOperation, '(+-)INF/(+-)INF')\n\n if self._isinfinity():\n return _SignedInfinity[sign]\n\n if other._isinfinity():\n context._raise_error(Clamped, 'Division by infinity')\n return _dec_from_triple(sign, '0', context.Etiny())\n\n # Special cases for zeroes\n if not other:\n if not self:\n return context._raise_error(DivisionUndefined, '0 / 0')\n return context._raise_error(DivisionByZero, 'x / 0', sign)\n\n if not self:\n exp = self._exp - other._exp\n coeff = 0\n else:\n # OK, so neither = 0, INF or NaN\n shift = len(other._int) - len(self._int) + context.prec + 1\n exp = self._exp - other._exp - shift\n op1 = _WorkRep(self)\n op2 = _WorkRep(other)\n if shift >= 0:\n coeff, remainder = divmod(op1.int * 10**shift, op2.int)\n else:\n coeff, remainder = divmod(op1.int, op2.int * 10**-shift)\n if remainder:\n # result is not exact; adjust to ensure correct rounding\n if coeff % 5 == 0:\n coeff += 1\n else:\n # result is exact; get as close to ideal exponent as possible\n ideal_exp = self._exp - other._exp\n while exp < ideal_exp and coeff % 10 == 0:\n coeff //= 10\n exp += 1\n\n ans = _dec_from_triple(sign, str(coeff), exp)\n return ans._fix(context)", "metadata": "root.Decimal.__truediv__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1291 }, { "content": " def _divide(self, other, context):\n \"\"\"Return (self // other, self % other), to context.prec precision.\n\n Assumes that neither self nor other is a NaN, that self is not\n infinite and that other is nonzero.\n \"\"\"\n sign = self._sign ^ other._sign\n if other._isinfinity():\n ideal_exp = self._exp\n else:\n ideal_exp = min(self._exp, other._exp)\n\n expdiff = self.adjusted() - other.adjusted()\n if not self or other._isinfinity() or expdiff <= -2:\n return (_dec_from_triple(sign, '0', 0),\n self._rescale(ideal_exp, context.rounding))\n if expdiff <= context.prec:\n op1 = _WorkRep(self)\n op2 = _WorkRep(other)\n if op1.exp >= op2.exp:\n op1.int *= 10**(op1.exp - op2.exp)\n else:\n op2.int *= 10**(op2.exp - op1.exp)\n q, r = divmod(op1.int, op2.int)\n if q < 10**context.prec:\n return (_dec_from_triple(sign, str(q), 0),\n _dec_from_triple(self._sign, str(r), ideal_exp))\n\n # Here the quotient is too large to be representable\n ans = context._raise_error(DivisionImpossible,\n 'quotient too large in //, % or divmod')\n return ans, ans", "metadata": "root.Decimal._divide", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1350 }, { "content": " def __rtruediv__(self, other, context=None):\n \"\"\"Swaps self/other and returns __truediv__.\"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n return other.__truediv__(self, context=context)", "metadata": "root.Decimal.__rtruediv__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1383 }, { "content": " def __divmod__(self, other, context=None):\n \"\"\"\n Return (self // other, self % other)\n \"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n\n if context is None:\n context = getcontext()\n\n ans = self._check_nans(other, context)\n if ans:\n return (ans, ans)\n\n sign = self._sign ^ other._sign\n if self._isinfinity():\n if other._isinfinity():\n ans = context._raise_error(InvalidOperation, 'divmod(INF, INF)')\n return ans, ans\n else:\n return (_SignedInfinity[sign],\n context._raise_error(InvalidOperation, 'INF % x'))\n\n if not other:\n if not self:\n ans = context._raise_error(DivisionUndefined, 'divmod(0, 0)')\n return ans, ans\n else:\n return (context._raise_error(DivisionByZero, 'x // 0', sign),\n context._raise_error(InvalidOperation, 'x % 0'))\n\n quotient, remainder = self._divide(other, context)\n remainder = remainder._fix(context)\n return quotient, remainder", "metadata": "root.Decimal.__divmod__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1393 }, { "content": " def __rdivmod__(self, other, context=None):\n \"\"\"Swaps self/other and returns __divmod__.\"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n return other.__divmod__(self, context=context)", "metadata": "root.Decimal.__rdivmod__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1429 }, { "content": " def __mod__(self, other, context=None):\n \"\"\"\n self % other\n \"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n\n if context is None:\n context = getcontext()\n\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n if self._isinfinity():\n return context._raise_error(InvalidOperation, 'INF % x')\n elif not other:\n if self:\n return context._raise_error(InvalidOperation, 'x % 0')\n else:\n return context._raise_error(DivisionUndefined, '0 % 0')\n\n remainder = self._divide(other, context)[1]\n remainder = remainder._fix(context)\n return remainder", "metadata": "root.Decimal.__mod__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1436 }, { "content": " def __rmod__(self, other, context=None):\n \"\"\"Swaps self/other and returns __mod__.\"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n return other.__mod__(self, context=context)", "metadata": "root.Decimal.__rmod__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1463 }, { "content": " def remainder_near(self, other, context=None):\n \"\"\"\n Remainder nearest to 0- abs(remainder-near) <= other/2\n \"\"\"\n if context is None:\n context = getcontext()\n\n other = _convert_other(other, raiseit=True)\n\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n # self == +/-infinity -> InvalidOperation\n if self._isinfinity():\n return context._raise_error(InvalidOperation,\n 'remainder_near(infinity, x)')\n\n # other == 0 -> either InvalidOperation or DivisionUndefined\n if not other:\n if self:\n return context._raise_error(InvalidOperation,\n 'remainder_near(x, 0)')\n else:\n return context._raise_error(DivisionUndefined,\n 'remainder_near(0, 0)')\n\n # other = +/-infinity -> remainder = self\n if other._isinfinity():\n ans = Decimal(self)\n return ans._fix(context)\n\n # self = 0 -> remainder = self, with ideal exponent\n ideal_exponent = min(self._exp, other._exp)\n if not self:\n ans = _dec_from_triple(self._sign, '0', ideal_exponent)\n return ans._fix(context)\n\n # catch most cases of large or small quotient\n expdiff = self.adjusted() - other.adjusted()\n if expdiff >= context.prec + 1:\n # expdiff >= prec+1 => abs(self/other) > 10**prec\n return context._raise_error(DivisionImpossible)\n if expdiff <= -2:\n # expdiff <= -2 => abs(self/other) < 0.1\n ans = self._rescale(ideal_exponent, context.rounding)\n return ans._fix(context)\n\n # adjust both arguments to have the same exponent, then divide\n op1 = _WorkRep(self)\n op2 = _WorkRep(other)\n if op1.exp >= op2.exp:\n op1.int *= 10**(op1.exp - op2.exp)\n else:\n op2.int *= 10**(op2.exp - op1.exp)\n q, r = divmod(op1.int, op2.int)\n # remainder is r*10**ideal_exponent; other is +/-op2.int *\n # 10**ideal_exponent. Apply correction to ensure that\n # abs(remainder) <= abs(other)/2\n if 2*r + (q&1) > op2.int:\n r -= op2.int\n q += 1\n\n if q >= 10**context.prec:\n return context._raise_error(DivisionImpossible)\n\n # result has same sign as self unless r is negative\n sign = self._sign\n if r < 0:\n sign = 1-sign\n r = -r\n\n ans = _dec_from_triple(sign, str(r), ideal_exponent)\n return ans._fix(context)", "metadata": "root.Decimal.remainder_near", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1470 }, { "content": " def __floordiv__(self, other, context=None):\n \"\"\"self // other\"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n\n if context is None:\n context = getcontext()\n\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n if self._isinfinity():\n if other._isinfinity():\n return context._raise_error(InvalidOperation, 'INF // INF')\n else:\n return _SignedInfinity[self._sign ^ other._sign]\n\n if not other:\n if self:\n return context._raise_error(DivisionByZero, 'x // 0',\n self._sign ^ other._sign)\n else:\n return context._raise_error(DivisionUndefined, '0 // 0')\n\n return self._divide(other, context)[0]", "metadata": "root.Decimal.__floordiv__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1545 }, { "content": " def __rfloordiv__(self, other, context=None):\n \"\"\"Swaps self/other and returns __floordiv__.\"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n return other.__floordiv__(self, context=context)", "metadata": "root.Decimal.__rfloordiv__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1573 }, { "content": " def __float__(self):\n \"\"\"Float representation.\"\"\"\n return float(str(self))", "metadata": "root.Decimal.__float__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1580 }, { "content": " def __int__(self):\n \"\"\"Converts self to an int, truncating if necessary.\"\"\"\n if self._is_special:\n if self._isnan():\n raise ValueError(\"Cannot convert NaN to integer\")\n elif self._isinfinity():\n raise OverflowError(\"Cannot convert infinity to integer\")\n s = (-1)**self._sign\n if self._exp >= 0:\n return s*int(self._int)*10**self._exp\n else:\n return s*int(self._int[:self._exp] or '0')", "metadata": "root.Decimal.__int__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1584 }, { "content": " def real(self):\n return self", "metadata": "root.Decimal.real", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1599 }, { "content": " def imag(self):\n return Decimal(0)", "metadata": "root.Decimal.imag", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1603 }, { "content": " def conjugate(self):\n return self", "metadata": "root.Decimal.conjugate", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1607 }, { "content": " def __complex__(self):\n return complex(float(self))", "metadata": "root.Decimal.__complex__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1610 }, { "content": " def __long__(self):\n \"\"\"Converts to a long.\n\n Equivalent to long(int(self))\n \"\"\"\n return long(self.__int__())", "metadata": "root.Decimal.__long__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1613 }, { "content": " def _fix_nan(self, context):\n \"\"\"Decapitate the payload of a NaN to fit the context\"\"\"\n payload = self._int\n\n # maximum length of payload is precision if _clamp=0,\n # precision-1 if _clamp=1.\n max_payload_len = context.prec - context._clamp\n if len(payload) > max_payload_len:\n payload = payload[len(payload)-max_payload_len:].lstrip('0')\n return _dec_from_triple(self._sign, payload, self._exp, True)\n return Decimal(self)", "metadata": "root.Decimal._fix_nan", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1620 }, { "content": " def _fix(self, context):\n \"\"\"Round if it is necessary to keep self within prec precision.\n\n Rounds and fixes the exponent. Does not raise on a sNaN.\n\n Arguments:\n self - Decimal instance\n context - context used.\n \"\"\"\n\n if self._is_special:\n if self._isnan():\n # decapitate payload if necessary\n return self._fix_nan(context)\n else:\n # self is +/-Infinity; return unaltered\n return Decimal(self)\n\n # if self is zero then exponent should be between Etiny and\n # Emax if _clamp==0, and between Etiny and Etop if _clamp==1.\n Etiny = context.Etiny()\n Etop = context.Etop()\n if not self:\n exp_max = [context.Emax, Etop][context._clamp]\n new_exp = min(max(self._exp, Etiny), exp_max)\n if new_exp != self._exp:\n context._raise_error(Clamped)\n return _dec_from_triple(self._sign, '0', new_exp)\n else:\n return Decimal(self)\n\n # exp_min is the smallest allowable exponent of the result,\n # equal to max(self.adjusted()-context.prec+1, Etiny)\n exp_min = len(self._int) + self._exp - context.prec\n if exp_min > Etop:\n # overflow: exp_min > Etop iff self.adjusted() > Emax\n ans = context._raise_error(Overflow, 'above Emax', self._sign)\n context._raise_error(Inexact)\n context._raise_error(Rounded)\n return ans\n\n self_is_subnormal = exp_min < Etiny\n if self_is_subnormal:\n exp_min = Etiny\n\n # round if self has too many digits\n if self._exp < exp_min:\n digits = len(self._int) + self._exp - exp_min\n if digits < 0:\n self = _dec_from_triple(self._sign, '1', exp_min-1)\n digits = 0\n rounding_method = self._pick_rounding_function[context.rounding]\n changed = getattr(self, rounding_method)(digits)\n coeff = self._int[:digits] or '0'\n if changed > 0:\n coeff = str(int(coeff)+1)\n if len(coeff) > context.prec:\n coeff = coeff[:-1]\n exp_min += 1\n\n # check whether the rounding pushed the exponent out of range\n if exp_min > Etop:\n ans = context._raise_error(Overflow, 'above Emax', self._sign)\n else:\n ans = _dec_from_triple(self._sign, coeff, exp_min)\n\n # raise the appropriate signals, taking care to respect\n # the precedence described in the specification\n if changed and self_is_subnormal:\n context._raise_error(Underflow)\n if self_is_subnormal:\n context._raise_error(Subnormal)\n if changed:\n context._raise_error(Inexact)\n context._raise_error(Rounded)\n if not ans:\n # raise Clamped on underflow to 0\n context._raise_error(Clamped)\n return ans\n\n if self_is_subnormal:\n context._raise_error(Subnormal)\n\n # fold down if _clamp == 1 and self has too few digits\n if context._clamp == 1 and self._exp > Etop:\n context._raise_error(Clamped)\n self_padded = self._int + '0'*(self._exp - Etop)\n return _dec_from_triple(self._sign, self_padded, Etop)\n\n # here self was representable to begin with; return unchanged\n return Decimal(self)", "metadata": "root.Decimal._fix", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1632 }, { "content": " def _round_down(self, prec):\n \"\"\"Also known as round-towards-0, truncate.\"\"\"\n if _all_zeros(self._int, prec):\n return 0\n else:\n return -1", "metadata": "root.Decimal._round_down", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1736 }, { "content": " def _round_up(self, prec):\n \"\"\"Rounds away from 0.\"\"\"\n return -self._round_down(prec)", "metadata": "root.Decimal._round_up", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1743 }, { "content": " def _round_half_up(self, prec):\n \"\"\"Rounds 5 up (away from 0)\"\"\"\n if self._int[prec] in '56789':\n return 1\n elif _all_zeros(self._int, prec):\n return 0\n else:\n return -1", "metadata": "root.Decimal._round_half_up", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1747 }, { "content": " def _round_half_down(self, prec):\n \"\"\"Round 5 down\"\"\"\n if _exact_half(self._int, prec):\n return -1\n else:\n return self._round_half_up(prec)", "metadata": "root.Decimal._round_half_down", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1756 }, { "content": " def _round_half_even(self, prec):\n \"\"\"Round 5 to even, rest to nearest.\"\"\"\n if _exact_half(self._int, prec) and \\\n (prec == 0 or self._int[prec-1] in '02468'):\n return -1\n else:\n return self._round_half_up(prec)", "metadata": "root.Decimal._round_half_even", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1763 }, { "content": " def _round_ceiling(self, prec):\n \"\"\"Rounds up (not away from 0 if negative.)\"\"\"\n if self._sign:\n return self._round_down(prec)\n else:\n return -self._round_down(prec)", "metadata": "root.Decimal._round_ceiling", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1771 }, { "content": " def _round_floor(self, prec):\n \"\"\"Rounds down (not towards 0 if negative)\"\"\"\n if not self._sign:\n return self._round_down(prec)\n else:\n return -self._round_down(prec)", "metadata": "root.Decimal._round_floor", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1778 }, { "content": " def _round_05up(self, prec):\n \"\"\"Round down unless digit prec-1 is 0 or 5.\"\"\"\n if prec and self._int[prec-1] not in '05':\n return self._round_down(prec)\n else:\n return -self._round_down(prec)", "metadata": "root.Decimal._round_05up", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1785 }, { "content": " def fma(self, other, third, context=None):\n \"\"\"Fused multiply-add.\n\n Returns self*other+third with no rounding of the intermediate\n product self*other.\n\n self and other are multiplied together, with no rounding of\n the result. The third operand is then added to the result,\n and a single final rounding is performed.\n \"\"\"\n\n other = _convert_other(other, raiseit=True)\n\n # compute product; raise InvalidOperation if either operand is\n # a signaling NaN or if the product is zero times infinity.\n if self._is_special or other._is_special:\n if context is None:\n context = getcontext()\n if self._exp == 'N':\n return context._raise_error(InvalidOperation, 'sNaN', self)\n if other._exp == 'N':\n return context._raise_error(InvalidOperation, 'sNaN', other)\n if self._exp == 'n':\n product = self\n elif other._exp == 'n':\n product = other\n elif self._exp == 'F':\n if not other:\n return context._raise_error(InvalidOperation,\n 'INF * 0 in fma')\n product = _SignedInfinity[self._sign ^ other._sign]\n elif other._exp == 'F':\n if not self:\n return context._raise_error(InvalidOperation,\n '0 * INF in fma')\n product = _SignedInfinity[self._sign ^ other._sign]\n else:\n product = _dec_from_triple(self._sign ^ other._sign,\n str(int(self._int) * int(other._int)),\n self._exp + other._exp)\n\n third = _convert_other(third, raiseit=True)\n return product.__add__(third, context)", "metadata": "root.Decimal.fma", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1792 }, { "content": " def _power_modulo(self, other, modulo, context=None):\n \"\"\"Three argument version of __pow__\"\"\"\n\n # if can't convert other and modulo to Decimal, raise\n # TypeError; there's no point returning NotImplemented (no\n # equivalent of __rpow__ for three argument pow)\n other = _convert_other(other, raiseit=True)\n modulo = _convert_other(modulo, raiseit=True)\n\n if context is None:\n context = getcontext()\n\n # deal with NaNs: if there are any sNaNs then first one wins,\n # (i.e. behaviour for NaNs is identical to that of fma)\n self_is_nan = self._isnan()\n other_is_nan = other._isnan()\n modulo_is_nan = modulo._isnan()\n if self_is_nan or other_is_nan or modulo_is_nan:\n if self_is_nan == 2:\n return context._raise_error(InvalidOperation, 'sNaN',\n self)\n if other_is_nan == 2:\n return context._raise_error(InvalidOperation, 'sNaN',\n other)\n if modulo_is_nan == 2:\n return context._raise_error(InvalidOperation, 'sNaN',\n modulo)\n if self_is_nan:\n return self._fix_nan(context)\n if other_is_nan:\n return other._fix_nan(context)\n return modulo._fix_nan(context)\n\n # check inputs: we apply same restrictions as Python's pow()\n if not (self._isinteger() and\n other._isinteger() and\n modulo._isinteger()):\n return context._raise_error(InvalidOperation,\n 'pow() 3rd argument not allowed '\n 'unless all arguments are integers')\n if other < 0:\n return context._raise_error(InvalidOperation,\n 'pow() 2nd argument cannot be '\n 'negative when 3rd argument specified')\n if not modulo:\n return context._raise_error(InvalidOperation,\n 'pow() 3rd argument cannot be 0')\n\n # additional restriction for decimal: the modulus must be less\n # than 10**prec in absolute value\n if modulo.adjusted() >= context.prec:\n return context._raise_error(InvalidOperation,\n 'insufficient precision: pow() 3rd '\n 'argument must not have more than '\n 'precision digits')\n\n # define 0**0 == NaN, for consistency with two-argument pow\n # (even though it hurts!)\n if not other and not self:\n return context._raise_error(InvalidOperation,\n 'at least one of pow() 1st argument '\n 'and 2nd argument must be nonzero ;'\n '0**0 is not defined')\n\n # compute sign of result\n if other._iseven():\n sign = 0\n else:\n sign = self._sign\n\n # convert modulo to a Python integer, and self and other to\n # Decimal integers (i.e. force their exponents to be >= 0)\n modulo = abs(int(modulo))\n base = _WorkRep(self.to_integral_value())\n exponent = _WorkRep(other.to_integral_value())\n\n # compute result using integer pow()\n base = (base.int % modulo * pow(10, base.exp, modulo)) % modulo\n for i in xrange(exponent.exp):\n base = pow(base, 10, modulo)\n base = pow(base, exponent.int, modulo)\n\n return _dec_from_triple(sign, str(base), 0)", "metadata": "root.Decimal._power_modulo", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1836 }, { "content": " def _power_exact(self, other, p):\n \"\"\"Attempt to compute self**other exactly.\n\n Given Decimals self and other and an integer p, attempt to\n compute an exact result for the power self**other, with p\n digits of precision. Return None if self**other is not\n exactly representable in p digits.\n\n Assumes that elimination of special cases has already been\n performed: self and other must both be nonspecial; self must\n be positive and not numerically equal to 1; other must be\n nonzero. For efficiency, other._exp should not be too large,\n so that 10**abs(other._exp) is a feasible calculation.\"\"\"\n\n # In the comments below, we write x for the value of self and\n # y for the value of other. Write x = xc*10**xe and y =\n # yc*10**ye.\n\n # The main purpose of this method is to identify the *failure*\n # of x**y to be exactly representable with as little effort as\n # possible. So we look for cheap and easy tests that\n # eliminate the possibility of x**y being exact. Only if all\n # these tests are passed do we go on to actually compute x**y.\n\n # Here's the main idea. First normalize both x and y. We\n # express y as a rational m/n, with m and n relatively prime\n # and n>0. Then for x**y to be exactly representable (at\n # *any* precision), xc must be the nth power of a positive\n # integer and xe must be divisible by n. If m is negative\n # then additionally xc must be a power of either 2 or 5, hence\n # a power of 2**n or 5**n.\n #\n # There's a limit to how small |y| can be: if y=m/n as above\n # then:\n #\n # (1) if xc != 1 then for the result to be representable we\n # need xc**(1/n) >= 2, and hence also xc**|y| >= 2. So\n # if |y| <= 1/nbits(xc) then xc < 2**nbits(xc) <=\n # 2**(1/|y|), hence xc**|y| < 2 and the result is not\n # representable.\n #\n # (2) if xe != 0, |xe|*(1/n) >= 1, so |xe|*|y| >= 1. Hence if\n # |y| < 1/|xe| then the result is not representable.\n #\n # Note that since x is not equal to 1, at least one of (1) and\n # (2) must apply. Now |y| < 1/nbits(xc) iff |yc|*nbits(xc) <\n # 10**-ye iff len(str(|yc|*nbits(xc)) <= -ye.\n #\n # There's also a limit to how large y can be, at least if it's\n # positive: the normalized result will have coefficient xc**y,\n # so if it's representable then xc**y < 10**p, and y <\n # p/log10(xc). Hence if y*log10(xc) >= p then the result is\n # not exactly representable.\n\n # if len(str(abs(yc*xe)) <= -ye then abs(yc*xe) < 10**-ye,\n # so |y| < 1/xe and the result is not representable.\n # Similarly, len(str(abs(yc)*xc_bits)) <= -ye implies |y|\n # < 1/nbits(xc).\n\n x = _WorkRep(self)\n xc, xe = x.int, x.exp\n while xc % 10 == 0:\n xc //= 10\n xe += 1\n\n y = _WorkRep(other)\n yc, ye = y.int, y.exp\n while yc % 10 == 0:\n yc //= 10\n ye += 1\n\n # case where xc == 1: result is 10**(xe*y), with xe*y\n # required to be an integer\n if xc == 1:\n xe *= yc\n # result is now 10**(xe * 10**ye); xe * 10**ye must be integral\n while xe % 10 == 0:\n xe //= 10\n ye += 1\n if ye < 0:\n return None\n exponent = xe * 10**ye\n if y.sign == 1:\n exponent = -exponent\n # if other is a nonnegative integer, use ideal exponent\n if other._isinteger() and other._sign == 0:\n ideal_exponent = self._exp*int(other)\n zeros = min(exponent-ideal_exponent, p-1)\n else:\n zeros = 0\n return _dec_from_triple(0, '1' + '0'*zeros, exponent-zeros)\n\n # case where y is negative: xc must be either a power\n # of 2 or a power of 5.\n if y.sign == 1:\n last_digit = xc % 10\n if last_digit in (2,4,6,8):\n # quick test for power of 2\n if xc & -xc != xc:\n return None\n # now xc is a power of 2; e is its exponent\n e = _nbits(xc)-1\n # find e*y and xe*y; both must be integers\n if ye >= 0:\n y_as_int = yc*10**ye\n e = e*y_as_int\n xe = xe*y_as_int\n else:\n ten_pow = 10**-ye\n e, remainder = divmod(e*yc, ten_pow)\n if remainder:\n return None\n xe, remainder = divmod(xe*yc, ten_pow)\n if remainder:\n return None\n\n if e*65 >= p*93: # 93/65 > log(10)/log(5)\n return None\n xc = 5**e\n\n elif last_digit == 5:\n # e >= log_5(xc) if xc is a power of 5; we have\n # equality all the way up to xc=5**2658\n e = _nbits(xc)*28//65\n xc, remainder = divmod(5**e, xc)\n if remainder:\n return None\n while xc % 5 == 0:\n xc //= 5\n e -= 1\n if ye >= 0:\n y_as_integer = yc*10**ye\n e = e*y_as_integer\n xe = xe*y_as_integer\n else:\n ten_pow = 10**-ye\n e, remainder = divmod(e*yc, ten_pow)\n if remainder:\n return None\n xe, remainder = divmod(xe*yc, ten_pow)\n if remainder:\n return None\n if e*3 >= p*10: # 10/3 > log(10)/log(2)\n return None\n xc = 2**e\n else:\n return None\n\n if xc >= 10**p:\n return None\n xe = -e-xe\n return _dec_from_triple(0, str(xc), xe)\n\n # now y is positive; find m and n such that y = m/n\n if ye >= 0:\n m, n = yc*10**ye, 1\n else:\n if xe != 0 and len(str(abs(yc*xe))) <= -ye:\n return None\n xc_bits = _nbits(xc)\n if xc != 1 and len(str(abs(yc)*xc_bits)) <= -ye:\n return None\n m, n = yc, 10**(-ye)\n while m % 2 == n % 2 == 0:\n m //= 2\n n //= 2\n while m % 5 == n % 5 == 0:\n m //= 5\n n //= 5\n\n # compute nth root of xc*10**xe\n if n > 1:\n # if 1 < xc < 2**n then xc isn't an nth power\n if xc != 1 and xc_bits <= n:\n return None\n\n xe, rem = divmod(xe, n)\n if rem != 0:\n return None\n\n # compute nth root of xc using Newton's method\n a = 1L << -(-_nbits(xc)//n) # initial estimate\n while True:\n q, r = divmod(xc, a**(n-1))\n if a <= q:\n break\n else:\n a = (a*(n-1) + q)//n\n if not (a == q and r == 0):\n return None\n xc = a\n\n # now xc*10**xe is the nth root of the original xc*10**xe\n # compute mth power of xc*10**xe\n\n # if m > p*100//_log10_lb(xc) then m > p/log10(xc), hence xc**m >\n # 10**p and the result is not representable.\n if xc > 1 and m > p*100//_log10_lb(xc):\n return None\n xc = xc**m\n xe *= m\n if xc > 10**p:\n return None\n\n # by this point the result *is* exactly representable\n # adjust the exponent to get as close as possible to the ideal\n # exponent, if necessary\n str_xc = str(xc)\n if other._isinteger() and other._sign == 0:\n ideal_exponent = self._exp*int(other)\n zeros = min(xe-ideal_exponent, p-len(str_xc))\n else:\n zeros = 0\n return _dec_from_triple(0, str_xc+'0'*zeros, xe-zeros)", "metadata": "root.Decimal._power_exact", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 1920 }, { "content": " def __pow__(self, other, modulo=None, context=None):\n \"\"\"Return self ** other [ % modulo].\n\n With two arguments, compute self**other.\n\n With three arguments, compute (self**other) % modulo. For the\n three argument form, the following restrictions on the\n arguments hold:\n\n - all three arguments must be integral\n - other must be nonnegative\n - either self or other (or both) must be nonzero\n - modulo must be nonzero and must have at most p digits,\n where p is the context precision.\n\n If any of these restrictions is violated the InvalidOperation\n flag is raised.\n\n The result of pow(self, other, modulo) is identical to the\n result that would be obtained by computing (self**other) %\n modulo with unbounded precision, but is computed more\n efficiently. It is always exact.\n \"\"\"\n\n if modulo is not None:\n return self._power_modulo(other, modulo, context)\n\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n\n if context is None:\n context = getcontext()\n\n # either argument is a NaN => result is NaN\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n # 0**0 = NaN (!), x**0 = 1 for nonzero x (including +/-Infinity)\n if not other:\n if not self:\n return context._raise_error(InvalidOperation, '0 ** 0')\n else:\n return _One\n\n # result has sign 1 iff self._sign is 1 and other is an odd integer\n result_sign = 0\n if self._sign == 1:\n if other._isinteger():\n if not other._iseven():\n result_sign = 1\n else:\n # -ve**noninteger = NaN\n # (-0)**noninteger = 0**noninteger\n if self:\n return context._raise_error(InvalidOperation,\n 'x ** y with x negative and y not an integer')\n # negate self, without doing any unwanted rounding\n self = self.copy_negate()\n\n # 0**(+ve or Inf)= 0; 0**(-ve or -Inf) = Infinity\n if not self:\n if other._sign == 0:\n return _dec_from_triple(result_sign, '0', 0)\n else:\n return _SignedInfinity[result_sign]\n\n # Inf**(+ve or Inf) = Inf; Inf**(-ve or -Inf) = 0\n if self._isinfinity():\n if other._sign == 0:\n return _SignedInfinity[result_sign]\n else:\n return _dec_from_triple(result_sign, '0', 0)\n\n # 1**other = 1, but the choice of exponent and the flags\n # depend on the exponent of self, and on whether other is a\n # positive integer, a negative integer, or neither\n if self == _One:\n if other._isinteger():\n # exp = max(self._exp*max(int(other), 0),\n # 1-context.prec) but evaluating int(other) directly\n # is dangerous until we know other is small (other\n # could be 1e999999999)\n if other._sign == 1:\n multiplier = 0\n elif other > context.prec:\n multiplier = context.prec\n else:\n multiplier = int(other)\n\n exp = self._exp * multiplier\n if exp < 1-context.prec:\n exp = 1-context.prec\n context._raise_error(Rounded)\n else:\n context._raise_error(Inexact)\n context._raise_error(Rounded)\n exp = 1-context.prec\n\n return _dec_from_triple(result_sign, '1'+'0'*-exp, exp)\n\n # compute adjusted exponent of self\n self_adj = self.adjusted()\n\n # self ** infinity is infinity if self > 1, 0 if self < 1\n # self ** -infinity is infinity if self < 1, 0 if self > 1\n if other._isinfinity():\n if (other._sign == 0) == (self_adj < 0):\n return _dec_from_triple(result_sign, '0', 0)\n else:\n return _SignedInfinity[result_sign]\n\n # from here on, the result always goes through the call\n # to _fix at the end of this function.\n ans = None\n exact = False\n\n # crude test to catch cases of extreme overflow/underflow. If\n # log10(self)*other >= 10**bound and bound >= len(str(Emax))\n # then 10**bound >= 10**len(str(Emax)) >= Emax+1 and hence\n # self**other >= 10**(Emax+1), so overflow occurs. The test\n # for underflow is similar.\n bound = self._log10_exp_bound() + other.adjusted()\n if (self_adj >= 0) == (other._sign == 0):\n # self > 1 and other +ve, or self < 1 and other -ve\n # possibility of overflow\n if bound >= len(str(context.Emax)):\n ans = _dec_from_triple(result_sign, '1', context.Emax+1)\n else:\n # self > 1 and other -ve, or self < 1 and other +ve\n # possibility of underflow to 0\n Etiny = context.Etiny()\n if bound >= len(str(-Etiny)):\n ans = _dec_from_triple(result_sign, '1', Etiny-1)\n\n # try for an exact result with precision +1\n if ans is None:\n ans = self._power_exact(other, context.prec + 1)\n if ans is not None:\n if result_sign == 1:\n ans = _dec_from_triple(1, ans._int, ans._exp)\n exact = True\n\n # usual case: inexact result, x**y computed directly as exp(y*log(x))\n if ans is None:\n p = context.prec\n x = _WorkRep(self)\n xc, xe = x.int, x.exp\n y = _WorkRep(other)\n yc, ye = y.int, y.exp\n if y.sign == 1:\n yc = -yc\n\n # compute correctly rounded result: start with precision +3,\n # then increase precision until result is unambiguously roundable\n extra = 3\n while True:\n coeff, exp = _dpower(xc, xe, yc, ye, p+extra)\n if coeff % (5*10**(len(str(coeff))-p-1)):\n break\n extra += 3\n\n ans = _dec_from_triple(result_sign, str(coeff), exp)\n\n # unlike exp, ln and log10, the power function respects the\n # rounding mode; no need to switch to ROUND_HALF_EVEN here\n\n # There's a difficulty here when 'other' is not an integer and\n # the result is exact. In this case, the specification\n # requires that the Inexact flag be raised (in spite of\n # exactness), but since the result is exact _fix won't do this\n # for us. (Correspondingly, the Underflow signal should also\n # be raised for subnormal results.) We can't directly raise\n # these signals either before or after calling _fix, since\n # that would violate the precedence for signals. So we wrap\n # the ._fix call in a temporary context, and reraise\n # afterwards.\n if exact and not other._isinteger():\n # pad with zeros up to length context.prec+1 if necessary; this\n # ensures that the Rounded signal will be raised.\n if len(ans._int) <= context.prec:\n expdiff = context.prec + 1 - len(ans._int)\n ans = _dec_from_triple(ans._sign, ans._int+'0'*expdiff,\n ans._exp-expdiff)\n\n # create a copy of the current context, with cleared flags/traps\n newcontext = context.copy()\n newcontext.clear_flags()\n for exception in _signals:\n newcontext.traps[exception] = 0\n\n # round in the new context\n ans = ans._fix(newcontext)\n\n # raise Inexact, and if necessary, Underflow\n newcontext._raise_error(Inexact)\n if newcontext.flags[Subnormal]:\n newcontext._raise_error(Underflow)\n\n # propagate signals to the original context; _fix could\n # have raised any of Overflow, Underflow, Subnormal,\n # Inexact, Rounded, Clamped. Overflow needs the correct\n # arguments. Note that the order of the exceptions is\n # important here.\n if newcontext.flags[Overflow]:\n context._raise_error(Overflow, 'above Emax', ans._sign)\n for exception in Underflow, Subnormal, Inexact, Rounded, Clamped:\n if newcontext.flags[exception]:\n context._raise_error(exception)\n\n else:\n ans = ans._fix(context)\n\n return ans", "metadata": "root.Decimal.__pow__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2135 }, { "content": " def __rpow__(self, other, context=None):\n \"\"\"Swaps self/other and returns __pow__.\"\"\"\n other = _convert_other(other)\n if other is NotImplemented:\n return other\n return other.__pow__(self, context=context)", "metadata": "root.Decimal.__rpow__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2351 }, { "content": " def normalize(self, context=None):\n \"\"\"Normalize- strip trailing 0s, change anything equal to 0 to 0e0\"\"\"\n\n if context is None:\n context = getcontext()\n\n if self._is_special:\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n dup = self._fix(context)\n if dup._isinfinity():\n return dup\n\n if not dup:\n return _dec_from_triple(dup._sign, '0', 0)\n exp_max = [context.Emax, context.Etop()][context._clamp]\n end = len(dup._int)\n exp = dup._exp\n while dup._int[end-1] == '0' and exp < exp_max:\n exp += 1\n end -= 1\n return _dec_from_triple(dup._sign, dup._int[:end], exp)", "metadata": "root.Decimal.normalize", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2358 }, { "content": " def quantize(self, exp, rounding=None, context=None, watchexp=True):\n \"\"\"Quantize self so its exponent is the same as that of exp.\n\n Similar to self._rescale(exp._exp) but with error checking.\n \"\"\"\n exp = _convert_other(exp, raiseit=True)\n\n if context is None:\n context = getcontext()\n if rounding is None:\n rounding = context.rounding\n\n if self._is_special or exp._is_special:\n ans = self._check_nans(exp, context)\n if ans:\n return ans\n\n if exp._isinfinity() or self._isinfinity():\n if exp._isinfinity() and self._isinfinity():\n return Decimal(self) # if both are inf, it is OK\n return context._raise_error(InvalidOperation,\n 'quantize with one INF')\n\n # if we're not watching exponents, do a simple rescale\n if not watchexp:\n ans = self._rescale(exp._exp, rounding)\n # raise Inexact and Rounded where appropriate\n if ans._exp > self._exp:\n context._raise_error(Rounded)\n if ans != self:\n context._raise_error(Inexact)\n return ans\n\n # exp._exp should be between Etiny and Emax\n if not (context.Etiny() <= exp._exp <= context.Emax):\n return context._raise_error(InvalidOperation,\n 'target exponent out of bounds in quantize')\n\n if not self:\n ans = _dec_from_triple(self._sign, '0', exp._exp)\n return ans._fix(context)\n\n self_adjusted = self.adjusted()\n if self_adjusted > context.Emax:\n return context._raise_error(InvalidOperation,\n 'exponent of quantize result too large for current context')\n if self_adjusted - exp._exp + 1 > context.prec:\n return context._raise_error(InvalidOperation,\n 'quantize result has too many digits for current context')\n\n ans = self._rescale(exp._exp, rounding)\n if ans.adjusted() > context.Emax:\n return context._raise_error(InvalidOperation,\n 'exponent of quantize result too large for current context')\n if len(ans._int) > context.prec:\n return context._raise_error(InvalidOperation,\n 'quantize result has too many digits for current context')\n\n # raise appropriate flags\n if ans and ans.adjusted() < context.Emin:\n context._raise_error(Subnormal)\n if ans._exp > self._exp:\n if ans != self:\n context._raise_error(Inexact)\n context._raise_error(Rounded)\n\n # call to fix takes care of any necessary folddown, and\n # signals Clamped if necessary\n ans = ans._fix(context)\n return ans", "metadata": "root.Decimal.quantize", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2383 }, { "content": " def same_quantum(self, other):\n \"\"\"Return True if self and other have the same exponent; otherwise\n return False.\n\n If either operand is a special value, the following rules are used:\n * return True if both operands are infinities\n * return True if both operands are NaNs\n * otherwise, return False.\n \"\"\"\n other = _convert_other(other, raiseit=True)\n if self._is_special or other._is_special:\n return (self.is_nan() and other.is_nan() or\n self.is_infinite() and other.is_infinite())\n return self._exp == other._exp", "metadata": "root.Decimal.same_quantum", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2454 }, { "content": " def _rescale(self, exp, rounding):\n \"\"\"Rescale self so that the exponent is exp, either by padding with zeros\n or by truncating digits, using the given rounding mode.\n\n Specials are returned without change. This operation is\n quiet: it raises no flags, and uses no information from the\n context.\n\n exp = exp to scale to (an integer)\n rounding = rounding mode\n \"\"\"\n if self._is_special:\n return Decimal(self)\n if not self:\n return _dec_from_triple(self._sign, '0', exp)\n\n if self._exp >= exp:\n # pad answer with zeros if necessary\n return _dec_from_triple(self._sign,\n self._int + '0'*(self._exp - exp), exp)\n\n # too many digits; round and lose data. If self.adjusted() <\n # exp-1, replace self by 10**(exp-1) before rounding\n digits = len(self._int) + self._exp - exp\n if digits < 0:\n self = _dec_from_triple(self._sign, '1', exp-1)\n digits = 0\n this_function = getattr(self, self._pick_rounding_function[rounding])\n changed = this_function(digits)\n coeff = self._int[:digits] or '0'\n if changed == 1:\n coeff = str(int(coeff)+1)\n return _dec_from_triple(self._sign, coeff, exp)", "metadata": "root.Decimal._rescale", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2469 }, { "content": " def _round(self, places, rounding):\n \"\"\"Round a nonzero, nonspecial Decimal to a fixed number of\n significant figures, using the given rounding mode.\n\n Infinities, NaNs and zeros are returned unaltered.\n\n This operation is quiet: it raises no flags, and uses no\n information from the context.\n\n \"\"\"\n if places <= 0:\n raise ValueError(\"argument should be at least 1 in _round\")\n if self._is_special or not self:\n return Decimal(self)\n ans = self._rescale(self.adjusted()+1-places, rounding)\n # it can happen that the rescale alters the adjusted exponent;\n # for example when rounding 99.97 to 3 significant figures.\n # When this happens we end up with an extra 0 at the end of\n # the number; a second rescale fixes this.\n if ans.adjusted() != self.adjusted():\n ans = ans._rescale(ans.adjusted()+1-places, rounding)\n return ans", "metadata": "root.Decimal._round", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2503 }, { "content": " def to_integral_exact(self, rounding=None, context=None):\n \"\"\"Rounds to a nearby integer.\n\n If no rounding mode is specified, take the rounding mode from\n the context. This method raises the Rounded and Inexact flags\n when appropriate.\n\n See also: to_integral_value, which does exactly the same as\n this method except that it doesn't raise Inexact or Rounded.\n \"\"\"\n if self._is_special:\n ans = self._check_nans(context=context)\n if ans:\n return ans\n return Decimal(self)\n if self._exp >= 0:\n return Decimal(self)\n if not self:\n return _dec_from_triple(self._sign, '0', 0)\n if context is None:\n context = getcontext()\n if rounding is None:\n rounding = context.rounding\n ans = self._rescale(0, rounding)\n if ans != self:\n context._raise_error(Inexact)\n context._raise_error(Rounded)\n return ans", "metadata": "root.Decimal.to_integral_exact", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2526 }, { "content": " def to_integral_value(self, rounding=None, context=None):\n \"\"\"Rounds to the nearest integer, without raising inexact, rounded.\"\"\"\n if context is None:\n context = getcontext()\n if rounding is None:\n rounding = context.rounding\n if self._is_special:\n ans = self._check_nans(context=context)\n if ans:\n return ans\n return Decimal(self)\n if self._exp >= 0:\n return Decimal(self)\n else:\n return self._rescale(0, rounding)", "metadata": "root.Decimal.to_integral_value", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2555 }, { "content": " def sqrt(self, context=None):\n \"\"\"Return the square root of self.\"\"\"\n if context is None:\n context = getcontext()\n\n if self._is_special:\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n if self._isinfinity() and self._sign == 0:\n return Decimal(self)\n\n if not self:\n # exponent = self._exp // 2. sqrt(-0) = -0\n ans = _dec_from_triple(self._sign, '0', self._exp // 2)\n return ans._fix(context)\n\n if self._sign == 1:\n return context._raise_error(InvalidOperation, 'sqrt(-x), x > 0')\n\n # At this point self represents a positive number. Let p be\n # the desired precision and express self in the form c*100**e\n # with c a positive real number and e an integer, c and e\n # being chosen so that 100**(p-1) <= c < 100**p. Then the\n # (exact) square root of self is sqrt(c)*10**e, and 10**(p-1)\n # <= sqrt(c) < 10**p, so the closest representable Decimal at\n # precision p is n*10**e where n = round_half_even(sqrt(c)),\n # the closest integer to sqrt(c) with the even integer chosen\n # in the case of a tie.\n #\n # To ensure correct rounding in all cases, we use the\n # following trick: we compute the square root to an extra\n # place (precision p+1 instead of precision p), rounding down.\n # Then, if the result is inexact and its last digit is 0 or 5,\n # we increase the last digit to 1 or 6 respectively; if it's\n # exact we leave the last digit alone. Now the final round to\n # p places (or fewer in the case of underflow) will round\n # correctly and raise the appropriate flags.\n\n # use an extra digit of precision\n prec = context.prec+1\n\n # write argument in the form c*100**e where e = self._exp//2\n # is the 'ideal' exponent, to be used if the square root is\n # exactly representable. l is the number of 'digits' of c in\n # base 100, so that 100**(l-1) <= c < 100**l.\n op = _WorkRep(self)\n e = op.exp >> 1\n if op.exp & 1:\n c = op.int * 10\n l = (len(self._int) >> 1) + 1\n else:\n c = op.int\n l = len(self._int)+1 >> 1\n\n # rescale so that c has exactly prec base 100 'digits'\n shift = prec-l\n if shift >= 0:\n c *= 100**shift\n exact = True\n else:\n c, remainder = divmod(c, 100**-shift)\n exact = not remainder\n e -= shift\n\n # find n = floor(sqrt(c)) using Newton's method\n n = 10**prec\n while True:\n q = c//n\n if n <= q:\n break\n else:\n n = n + q >> 1\n exact = exact and n*n == c\n\n if exact:\n # result is exact; rescale to use ideal exponent e\n if shift >= 0:\n # assert n % 10**shift == 0\n n //= 10**shift\n else:\n n *= 10**-shift\n e += shift\n else:\n # result is not exact; fix last digit as described above\n if n % 5 == 0:\n n += 1\n\n ans = _dec_from_triple(0, str(n), e)\n\n # round, and fit to current context\n context = context._shallow_copy()\n rounding = context._set_rounding(ROUND_HALF_EVEN)\n ans = ans._fix(context)\n context.rounding = rounding\n\n return ans", "metadata": "root.Decimal.sqrt", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2574 }, { "content": " def max(self, other, context=None):\n \"\"\"Returns the larger value.\n\n Like max(self, other) except if one is not a number, returns\n NaN (and signals if one is sNaN). Also rounds.\n \"\"\"\n other = _convert_other(other, raiseit=True)\n\n if context is None:\n context = getcontext()\n\n if self._is_special or other._is_special:\n # If one operand is a quiet NaN and the other is number, then the\n # number is always returned\n sn = self._isnan()\n on = other._isnan()\n if sn or on:\n if on == 1 and sn == 0:\n return self._fix(context)\n if sn == 1 and on == 0:\n return other._fix(context)\n return self._check_nans(other, context)\n\n c = self._cmp(other)\n if c == 0:\n # If both operands are finite and equal in numerical value\n # then an ordering is applied:\n #\n # If the signs differ then max returns the operand with the\n # positive sign and min returns the operand with the negative sign\n #\n # If the signs are the same then the exponent is used to select\n # the result. This is exactly the ordering used in compare_total.\n c = self.compare_total(other)\n\n if c == -1:\n ans = other\n else:\n ans = self\n\n return ans._fix(context)", "metadata": "root.Decimal.max", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2673 }, { "content": " def min(self, other, context=None):\n \"\"\"Returns the smaller value.\n\n Like min(self, other) except if one is not a number, returns\n NaN (and signals if one is sNaN). Also rounds.\n \"\"\"\n other = _convert_other(other, raiseit=True)\n\n if context is None:\n context = getcontext()\n\n if self._is_special or other._is_special:\n # If one operand is a quiet NaN and the other is number, then the\n # number is always returned\n sn = self._isnan()\n on = other._isnan()\n if sn or on:\n if on == 1 and sn == 0:\n return self._fix(context)\n if sn == 1 and on == 0:\n return other._fix(context)\n return self._check_nans(other, context)\n\n c = self._cmp(other)\n if c == 0:\n c = self.compare_total(other)\n\n if c == -1:\n ans = self\n else:\n ans = other\n\n return ans._fix(context)", "metadata": "root.Decimal.min", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2715 }, { "content": " def _isinteger(self):\n \"\"\"Returns whether self is an integer\"\"\"\n if self._is_special:\n return False\n if self._exp >= 0:\n return True\n rest = self._int[self._exp:]\n return rest == '0'*len(rest)", "metadata": "root.Decimal._isinteger", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2749 }, { "content": " def _iseven(self):\n \"\"\"Returns True if self is even. Assumes self is an integer.\"\"\"\n if not self or self._exp > 0:\n return True\n return self._int[-1+self._exp] in '02468'", "metadata": "root.Decimal._iseven", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2758 }, { "content": " def adjusted(self):\n \"\"\"Return the adjusted exponent of self\"\"\"\n try:\n return self._exp + len(self._int) - 1\n # If NaN or Infinity, self._exp is string\n except TypeError:\n return 0", "metadata": "root.Decimal.adjusted", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2764 }, { "content": " def canonical(self, context=None):\n \"\"\"Returns the same Decimal object.\n\n As we do not have different encodings for the same number, the\n received object already is in its canonical form.\n \"\"\"\n return self", "metadata": "root.Decimal.canonical", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2772 }, { "content": " def compare_signal(self, other, context=None):\n \"\"\"Compares self to the other operand numerically.\n\n It's pretty much like compare(), but all NaNs signal, with signaling\n NaNs taking precedence over quiet NaNs.\n \"\"\"\n other = _convert_other(other, raiseit = True)\n ans = self._compare_check_nans(other, context)\n if ans:\n return ans\n return self.compare(other, context=context)", "metadata": "root.Decimal.compare_signal", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2780 }, { "content": " def compare_total(self, other):\n \"\"\"Compares self to other using the abstract representations.\n\n This is not like the standard compare, which use their numerical\n value. Note that a total ordering is defined for all possible abstract\n representations.\n \"\"\"\n other = _convert_other(other, raiseit=True)\n\n # if one is negative and the other is positive, it's easy\n if self._sign and not other._sign:\n return _NegativeOne\n if not self._sign and other._sign:\n return _One\n sign = self._sign\n\n # let's handle both NaN types\n self_nan = self._isnan()\n other_nan = other._isnan()\n if self_nan or other_nan:\n if self_nan == other_nan:\n # compare payloads as though they're integers\n self_key = len(self._int), self._int\n other_key = len(other._int), other._int\n if self_key < other_key:\n if sign:\n return _One\n else:\n return _NegativeOne\n if self_key > other_key:\n if sign:\n return _NegativeOne\n else:\n return _One\n return _Zero\n\n if sign:\n if self_nan == 1:\n return _NegativeOne\n if other_nan == 1:\n return _One\n if self_nan == 2:\n return _NegativeOne\n if other_nan == 2:\n return _One\n else:\n if self_nan == 1:\n return _One\n if other_nan == 1:\n return _NegativeOne\n if self_nan == 2:\n return _One\n if other_nan == 2:\n return _NegativeOne\n\n if self < other:\n return _NegativeOne\n if self > other:\n return _One\n\n if self._exp < other._exp:\n if sign:\n return _One\n else:\n return _NegativeOne\n if self._exp > other._exp:\n if sign:\n return _NegativeOne\n else:\n return _One\n return _Zero", "metadata": "root.Decimal.compare_total", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2792 }, { "content": " def compare_total_mag(self, other):\n \"\"\"Compares self to other using abstract repr., ignoring sign.\n\n Like compare_total, but with operand's sign ignored and assumed to be 0.\n \"\"\"\n other = _convert_other(other, raiseit=True)\n\n s = self.copy_abs()\n o = other.copy_abs()\n return s.compare_total(o)", "metadata": "root.Decimal.compare_total_mag", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2865 }, { "content": " def copy_abs(self):\n \"\"\"Returns a copy with the sign set to 0. \"\"\"\n return _dec_from_triple(0, self._int, self._exp, self._is_special)", "metadata": "root.Decimal.copy_abs", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2876 }, { "content": " def copy_negate(self):\n \"\"\"Returns a copy with the sign inverted.\"\"\"\n if self._sign:\n return _dec_from_triple(0, self._int, self._exp, self._is_special)\n else:\n return _dec_from_triple(1, self._int, self._exp, self._is_special)", "metadata": "root.Decimal.copy_negate", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2880 }, { "content": " def copy_sign(self, other):\n \"\"\"Returns self with the sign of other.\"\"\"\n other = _convert_other(other, raiseit=True)\n return _dec_from_triple(other._sign, self._int,\n self._exp, self._is_special)", "metadata": "root.Decimal.copy_sign", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2887 }, { "content": " def exp(self, context=None):\n \"\"\"Returns e ** self.\"\"\"\n\n if context is None:\n context = getcontext()\n\n # exp(NaN) = NaN\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n # exp(-Infinity) = 0\n if self._isinfinity() == -1:\n return _Zero\n\n # exp(0) = 1\n if not self:\n return _One\n\n # exp(Infinity) = Infinity\n if self._isinfinity() == 1:\n return Decimal(self)\n\n # the result is now guaranteed to be inexact (the true\n # mathematical result is transcendental). There's no need to\n # raise Rounded and Inexact here---they'll always be raised as\n # a result of the call to _fix.\n p = context.prec\n adj = self.adjusted()\n\n # we only need to do any computation for quite a small range\n # of adjusted exponents---for example, -29 <= adj <= 10 for\n # the default context. For smaller exponent the result is\n # indistinguishable from 1 at the given precision, while for\n # larger exponent the result either overflows or underflows.\n if self._sign == 0 and adj > len(str((context.Emax+1)*3)):\n # overflow\n ans = _dec_from_triple(0, '1', context.Emax+1)\n elif self._sign == 1 and adj > len(str((-context.Etiny()+1)*3)):\n # underflow to 0\n ans = _dec_from_triple(0, '1', context.Etiny()-1)\n elif self._sign == 0 and adj < -p:\n # p+1 digits; final round will raise correct flags\n ans = _dec_from_triple(0, '1' + '0'*(p-1) + '1', -p)\n elif self._sign == 1 and adj < -p-1:\n # p+1 digits; final round will raise correct flags\n ans = _dec_from_triple(0, '9'*(p+1), -p-1)\n # general case\n else:\n op = _WorkRep(self)\n c, e = op.int, op.exp\n if op.sign == 1:\n c = -c\n\n # compute correctly rounded result: increase precision by\n # 3 digits at a time until we get an unambiguously\n # roundable result\n extra = 3\n while True:\n coeff, exp = _dexp(c, e, p+extra)\n if coeff % (5*10**(len(str(coeff))-p-1)):\n break\n extra += 3\n\n ans = _dec_from_triple(0, str(coeff), exp)\n\n # at this stage, ans should round correctly with *any*\n # rounding mode, not just with ROUND_HALF_EVEN\n context = context._shallow_copy()\n rounding = context._set_rounding(ROUND_HALF_EVEN)\n ans = ans._fix(context)\n context.rounding = rounding\n\n return ans", "metadata": "root.Decimal.exp", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2893 }, { "content": " def is_canonical(self):\n \"\"\"Return True if self is canonical; otherwise return False.\n\n Currently, the encoding of a Decimal instance is always\n canonical, so this method returns True for any Decimal.\n \"\"\"\n return True", "metadata": "root.Decimal.is_canonical", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2968 }, { "content": " def is_finite(self):\n \"\"\"Return True if self is finite; otherwise return False.\n\n A Decimal instance is considered finite if it is neither\n infinite nor a NaN.\n \"\"\"\n return not self._is_special", "metadata": "root.Decimal.is_finite", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2976 }, { "content": " def is_infinite(self):\n \"\"\"Return True if self is infinite; otherwise return False.\"\"\"\n return self._exp == 'F'", "metadata": "root.Decimal.is_infinite", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2984 }, { "content": " def is_nan(self):\n \"\"\"Return True if self is a qNaN or sNaN; otherwise return False.\"\"\"\n return self._exp in ('n', 'N')", "metadata": "root.Decimal.is_nan", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2988 }, { "content": " def is_normal(self, context=None):\n \"\"\"Return True if self is a normal number; otherwise return False.\"\"\"\n if self._is_special or not self:\n return False\n if context is None:\n context = getcontext()\n return context.Emin <= self.adjusted()", "metadata": "root.Decimal.is_normal", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 2992 }, { "content": " def is_qnan(self):\n \"\"\"Return True if self is a quiet NaN; otherwise return False.\"\"\"\n return self._exp == 'n'", "metadata": "root.Decimal.is_qnan", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3000 }, { "content": " def is_signed(self):\n \"\"\"Return True if self is negative; otherwise return False.\"\"\"\n return self._sign == 1", "metadata": "root.Decimal.is_signed", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3004 }, { "content": " def is_snan(self):\n \"\"\"Return True if self is a signaling NaN; otherwise return False.\"\"\"\n return self._exp == 'N'", "metadata": "root.Decimal.is_snan", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3008 }, { "content": " def is_subnormal(self, context=None):\n \"\"\"Return True if self is subnormal; otherwise return False.\"\"\"\n if self._is_special or not self:\n return False\n if context is None:\n context = getcontext()\n return self.adjusted() < context.Emin", "metadata": "root.Decimal.is_subnormal", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3012 }, { "content": " def is_zero(self):\n \"\"\"Return True if self is a zero; otherwise return False.\"\"\"\n return not self._is_special and self._int == '0'", "metadata": "root.Decimal.is_zero", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3020 }, { "content": " def _ln_exp_bound(self):\n \"\"\"Compute a lower bound for the adjusted exponent of self.ln().\n In other words, compute r such that self.ln() >= 10**r. Assumes\n that self is finite and positive and that self != 1.\n \"\"\"\n\n # for 0.1 <= x <= 10 we use the inequalities 1-1/x <= ln(x) <= x-1\n adj = self._exp + len(self._int) - 1\n if adj >= 1:\n # argument >= 10; we use 23/10 = 2.3 as a lower bound for ln(10)\n return len(str(adj*23//10)) - 1\n if adj <= -2:\n # argument <= 0.1\n return len(str((-1-adj)*23//10)) - 1\n op = _WorkRep(self)\n c, e = op.int, op.exp\n if adj == 0:\n # 1 < self < 10\n num = str(c-10**-e)\n den = str(c)\n return len(num) - len(den) - (num < den)\n # adj == -1, 0.1 <= self < 1\n return e + len(str(10**-e - c)) - 1", "metadata": "root.Decimal._ln_exp_bound", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3024 }, { "content": " def ln(self, context=None):\n \"\"\"Returns the natural (base e) logarithm of self.\"\"\"\n\n if context is None:\n context = getcontext()\n\n # ln(NaN) = NaN\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n # ln(0.0) == -Infinity\n if not self:\n return _NegativeInfinity\n\n # ln(Infinity) = Infinity\n if self._isinfinity() == 1:\n return _Infinity\n\n # ln(1.0) == 0.0\n if self == _One:\n return _Zero\n\n # ln(negative) raises InvalidOperation\n if self._sign == 1:\n return context._raise_error(InvalidOperation,\n 'ln of a negative value')\n\n # result is irrational, so necessarily inexact\n op = _WorkRep(self)\n c, e = op.int, op.exp\n p = context.prec\n\n # correctly rounded result: repeatedly increase precision by 3\n # until we get an unambiguously roundable result\n places = p - self._ln_exp_bound() + 2 # at least p+3 places\n while True:\n coeff = _dlog(c, e, places)\n # assert len(str(abs(coeff)))-p >= 1\n if coeff % (5*10**(len(str(abs(coeff)))-p-1)):\n break\n places += 3\n ans = _dec_from_triple(int(coeff<0), str(abs(coeff)), -places)\n\n context = context._shallow_copy()\n rounding = context._set_rounding(ROUND_HALF_EVEN)\n ans = ans._fix(context)\n context.rounding = rounding\n return ans", "metadata": "root.Decimal.ln", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3049 }, { "content": " def _log10_exp_bound(self):\n \"\"\"Compute a lower bound for the adjusted exponent of self.log10().\n In other words, find r such that self.log10() >= 10**r.\n Assumes that self is finite and positive and that self != 1.\n \"\"\"\n\n # For x >= 10 or x < 0.1 we only need a bound on the integer\n # part of log10(self), and this comes directly from the\n # exponent of x. For 0.1 <= x <= 10 we use the inequalities\n # 1-1/x <= log(x) <= x-1. If x > 1 we have |log10(x)| >\n # (1-1/x)/2.31 > 0. If x < 1 then |log10(x)| > (1-x)/2.31 > 0\n\n adj = self._exp + len(self._int) - 1\n if adj >= 1:\n # self >= 10\n return len(str(adj))-1\n if adj <= -2:\n # self < 0.1\n return len(str(-1-adj))-1\n op = _WorkRep(self)\n c, e = op.int, op.exp\n if adj == 0:\n # 1 < self < 10\n num = str(c-10**-e)\n den = str(231*c)\n return len(num) - len(den) - (num < den) + 2\n # adj == -1, 0.1 <= self < 1\n num = str(10**-e-c)\n return len(num) + e - (num < \"231\") - 1", "metadata": "root.Decimal._log10_exp_bound", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3099 }, { "content": " def log10(self, context=None):\n \"\"\"Returns the base 10 logarithm of self.\"\"\"\n\n if context is None:\n context = getcontext()\n\n # log10(NaN) = NaN\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n # log10(0.0) == -Infinity\n if not self:\n return _NegativeInfinity\n\n # log10(Infinity) = Infinity\n if self._isinfinity() == 1:\n return _Infinity\n\n # log10(negative or -Infinity) raises InvalidOperation\n if self._sign == 1:\n return context._raise_error(InvalidOperation,\n 'log10 of a negative value')\n\n # log10(10**n) = n\n if self._int[0] == '1' and self._int[1:] == '0'*(len(self._int) - 1):\n # answer may need rounding\n ans = Decimal(self._exp + len(self._int) - 1)\n else:\n # result is irrational, so necessarily inexact\n op = _WorkRep(self)\n c, e = op.int, op.exp\n p = context.prec\n\n # correctly rounded result: repeatedly increase precision\n # until result is unambiguously roundable\n places = p-self._log10_exp_bound()+2\n while True:\n coeff = _dlog10(c, e, places)\n # assert len(str(abs(coeff)))-p >= 1\n if coeff % (5*10**(len(str(abs(coeff)))-p-1)):\n break\n places += 3\n ans = _dec_from_triple(int(coeff<0), str(abs(coeff)), -places)\n\n context = context._shallow_copy()\n rounding = context._set_rounding(ROUND_HALF_EVEN)\n ans = ans._fix(context)\n context.rounding = rounding\n return ans", "metadata": "root.Decimal.log10", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3129 }, { "content": " def logb(self, context=None):\n \"\"\" Returns the exponent of the magnitude of self's MSD.\n\n The result is the integer which is the exponent of the magnitude\n of the most significant digit of self (as though it were truncated\n to a single digit while maintaining the value of that digit and\n without limiting the resulting exponent).\n \"\"\"\n # logb(NaN) = NaN\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n if context is None:\n context = getcontext()\n\n # logb(+/-Inf) = +Inf\n if self._isinfinity():\n return _Infinity\n\n # logb(0) = -Inf, DivisionByZero\n if not self:\n return context._raise_error(DivisionByZero, 'logb(0)', 1)\n\n # otherwise, simply return the adjusted exponent of self, as a\n # Decimal. Note that no attempt is made to fit the result\n # into the current context.\n ans = Decimal(self.adjusted())\n return ans._fix(context)", "metadata": "root.Decimal.logb", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3180 }, { "content": " def _islogical(self):\n \"\"\"Return True if self is a logical operand.\n\n For being logical, it must be a finite number with a sign of 0,\n an exponent of 0, and a coefficient whose digits must all be\n either 0 or 1.\n \"\"\"\n if self._sign != 0 or self._exp != 0:\n return False\n for dig in self._int:\n if dig not in '01':\n return False\n return True", "metadata": "root.Decimal._islogical", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3210 }, { "content": " def _fill_logical(self, context, opa, opb):\n dif = context.prec - len(opa)\n if dif > 0:\n opa = '0'*dif + opa\n elif dif < 0:\n opa = opa[-context.prec:]\n dif = context.prec - len(opb)\n if dif > 0:\n opb = '0'*dif + opb\n elif dif < 0:\n opb = opb[-context.prec:]\n return opa, opb", "metadata": "root.Decimal._fill_logical", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3224 }, { "content": " def logical_and(self, other, context=None):\n \"\"\"Applies an 'and' operation between self and other's digits.\"\"\"\n if context is None:\n context = getcontext()\n\n other = _convert_other(other, raiseit=True)\n\n if not self._islogical() or not other._islogical():\n return context._raise_error(InvalidOperation)\n\n # fill to context.prec\n (opa, opb) = self._fill_logical(context, self._int, other._int)\n\n # make the operation, and clean starting zeroes\n result = \"\".join([str(int(a)&int(b)) for a,b in zip(opa,opb)])\n return _dec_from_triple(0, result.lstrip('0') or '0', 0)", "metadata": "root.Decimal.logical_and", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3237 }, { "content": " def logical_invert(self, context=None):\n \"\"\"Invert all its digits.\"\"\"\n if context is None:\n context = getcontext()\n return self.logical_xor(_dec_from_triple(0,'1'*context.prec,0),\n context)", "metadata": "root.Decimal.logical_invert", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3254 }, { "content": " def logical_or(self, other, context=None):\n \"\"\"Applies an 'or' operation between self and other's digits.\"\"\"\n if context is None:\n context = getcontext()\n\n other = _convert_other(other, raiseit=True)\n\n if not self._islogical() or not other._islogical():\n return context._raise_error(InvalidOperation)\n\n # fill to context.prec\n (opa, opb) = self._fill_logical(context, self._int, other._int)\n\n # make the operation, and clean starting zeroes\n result = \"\".join([str(int(a)|int(b)) for a,b in zip(opa,opb)])\n return _dec_from_triple(0, result.lstrip('0') or '0', 0)", "metadata": "root.Decimal.logical_or", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3261 }, { "content": " def logical_xor(self, other, context=None):\n \"\"\"Applies an 'xor' operation between self and other's digits.\"\"\"\n if context is None:\n context = getcontext()\n\n other = _convert_other(other, raiseit=True)\n\n if not self._islogical() or not other._islogical():\n return context._raise_error(InvalidOperation)\n\n # fill to context.prec\n (opa, opb) = self._fill_logical(context, self._int, other._int)\n\n # make the operation, and clean starting zeroes\n result = \"\".join([str(int(a)^int(b)) for a,b in zip(opa,opb)])\n return _dec_from_triple(0, result.lstrip('0') or '0', 0)", "metadata": "root.Decimal.logical_xor", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3278 }, { "content": " def max_mag(self, other, context=None):\n \"\"\"Compares the values numerically with their sign ignored.\"\"\"\n other = _convert_other(other, raiseit=True)\n\n if context is None:\n context = getcontext()\n\n if self._is_special or other._is_special:\n # If one operand is a quiet NaN and the other is number, then the\n # number is always returned\n sn = self._isnan()\n on = other._isnan()\n if sn or on:\n if on == 1 and sn == 0:\n return self._fix(context)\n if sn == 1 and on == 0:\n return other._fix(context)\n return self._check_nans(other, context)\n\n c = self.copy_abs()._cmp(other.copy_abs())\n if c == 0:\n c = self.compare_total(other)\n\n if c == -1:\n ans = other\n else:\n ans = self\n\n return ans._fix(context)", "metadata": "root.Decimal.max_mag", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3295 }, { "content": " def min_mag(self, other, context=None):\n \"\"\"Compares the values numerically with their sign ignored.\"\"\"\n other = _convert_other(other, raiseit=True)\n\n if context is None:\n context = getcontext()\n\n if self._is_special or other._is_special:\n # If one operand is a quiet NaN and the other is number, then the\n # number is always returned\n sn = self._isnan()\n on = other._isnan()\n if sn or on:\n if on == 1 and sn == 0:\n return self._fix(context)\n if sn == 1 and on == 0:\n return other._fix(context)\n return self._check_nans(other, context)\n\n c = self.copy_abs()._cmp(other.copy_abs())\n if c == 0:\n c = self.compare_total(other)\n\n if c == -1:\n ans = self\n else:\n ans = other\n\n return ans._fix(context)", "metadata": "root.Decimal.min_mag", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3325 }, { "content": " def next_minus(self, context=None):\n \"\"\"Returns the largest representable number smaller than itself.\"\"\"\n if context is None:\n context = getcontext()\n\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n if self._isinfinity() == -1:\n return _NegativeInfinity\n if self._isinfinity() == 1:\n return _dec_from_triple(0, '9'*context.prec, context.Etop())\n\n context = context.copy()\n context._set_rounding(ROUND_FLOOR)\n context._ignore_all_flags()\n new_self = self._fix(context)\n if new_self != self:\n return new_self\n return self.__sub__(_dec_from_triple(0, '1', context.Etiny()-1),\n context)", "metadata": "root.Decimal.next_minus", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3355 }, { "content": " def next_plus(self, context=None):\n \"\"\"Returns the smallest representable number larger than itself.\"\"\"\n if context is None:\n context = getcontext()\n\n ans = self._check_nans(context=context)\n if ans:\n return ans\n\n if self._isinfinity() == 1:\n return _Infinity\n if self._isinfinity() == -1:\n return _dec_from_triple(1, '9'*context.prec, context.Etop())\n\n context = context.copy()\n context._set_rounding(ROUND_CEILING)\n context._ignore_all_flags()\n new_self = self._fix(context)\n if new_self != self:\n return new_self\n return self.__add__(_dec_from_triple(0, '1', context.Etiny()-1),\n context)", "metadata": "root.Decimal.next_plus", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3378 }, { "content": " def next_toward(self, other, context=None):\n \"\"\"Returns the number closest to self, in the direction towards other.\n\n The result is the closest representable number to self\n (excluding self) that is in the direction towards other,\n unless both have the same value. If the two operands are\n numerically equal, then the result is a copy of self with the\n sign set to be the same as the sign of other.\n \"\"\"\n other = _convert_other(other, raiseit=True)\n\n if context is None:\n context = getcontext()\n\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n comparison = self._cmp(other)\n if comparison == 0:\n return self.copy_sign(other)\n\n if comparison == -1:\n ans = self.next_plus(context)\n else: # comparison == 1\n ans = self.next_minus(context)\n\n # decide which flags to raise using value of ans\n if ans._isinfinity():\n context._raise_error(Overflow,\n 'Infinite result from next_toward',\n ans._sign)\n context._raise_error(Inexact)\n context._raise_error(Rounded)\n elif ans.adjusted() < context.Emin:\n context._raise_error(Underflow)\n context._raise_error(Subnormal)\n context._raise_error(Inexact)\n context._raise_error(Rounded)\n # if precision == 1 then we don't raise Clamped for a\n # result 0E-Etiny.\n if not ans:\n context._raise_error(Clamped)\n\n return ans", "metadata": "root.Decimal.next_toward", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3401 }, { "content": " def number_class(self, context=None):\n \"\"\"Returns an indication of the class of self.\n\n The class is one of the following strings:\n sNaN\n NaN\n -Infinity\n -Normal\n -Subnormal\n -Zero\n +Zero\n +Subnormal\n +Normal\n +Infinity\n \"\"\"\n if self.is_snan():\n return \"sNaN\"\n if self.is_qnan():\n return \"NaN\"\n inf = self._isinfinity()\n if inf == 1:\n return \"+Infinity\"\n if inf == -1:\n return \"-Infinity\"\n if self.is_zero():\n if self._sign:\n return \"-Zero\"\n else:\n return \"+Zero\"\n if context is None:\n context = getcontext()\n if self.is_subnormal(context=context):\n if self._sign:\n return \"-Subnormal\"\n else:\n return \"+Subnormal\"\n # just a normal, regular, boring number, :)\n if self._sign:\n return \"-Normal\"\n else:\n return \"+Normal\"", "metadata": "root.Decimal.number_class", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3447 }, { "content": " def radix(self):\n \"\"\"Just returns 10, as this is Decimal, :)\"\"\"\n return Decimal(10)", "metadata": "root.Decimal.radix", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3489 }, { "content": " def rotate(self, other, context=None):\n \"\"\"Returns a rotated copy of self, value-of-other times.\"\"\"\n if context is None:\n context = getcontext()\n\n other = _convert_other(other, raiseit=True)\n\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n if other._exp != 0:\n return context._raise_error(InvalidOperation)\n if not (-context.prec <= int(other) <= context.prec):\n return context._raise_error(InvalidOperation)\n\n if self._isinfinity():\n return Decimal(self)\n\n # get values, pad if necessary\n torot = int(other)\n rotdig = self._int\n topad = context.prec - len(rotdig)\n if topad > 0:\n rotdig = '0'*topad + rotdig\n elif topad < 0:\n rotdig = rotdig[-topad:]\n\n # let's rotate!\n rotated = rotdig[torot:] + rotdig[:torot]\n return _dec_from_triple(self._sign,\n rotated.lstrip('0') or '0', self._exp)", "metadata": "root.Decimal.rotate", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3493 }, { "content": " def scaleb(self, other, context=None):\n \"\"\"Returns self operand after adding the second value to its exp.\"\"\"\n if context is None:\n context = getcontext()\n\n other = _convert_other(other, raiseit=True)\n\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n if other._exp != 0:\n return context._raise_error(InvalidOperation)\n liminf = -2 * (context.Emax + context.prec)\n limsup = 2 * (context.Emax + context.prec)\n if not (liminf <= int(other) <= limsup):\n return context._raise_error(InvalidOperation)\n\n if self._isinfinity():\n return Decimal(self)\n\n d = _dec_from_triple(self._sign, self._int, self._exp + int(other))\n d = d._fix(context)\n return d", "metadata": "root.Decimal.scaleb", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3526 }, { "content": " def shift(self, other, context=None):\n \"\"\"Returns a shifted copy of self, value-of-other times.\"\"\"\n if context is None:\n context = getcontext()\n\n other = _convert_other(other, raiseit=True)\n\n ans = self._check_nans(other, context)\n if ans:\n return ans\n\n if other._exp != 0:\n return context._raise_error(InvalidOperation)\n if not (-context.prec <= int(other) <= context.prec):\n return context._raise_error(InvalidOperation)\n\n if self._isinfinity():\n return Decimal(self)\n\n # get values, pad if necessary\n torot = int(other)\n rotdig = self._int\n topad = context.prec - len(rotdig)\n if topad > 0:\n rotdig = '0'*topad + rotdig\n elif topad < 0:\n rotdig = rotdig[-topad:]\n\n # let's shift!\n if torot < 0:\n shifted = rotdig[:torot]\n else:\n shifted = rotdig + '0'*torot\n shifted = shifted[-context.prec:]\n\n return _dec_from_triple(self._sign,\n shifted.lstrip('0') or '0', self._exp)", "metadata": "root.Decimal.shift", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3551 }, { "content": " def __reduce__(self):\n return (self.__class__, (str(self),))", "metadata": "root.Decimal.__reduce__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3590 }, { "content": " def __copy__(self):\n if type(self) is Decimal:\n return self # I'm immutable; therefore I am my own clone\n return self.__class__(str(self))", "metadata": "root.Decimal.__copy__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3593 }, { "content": " def __deepcopy__(self, memo):\n if type(self) is Decimal:\n return self # My components are also immutable\n return self.__class__(str(self))", "metadata": "root.Decimal.__deepcopy__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3598 }, { "content": " def __format__(self, specifier, context=None, _localeconv=None):\n \"\"\"Format a Decimal instance according to the given specifier.\n\n The specifier should be a standard format specifier, with the\n form described in PEP 3101. Formatting types 'e', 'E', 'f',\n 'F', 'g', 'G', 'n' and '%' are supported. If the formatting\n type is omitted it defaults to 'g' or 'G', depending on the\n value of context.capitals.\n \"\"\"\n\n # Note: PEP 3101 says that if the type is not present then\n # there should be at least one digit after the decimal point.\n # We take the liberty of ignoring this requirement for\n # Decimal---it's presumably there to make sure that\n # format(float, '') behaves similarly to str(float).\n if context is None:\n context = getcontext()\n\n spec = _parse_format_specifier(specifier, _localeconv=_localeconv)\n\n # special values don't care about the type or precision\n if self._is_special:\n sign = _format_sign(self._sign, spec)\n body = str(self.copy_abs())\n return _format_align(sign, body, spec)\n\n # a type of None defaults to 'g' or 'G', depending on context\n if spec['type'] is None:\n spec['type'] = ['g', 'G'][context.capitals]\n\n # if type is '%', adjust exponent of self accordingly\n if spec['type'] == '%':\n self = _dec_from_triple(self._sign, self._int, self._exp+2)\n\n # round if necessary, taking rounding mode from the context\n rounding = context.rounding\n precision = spec['precision']\n if precision is not None:\n if spec['type'] in 'eE':\n self = self._round(precision+1, rounding)\n elif spec['type'] in 'fF%':\n self = self._rescale(-precision, rounding)\n elif spec['type'] in 'gG' and len(self._int) > precision:\n self = self._round(precision, rounding)\n # special case: zeros with a positive exponent can't be\n # represented in fixed point; rescale them to 0e0.\n if not self and self._exp > 0 and spec['type'] in 'fF%':\n self = self._rescale(0, rounding)\n\n # figure out placement of the decimal point\n leftdigits = self._exp + len(self._int)\n if spec['type'] in 'eE':\n if not self and precision is not None:\n dotplace = 1 - precision\n else:\n dotplace = 1\n elif spec['type'] in 'fF%':\n dotplace = leftdigits\n elif spec['type'] in 'gG':\n if self._exp <= 0 and leftdigits > -6:\n dotplace = leftdigits\n else:\n dotplace = 1\n\n # find digits before and after decimal point, and get exponent\n if dotplace < 0:\n intpart = '0'\n fracpart = '0'*(-dotplace) + self._int\n elif dotplace > len(self._int):\n intpart = self._int + '0'*(dotplace-len(self._int))\n fracpart = ''\n else:\n intpart = self._int[:dotplace] or '0'\n fracpart = self._int[dotplace:]\n exp = leftdigits-dotplace\n\n # done with the decimal-specific stuff; hand over the rest\n # of the formatting to the _format_number function\n return _format_number(self._sign, intpart, fracpart, exp, spec)", "metadata": "root.Decimal.__format__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3605 }, { "content": " def __tojava__(self, java_class):\n if java_class not in (BigDecimal, Object):\n return Py.NoConversion\n return BigDecimal(str(self))", "metadata": "root.Decimal.__tojava__", "header": "['class', 'Decimal', '(', 'object', ')', ':', '___EOS___']", "index": 3686 } ]
[ { "span": "cls(f)", "start_line": 691, "start_column": 19, "end_line": 691, "end_column": 25 }, { "span": "cls(repr(f))", "start_line": 693, "start_column": 19, "end_line": 693, "end_column": 31 } ]
[ { "span": "class Decimal(object):", "start_line": 513, "start_column": 0, "end_line": 513, "end_column": 22 }, { "span": "cls,", "start_line": 669, "start_column": 19, "end_line": 669, "end_column": 22 } ]
1
false
[ "[CLS]_", "Non", "_", "-_", "callable_", "called_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Float", "ing", " ", "point", " ", "class", " ", "for", " ", "decima", "l", " ", "arithmetic", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "(_", "'\\u", "exp", "'_", ",_", "'\\u", "int", "'_", ",_", "'\\u", "sign", "'_", ",_", "'\\u", "is", "\\u", "special", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", "ly", ",", " ", "the", " ", "value", " ", "of", " ", "the", " ", "Deci", "mal", " ", "instance", " ", "is", " ", "give", "n", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "(-", "1", ")**", "\\u", "sign", " ", "*", " ", "\\u", "int", " ", "*", " ", "10", "**", "\\u", "exp_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Special", " ", "values", " ", "are", " ", "sign", "ified", " ", "by", " ", "\\u", "is", "\\u", "special", " ", "==", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "immutable", ",", " ", "so", " ", "use", " ", "\\u\\u", "new", "\\u\\u", " ", "not", " ", "\\u\\u", "init\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "class", "method", ",", " ", "but", " ", "@", "decorat", "or", " ", "is", " ", "not", " ", "valid", " ", "Pyth", "on", " ", "2.3", " ", "synta", "x", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "use", " ", "it", " ", "(", "see", " ", "note", "s", " ", "on", " ", "Py", "2.3", " ", "compatibility", " ", "at", " ", "top", " ", "of", " ", "file", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "\\u", "float_", "=_", "classmethod_", "(_", "from", "\\u", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "The", " ", "Deci", "mal", " ", "standard", " ", "doe", "sn", "'", "t", " ", "cover", " ", "rich", " ", "comparisons", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Deci", "mal", "s", ".", " ", " ", "In", " ", "partic", "ular", ",", " ", "the", " ", "specifica", "tion", " ", "is", " ", "sile", "nt", " ", "on", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "subject", " ", "of", " ", "what", " ", "shou", "ld", " ", "happ", "en", " ", "for", " ", "a", " ", "compa", "ris", "on", " ", "involv", "ing", " ", "a", " ", "Na", "N", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "take", " ", "the", " ", "follow", "ing", " ", "appro", "ach", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "==", " ", "comparisons", " ", "involv", "ing", " ", "a", " ", "quie", "t", " ", "Na", "N", " ", "alw", "ay", "s", " ", "return", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "!=", " ", "comparisons", " ", "involv", "ing", " ", "a", " ", "quie", "t", " ", "Na", "N", " ", "alw", "ay", "s", " ", "return", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "==", " ", "or", " ", "!=", " ", "comparisons", " ", "involv", "ing", " ", "a", " ", "signal", "ing", " ", "Na", "N", " ", "signal_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Inva", "lid", "Opera", "tion", ",", " ", "and", " ", "return", " ", "Fal", "se", " ", "or", " ", "Tru", "e", " ", "as", " ", "above", " ", "if", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Inva", "lid", "Opera", "tion", " ", "is", " ", "not", " ", "trap", "ped", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "<", ",", " ", ">", ",", " ", "<=", " ", "and", " ", ">=", " ", "comparisons", " ", "involv", "ing", " ", "a", " ", "(", "quie", "t", " ", "or", " ", "signal", "ing", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Na", "N", " ", "signal", " ", "Inva", "lid", "Opera", "tion", ",", " ", "and", " ", "return", " ", "Fal", "se", " ", "if", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Inva", "lid", "Opera", "tion", " ", "is", " ", "not", " ", "trap", "ped", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "behavior", " ", "is", " ", "design", "ed", " ", "to", " ", "conform", " ", "as", " ", "close", "ly", " ", "as", " ", "possib", "le", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "specified", " ", "by", " ", "IE", "EE", " ", "754", "._", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "rad", "d\\u\\u_", "=_", "\\u\\u", "add\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "rm", "ul", "\\u\\u_", "=_", "\\u\\u", "mul\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "div\\u\\u_", "=_", "\\u\\u", "true", "div\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "rdi", "v", "\\u\\u_", "=_", "\\u\\u", "rtr", "ued", "iv", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "trunc", "\\u\\u_", "=_", "\\u\\u", "int\\u", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "real_", "=_", "property_", "(_", "real_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "imag_", "=_", "property_", "(_", "imag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "pick", "\\u", "rounding", "\\u", "function_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "each", " ", "of", " ", "the", " ", "rounding", " ", "function", "s", " ", "belo", "w", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", " ", "is", " ", "a", " ", "finite", ",", " ", "nonzero", " ", "Decimal_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "prec", " ", "is", " ", "an", " ", "integ", "er", " ", "satisfy", "ing", " ", "0", " ", "<=", " ", "prec", " ", "<", " ", "len", "(", "self", ".\\u", "int", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "each", " ", "function", " ", "return", "s", " ", "eit", "her", " ", "-1", ",", " ", "0", ",", " ", "or", " ", "1", ",", " ", "as", " ", "follow", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "1", " ", "indicat", "es", " ", "tha", "t", " ", "self", " ", "shou", "ld", " ", "be", " ", "rounded", " ", "up", " ", "(", "awa", "y", " ", "from", " ", "zero", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "0", " ", "indicat", "es", " ", "tha", "t", " ", "self", " ", "shou", "ld", " ", "be", " ", "truncat", "ed", ",", " ", "and", " ", "tha", "t", " ", "all", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "digit", "s", " ", "to", " ", "be", " ", "truncat", "ed", " ", "are", " ", "zero", "s", " ", "(", "so", " ", "the", " ", "value", " ", "is", " ", "unchanged", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-1", " ", "indicat", "es", " ", "tha", "t", " ", "there", " ", "are", " ", "nonzero", " ", "digit", "s", " ", "to", " ", "be", " ", "truncat", "ed_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "method", " ", "name", " ", "change", "d", ",", " ", "but", " ", "we", " ", "provide", " ", "als", "o", " ", "the", " ", "old", " ", "one", ",", " ", "for", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "\\u", "integral_", "=_", "to", "\\u", "integral", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Supp", "ort", " ", "for", " ", "pick", "ling", ",", " ", "copy", ",", " ", "and", " ", "deepcopy_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PE", "P", " ", "310", "1", " ", "support", ".", " ", " ", "the", " ", "\\u", "locale", "conv", " ", "keyw", "ord", " ", "argu", "ment", " ", "shou", "ld", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consider", "ed", " ", "private", ":", " ", "it", "'", "s", " ", "provided", " ", "for", " ", "eas", "e", " ", "of", " ", "testi", "ng", " ", "only", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "support", " ", "for", " ", "Jy", "tho", "n", " ", "\\u\\u", "to", "java", "\\u\\u:", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "value_", "=_", "\"", "0", "\"_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "decima", "l", " ", "point", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", "('", "3.14", "')", " ", " ", " ", " ", " ", " ", "#", " ", "string", " ", "input", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "3.14", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", "((", "0", ",", " ", "(", "3", ",", " ", "1", ",", " ", "4", "),", " ", "-", "2", "))", " ", " ", "#", " ", "tuple", " ", "(", "sign", ",", " ", "digit", "\\u", "tuple", ",", " ", "expon", "ent", ")", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "3.14", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", "(", "314", ")", " ", " ", " ", " ", " ", "#", " ", "int", " ", "or", " ", "long", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "314", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", "(", "Deci", "mal", "(", "314", "))", " ", " ", " ", " ", "#", " ", "anot", "her", " ", "decima", "l", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "314", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", "('", " ", " ", "3.14", " ", " ", "\\\\\\\\", "n", "')", " ", " ", " ", " ", "#", " ", "lead", "ing", " ", "and", " ", "trail", "ing", " ", "whitespace", " ", "oka", "y", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "3.14", "')", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "the", " ", "coefficient", ",", " ", "self", ".\\u", "int", ",", " ", "is", " ", "actual", "ly", " ", "store", "d", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "string", " ", "rat", "her", " ", "than", " ", "as", " ", "a", " ", "tuple", " ", "of", " ", "digit", "s", ".", " ", " ", "Thi", "s", " ", "speeds", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "\"", "digit", "s", " ", "to", " ", "integ", "er", "\"", " ", "and", " ", "\"", "integ", "er", " ", "to", " ", "digit", "s", "\"", " ", "conversions", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "are", " ", "used", " ", "in", " ", "alm", "ost", " ", "every", " ", "arithmetic", " ", "operati", "on", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Deci", "mal", "s", ".", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "internal", " ", "deta", "il", ":", " ", "the", " ", "as", "\\u", "tuple", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", " ", "Deci", "mal", " ", "construct", "or", " ", "still", " ", "deal", " ", "with", " ", "tuple", "s", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "digit", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "=_", "object_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fro", "m", " ", "a", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "RE", "s", " ", "insi", "st", " ", "on", " ", "real", " ", "string", "s", ",", " ", "so", " ", "we", " ", "can", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "\\u", "parser_", "(_", "value_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Conversion", "Syntax", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inva", "lid", " ", "literal", " ", "for", " ", "Deci", "mal", ":", " ", "%", "r", "\"_", "%_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "._", "group_", "(_", "'", "sign", "'_", ")_", "==_", "\"-\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "sign_", "=_", "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 ", " _", "self_", "._", "\\u", "sign_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "intp", "art_", "=_", "m_", "._", "group_", "(_", "'", "int", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "intp", "art_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "finite", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frac", "part_", "=_", "m_", "._", "group_", "(_", "'", "frac", "'_", ")_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp_", "=_", "int_", "(_", "m_", "._", "group_", "(_", "'", "exp", "'_", ")_", "or_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "int_", "=_", "str_", "(_", "int_", "(_", "intp", "art_", "+_", "frac", "part_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exp_", "=_", "exp_", "-_", "len_", "(_", "frac", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "special_", "=_", "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 ", " _", "diag_", "=_", "m_", "._", "group_", "(_", "'", "diag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "diag_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "int_", "=_", "str_", "(_", "int_", "(_", "diag_", "or_", "'", "0", "'_", ")_", ")_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "._", "group_", "(_", "'", "signal", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "exp_", "=_", "'", "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 ", " ", " _", "self_", "._", "\\u", "exp_", "=_", "'", "n", "'_", "\\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_", "#", " ", "infinity", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "int_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exp_", "=_", "'", "F", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "special_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fro", "m", " ", "an", " ", "integer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "sign_", "=_", "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_", "._", "\\u", "sign_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "exp_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "int_", "=_", "str_", "(_", "abs_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "special_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fro", "m", " ", "anot", "her", " ", "decimal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "Decimal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "exp_", "=_", "value_", "._", "\\u", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sign_", "=_", "value_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "int_", "=_", "value_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "special_", "=_", "value_", "._", "\\u", "is", "\\u", "special_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fro", "m", " ", "an", " ", "internal", " ", "working", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "\\u", "Work", "Rep", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "sign_", "=_", "value_", "._", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "int_", "=_", "str_", "(_", "value_", "._", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exp_", "=_", "int_", "(_", "value_", "._", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "special_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tuple", "/", "list", " ", "conve", "rsi", "on", " ", "(", "possib", "ly", " ", "from", " ", "as", "\\u", "tuple", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "value_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Inva", "lid", " ", "tuple", " ", "size", " ", "in", " ", "creati", "on", " ", "of", " ", "Deci", "mal", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "from", " ", "list", " ", "or", " ", "tuple", ".", " ", " ", "The", " ", "list", " ", "or", " ", "tuple", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shou", "ld", " ", "have", " ", "exact", "ly", " ", "three", " ", "element", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "sign", ".", " ", " ", "The", " ", "isin", "stance", " ", "test", " ", "reject", "s", " ", "floats_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "isinstance_", "(_", "value_", "[_", "0_", "]_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", "and_", "value_", "[_", "0_", "]_", "in_", "(_", "0_", ",_", "1_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Inva", "lid", " ", "sign", ".", " ", " ", "The", " ", "first", " ", "value", " ", "in", " ", "the", " ", "tuple", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "shou", "ld", " ", "be", " ", "an", " ", "integ", "er", ";", " ", "eit", "her", " ", "0", " ", "for", " ", "a", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "posit", "ive", " ", "number", " ", "or", " ", "1", " ", "for", " ", "a", " ", "negati", "ve", " ", "number", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "sign_", "=_", "value_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "[_", "2_", "]_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "infinity", ":", " ", "value", "[", "1", "]", " ", "is", " ", "ignored_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "int_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exp_", "=_", "value_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "special_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "and", " ", "validat", "e", " ", "the", " ", "digit", "s", " ", "in", " ", "value", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digits_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "digit_", "in_", "value_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "digit_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", "and_", "0_", "<=_", "digit_", "<=_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "skip", " ", "lead", "ing", " ", "zeros_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "digits_", "or_", "digit_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "digits_", "._", "append_", "(_", "digit_", ")_", "\\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 ", " ", " _", "raise_", "Value", "Error_", "(_", "\"", "The", " ", "second", " ", "value", " ", "in", " ", "the", " ", "tuple", " ", "must", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "be", " ", "compose", "d", " ", "of", " ", "integ", "ers", " ", "in", " ", "the", " ", "range", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "0", " ", "through", " ", "9", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "[_", "2_", "]_", "in_", "(_", "'", "n", "'_", ",_", "'", "N", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Na", "N", ":", " ", "digit", "s", " ", "form", " ", "the", " ", "diagnostic", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "int_", "=_", "''_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "digits_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exp_", "=_", "value_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "special_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", "[_", "2_", "]_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "finite", " ", "number", ":", " ", "digit", "s", " ", "give", " ", "the", " ", "coefficient_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "int_", "=_", "''_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "digits_", "or_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exp_", "=_", "value_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "special_", "=_", "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 ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "The", " ", "third", " ", "value", " ", "in", " ", "the", " ", "tuple", " ", "must", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "be", " ", "an", " ", "integ", "er", ",", " ", "or", " ", "one", " ", "of", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "string", "s", " ", "'", "F", "',", " ", "'", "n", "',", " ", "'", "N", "'.\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Decimal_", "._", "from", "\\u", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exp_", "=_", "value_", "._", "\\u", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sign_", "=_", "value_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "int_", "=_", "value_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "special_", "=_", "value_", "._", "\\u", "is", "\\u", "special_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Type", "Error_", "(_", "\"", "Cann", "ot", " ", "convert", " ", "%", "r", " ", "to", " ", "Deci", "mal", "\"_", "%_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "float_", "(_", "cls_", ",_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", "s", " ", "a", " ", "float", " ", "to", " ", "a", " ", "decima", "l", " ", "number", ",", " ", "exact", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "Deci", "mal", ".", "from", "\\u", "float", "(", "0.", "1", ")", " ", "is", " ", "not", " ", "the", " ", "same", " ", "as", " ", "Deci", "mal", "('", "0.", "1", "')", ".", "\\", "10", ";", " ", " ", " ", " ", "Sin", "ce", " ", "0.", "1", " ", "is", " ", "not", " ", "exact", "ly", " ", "represent", "able", " ", "in", " ", "binar", "y", " ", "float", "ing", " ", "point", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "is", " ", "store", "d", " ", "as", " ", "the", " ", "near", "est", " ", "represent", "able", " ", "value", " ", "whi", "ch", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "0x1", ".99", "999999999", "9", "ap", "-", "4", ".", " ", " ", "The", " ", "exact", " ", "equivalent", " ", "of", " ", "the", " ", "value", " ", "in", " ", "decima", "l", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "0.10", "0000000000000", "005", "551", "115", "1231", "257", "827", "0211", "815", "834", "045", "410", "156", "25.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", ".", "from", "\\u", "float", "(", "0.", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "0.10", "0000000000000", "005", "551", "115", "1231", "257", "827", "0211", "815", "834", "045", "410", "156", "25", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", ".", "from", "\\u", "float", "(", "float", "('", "nan", "'))", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "Na", "N", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", ".", "from", "\\u", "float", "(", "float", "('", "inf", "'))", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "Infinit", "y", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", ".", "from", "\\u", "float", "(-", "float", "('", "inf", "'))", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "-", "Infinit", "y", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Deci", "mal", ".", "from", "\\u", "float", "(-", "0.", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "Deci", "mal", "('", "-0", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "f_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "#", " ", "handle", " ", "integ", "er", " ", "inputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "math_", "._", "isinf", "_", "(_", "f_", ")_", "or_", "\\u", "math_", "._", "isnan_", "(_", "f_", ")_", ":_", "#", " ", "raise", "s", " ", "Type", "Error", " ", "if", " ", "not", " ", "a", " ", "float_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", "repr_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "math_", "._", "copy", "sign_", "(_", "1.0_", ",_", "f_", ")_", "==_", "1.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "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 ", " _", "sign_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", ",_", "d_", "=_", "abs_", "(_", "f_", ")_", "._", "as", "\\u", "integ", "er", "\\u", "ratio_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "d_", "._", "bit", "\\u", "length_", "(_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "sign_", ",_", "str_", "(_", "n_", "*_", "5_", "**_", "k_", ")_", ",_", "-_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cls_", "is_", "Decimal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "\\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_", "cls_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "isnan_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "whe", "ther", " ", "the", " ", "number", " ", "is", " ", "not", " ", "actual", "ly", " ", "one", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "a", " ", "number", "\\", "10", ";", " ", " ", " ", " ", "1", " ", "if", " ", "Na", "N", "\\", "10", ";", " ", " ", " ", " ", "2", " ", "if", " ", "s", "Na", "N", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "=_", "self_", "._", "\\u", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exp_", "==_", "'", "n", "'_", ":_", "\\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_", "elif_", "exp_", "==_", "'", "N", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "isinf", "init", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "whe", "ther", " ", "the", " ", "number", " ", "is", " ", "infini", "te", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "finite", " ", "or", " ", "not", " ", "a", " ", "number", "\\", "10", ";", " ", " ", " ", " ", "1", " ", "if", " ", "+", "INF", "\\", "10", ";", " ", " ", " ", " ", "-1", " ", "if", " ", "-", "INF", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "sign_", ":_", "\\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_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "nans", "_", "(_", "self_", ",_", "other_", "=_", "None_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "whe", "ther", " ", "the", " ", "number", " ", "is", " ", "not", " ", "actual", "ly", " ", "one", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ",", " ", "other", " ", "are", " ", "s", "Na", "N", ",", " ", "signal", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ",", " ", "other", " ", "are", " ", "Na", "N", " ", "return", " ", "nan", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Don", "e", " ", "bef", "ore", " ", "operati", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self", "\\u", "is", "\\u", "nan_", "=_", "self_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other", "\\u", "is", "\\u", "nan_", "=_", "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 ", " _", "other", "\\u", "is", "\\u", "nan_", "=_", "other_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "is", "\\u", "nan_", "or_", "other", "\\u", "is", "\\u", "nan_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "is", "\\u", "nan_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "s", "Na", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other", "\\u", "is", "\\u", "nan_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "s", "Na", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "is", "\\u", "nan_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fix", "\\u", "nan_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "other_", "._", "\\u", "fix", "\\u", "nan_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "compare", "\\u", "check", "\\u", "nans", "_", "(_", "self_", ",_", "other_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Version", " ", "of", " ", "\\u", "check", "\\u", "nans", " ", "used", " ", "for", " ", "the", " ", "signal", "ing", " ", "comparisons", "\\", "10", ";", " ", " ", " ", " ", "compare", "\\u", "signal", ",", " ", "\\u\\u", "le", "\\u\\u", ",", " ", "\\u\\u", "lt", "\\u\\u", ",", " ", "\\u\\u", "ge", "\\u\\u", ",", " ", "\\u\\u", "gt", "\\u\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Signal", " ", "Inva", "lid", "Opera", "tion", " ", "if", " ", "eit", "her", " ", "self", " ", "or", " ", "other", " ", "is", " ", "a", " ", "(", "quie", "t", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "signal", "ing", ")", " ", "Na", "N", ".", " ", " ", "Signal", "ing", " ", "Na", "Ns", " ", "take", " ", "preceden", "ce", " ", "over", " ", "quie", "t", "\\", "10", ";", " ", " ", " ", " ", "Na", "Ns", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "0", " ", "if", " ", "nei", "ther", " ", "operand", " ", "is", " ", "a", " ", "Na", "N", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "sna", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compa", "ris", "on", " ", "involv", "ing", " ", "s", "Na", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "other_", "._", "is", "\\u", "sna", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compa", "ris", "on", " ", "involv", "ing", " ", "s", "Na", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "qna", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compa", "ris", "on", " ", "involv", "ing", " ", "Na", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "other_", "._", "is", "\\u", "qna", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compa", "ris", "on", " ", "involv", "ing", " ", "Na", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "nonzero\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "nonzero", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Na", "Ns", " ", "and", " ", "infini", "ties", " ", "are", " ", "consider", "ed", " ", "nonzero", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "self_", "._", "\\u", "int_", "!=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cmp_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compare", " ", "the", " ", "two", " ", "non", "-", "Na", "N", " ", "decima", "l", " ", "instance", "s", " ", "self", " ", "and", " ", "other", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "-1", " ", "if", " ", "self", " ", "<", " ", "other", ",", " ", "0", " ", "if", " ", "self", " ", "==", " ", "other", " ", "and", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", " ", ">", " ", "other", ".", " ", " ", "Thi", "s", " ", "routin", "e", " ", "is", " ", "for", " ", "internal", " ", "use", " ", "only", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self", "\\u", "inf_", "=_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "inf_", "=_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self", "\\u", "inf_", "==_", "other", "\\u", "inf_", ":_", "\\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_", "elif_", "self", "\\u", "inf_", "<_", "other", "\\u", "inf_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "zero", "s", ";", " ", " ", "Deci", "mal", "('", "0", "')", " ", "==", " ", "Deci", "mal", "('", "-0", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "other_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "(_", "(_", "-_", "1_", ")_", "**_", "other_", "._", "\\u", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "-_", "1_", ")_", "**_", "self_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "different", " ", "signs", ",", " ", "neg", " ", "one", " ", "is", " ", "less_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "sign_", "<_", "self_", "._", "\\u", "sign_", ":_", "\\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_", "if_", "self_", "._", "\\u", "sign_", "<_", "other_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self", "\\u", "adjusted", "_", "=_", "self_", "._", "adjusted", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "adjusted", "_", "=_", "other_", "._", "adjusted", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self", "\\u", "adjusted", "_", "==_", "other", "\\u", "adjusted", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self", "\\u", "padde", "d_", "=_", "self_", "._", "\\u", "int_", "+_", "'", "0", "'_", "*_", "(_", "self_", "._", "\\u", "exp_", "-_", "other_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "padde", "d_", "=_", "other_", "._", "\\u", "int_", "+_", "'", "0", "'_", "*_", "(_", "other_", "._", "\\u", "exp_", "-_", "self_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self", "\\u", "padde", "d_", "==_", "other", "\\u", "padde", "d_", ":_", "\\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_", "elif_", "self", "\\u", "padde", "d_", "<_", "other", "\\u", "padde", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "(_", "-_", "1_", ")_", "**_", "self_", "._", "\\u", "sign_", "\\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_", "(_", "-_", "1_", ")_", "**_", "self_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self", "\\u", "adjusted", "_", ">_", "other", "\\u", "adjusted", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "-_", "1_", ")_", "**_", "self_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "self", "\\u", "adjusted", " ", "<", " ", "other", "\\u", "adjusted", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "(_", "(_", "-_", "1_", ")_", "**_", "self_", "._", "\\u", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "allow", "\\u", "float_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", ":_", "\\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_", "return_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "allow", "\\u", "float_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", ":_", "\\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_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", "!=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\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_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "allow", "\\u", "float_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "compare", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\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_", "return_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", "<_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "le", "\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "allow", "\\u", "float_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "compare", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\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_", "return_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", "<=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "gt", "\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "allow", "\\u", "float_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "compare", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\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_", "return_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ge", "\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "allow", "\\u", "float_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "compare", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\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_", "return_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", ">=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compare_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compare", "s", " ", "one", " ", "to", " ", "anot", "her", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-1", " ", "=>", " ", "a", " ", "<", " ", "b", "\\", "10", ";", " ", " ", " ", " ", "0", " ", " ", "=>", " ", "a", " ", "=", " ", "b", "\\", "10", ";", " ", " ", " ", " ", "1", " ", " ", "=>", " ", "a", " ", ">", " ", "b", "\\", "10", ";", " ", " ", " ", " ", "Na", "N", " ", "=>", " ", "one", " ", "is", " ", "Na", "N", "\\", "10", ";", " ", " ", " ", " ", "Lik", "e", " ", "\\u\\u", "cmp", "\\u\\u", ",", " ", "but", " ", "return", "s", " ", "Deci", "mal", " ", "instance", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compare", "(", "Na", "N", ",", " ", "Na", "N", ")", " ", "=", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "and_", "other_", "._", "\\u", "is", "\\u", "special_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\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_", "Decimal_", "(_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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 ", " _", "\"\"\"", "x", ".\\u", "\\u", "hash", "\\u\\u()", " ", "<=", "=>", " ", "hash", "(", "x", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Deci", "mal", " ", "integ", "ers", " ", "must", " ", "hash", " ", "the", " ", "same", " ", "as", " ", "the", " ", "ints_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "hash", " ", "of", " ", "a", " ", "nons", "pec", "ial", " ", "non", "integ", "er", " ", "Deci", "mal", " ", "must", " ", "depend", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "the", " ", "value", " ", "of", " ", "tha", "t", " ", "Deci", "mal", ",", " ", "and", " ", "not", " ", "on", " ", "its", " ", "represent", "ation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "example", ":", " ", "hash", "(", "Deci", "mal", "('", "100", "E-", "1", "'))", " ", "==", " ", "hash", "(", "Deci", "mal", "('", "10", "'))", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Equali", "ty", " ", "comparisons", " ", "involv", "ing", " ", "signal", "ing", " ", "nans", " ", "can", " ", "raise", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exception", ";", " ", "sinc", "e", " ", "equality", " ", "checks", " ", "are", " ", "implicit", "ly", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unpr", "edic", "tab", "ly", " ", "used", " ", "whe", "n", " ", "checking", " ", "set", " ", "and", " ", "dict", " ", "member", "ship", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prevent", " ", "signal", "ing", " ", "nans", " ", "from", " ", "bei", "ng", " ", "used", " ", "as", " ", "set", " ", "element", "s", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dict", " ", "keys", " ", "by", " ", "mak", "ing", " ", "\\u\\u", "hash", "\\u\\u", " ", "raise", " ", "an", " ", "exception", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "sna", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Cann", "ot", " ", "hash", " ", "a", " ", "signal", "ing", " ", "Na", "N", " ", "value", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "nan_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "0", " ", "to", " ", "match", " ", "hash", "(", "float", "('", "nan", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "values", " ", "chosen", " ", "to", " ", "match", " ", "hash", "(", "float", "('", "inf", "'))", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hash", "(", "float", "('", "-", "inf", "'))", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "-_", "271", "828", "_", "\\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_", "314", "159_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "Pyth", "on", " ", "2.7", ",", " ", "we", "'", "re", " ", "allow", "ing", " ", "comparisons", " ", "(", "but", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "arithmetic", " ", "operati", "ons", ")", " ", "bet", "ween", " ", "float", "s", " ", "and", " ", "Deci", "mal", "s", ";", " ", " ", "so", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "Deci", "mal", " ", "instance", " ", "is", " ", "exact", "ly", " ", "represent", "able", " ", "as", " ", "a", " ", "float", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "its", " ", "hash", " ", "shou", "ld", " ", "match", " ", "tha", "t", " ", "of", " ", "the", " ", "float", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self", "\\u", "as", "\\u", "float_", "=_", "float_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Decimal_", "._", "from", "\\u", "float_", "(_", "self", "\\u", "as", "\\u", "float_", ")_", "==_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "self", "\\u", "as", "\\u", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isin", "teg", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "do", " ", "this", " ", "different", "ly", " ", "in", " ", "Jy", "tho", "n", " ", "due", " ", "to", " ", "the", " ", "different", " ", "maxi", "nt", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "long_", "(_", "self_", "._", "to", "\\u", "integral", "\\u", "value_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "value", " ", "of", " ", "a", " ", "nonzero", " ", "nons", "pec", "ial", " ", "Deci", "mal", " ", "instance", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fai", "th", "full", "y", " ", "represent", "ed", " ", "by", " ", "the", " ", "triple", " ", "consi", "stin", "g", " ", "of", " ", "its", " ", "sign", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "its", " ", "adjusted", " ", "expon", "ent", ",", " ", "and", " ", "its", " ", "coefficient", " ", "with", " ", "trail", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "zero", "s", " ", "remove", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "hash_", "(_", "(_", "self_", "._", "\\u", "sign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "exp_", "+_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "int_", "._", "rstrip_", "(_", "'", "0", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "as", "\\u", "tuple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "the", " ", "number", " ", "as", " ", "a", " ", "triple", " ", "tuple", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "show", " ", "the", " ", "internals", " ", "exact", "ly", " ", "as", " ", "the", "y", " ", "are", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Deci", "mal", "Tuple_", "(_", "self_", "._", "\\u", "sign_", ",_", "tuple_", "(_", "map_", "(_", "int_", ",_", "self_", "._", "\\u", "int_", ")_", ")_", ",_", "self_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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 ", " _", "\"\"\"", "Represent", "s", " ", "the", " ", "number", " ", "as", " ", "an", " ", "instance", " ", "of", " ", "Deci", "mal", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Inva", "rian", "t", ":", " ", " ", "eval", "(", "repr", "(", "d", "))", " ", "==", " ", "d_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"", "Deci", "mal", "('", "%", "s", "')\"_", "%_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ",_", "eng_", "=_", "False_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "string", " ", "represent", "ation", " ", "of", " ", "the", " ", "number", " ", "in", " ", "scienti", "fic", " ", "notation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Captur", "es", " ", "all", " ", "of", " ", "the", " ", "informati", "on", " ", "in", " ", "the", " ", "underl", "ying", " ", "represent", "ation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sign_", "=_", "[_", "''_", ",_", "'-'_", "]_", "[_", "self_", "._", "\\u", "sign_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "exp_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sign_", "+_", "'", "Infinit", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "exp_", "==_", "'", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sign_", "+_", "'", "Na", "N", "'_", "+_", "self_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "self", ".\\u", "exp", " ", "==", " ", "'", "N", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sign_", "+_", "'", "s", "Na", "N", "'_", "+_", "self_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "digit", "s", " ", "of", " ", "self", ".\\u", "int", " ", "to", " ", "left", " ", "of", " ", "decima", "l", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "left", "digits_", "=_", "self_", "._", "\\u", "exp_", "+_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dot", "place", " ", "is", " ", "number", " ", "of", " ", "digit", "s", " ", "of", " ", "self", ".\\u", "int", " ", "to", " ", "the", " ", "left", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "decima", "l", " ", "point", " ", "in", " ", "the", " ", "mant", "issa", " ", "of", " ", "the", " ", "output", " ", "string", " ", "(", "tha", "t", " ", "is", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "after", " ", "adjust", "ing", " ", "the", " ", "expon", "ent", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", "<=_", "0_", "and_", "left", "digits_", ">_", "-_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "expon", "ent", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "place_", "=_", "left", "digits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "eng_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "usual", " ", "scienti", "fic", " ", "notation", ":", " ", "1", " ", "digit", " ", "on", " ", "left", " ", "of", " ", "the", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "place_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "int_", "==_", "'", "0", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "engineer", "ing", " ", "notation", ",", " ", "zero_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "place_", "=_", "(_", "left", "digits_", "+_", "1_", ")_", "%_", "3_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "engineer", "ing", " ", "notation", ",", " ", "nonzero_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "place_", "=_", "(_", "left", "digits_", "-_", "1_", ")_", "%_", "3_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dot", "place_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "intp", "art_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frac", "part_", "=_", "'.'_", "+_", "'", "0", "'_", "*_", "(_", "-_", "dot", "place_", ")_", "+_", "self_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dot", "place_", ">=_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "intp", "art_", "=_", "self_", "._", "\\u", "int_", "+_", "'", "0", "'_", "*_", "(_", "dot", "place_", "-_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frac", "part_", "=_", "''_", "\\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 ", " _", "intp", "art_", "=_", "self_", "._", "\\u", "int_", "[_", ":_", "dot", "place_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frac", "part_", "=_", "'.'_", "+_", "self_", "._", "\\u", "int_", "[_", "dot", "place_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "left", "digits_", "==_", "dot", "place_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "=_", "''_", "\\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_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exp_", "=_", "[_", "'", "e", "'_", ",_", "'", "E", "'_", "]_", "[_", "context_", "._", "capital", "s_", "]_", "+_", "\"%", "+", "d", "\"_", "%_", "(_", "left", "digits_", "-_", "dot", "place_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sign_", "+_", "intp", "art_", "+_", "frac", "part_", "+_", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "eng", "\\u", "string_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "to", " ", "engineer", "ing", "-", "type", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Engine", "erin", "g", " ", "notation", " ", "has", " ", "an", " ", "expon", "ent", " ", "whi", "ch", " ", "is", " ", "a", " ", "multiple", " ", "of", " ", "3", ",", " ", "so", " ", "there", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "up", " ", "to", " ", "3", " ", "digit", "s", " ", "left", " ", "of", " ", "the", " ", "decima", "l", " ", "place", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sam", "e", " ", "rule", "s", " ", "for", " ", "whe", "n", " ", "in", " ", "exponential", " ", "and", " ", "whe", "n", " ", "as", " ", "a", " ", "value", " ", "as", " ", "in", " ", "\\u\\u", "str", "\\u\\u", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "str\\u\\u_", "(_", "eng_", "=_", "True_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "neg", "\\u\\u_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "copy", " ", "with", " ", "the", " ", "sign", " ", "switche", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Round", "s", ",", " ", "if", " ", "it", " ", "has", " ", "reason", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\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_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-", "Deci", "mal", "('", "0", "')", " ", "is", " ", "Deci", "mal", "('", "0", "')", ",", " ", "not", " ", "Deci", "mal", "('", "-0", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "copy", "\\u", "abs_", "(_", ")_", "\\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 ", " _", "ans_", "=_", "self_", "._", "copy", "\\u", "negate", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "pos", "\\u\\u_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "copy", ",", " ", "unl", "ess", " ", "it", " ", "is", " ", "a", " ", "s", "Na", "N", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Round", "s", " ", "the", " ", "number", " ", "(", "if", " ", "more", " ", "then", " ", "preci", "sion", " ", "digit", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\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_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "+", " ", "(-", "0", ")", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "copy", "\\u", "abs_", "(_", ")_", "\\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 ", " _", "ans_", "=_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "abs", "\\u\\u_", "(_", "self_", ",_", "round_", "=_", "True_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "abs", "olute", " ", "value", " ", "of", " ", "self", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "keyw", "ord", " ", "argu", "ment", " ", "'", "round", "'", " ", "is", " ", "fal", "se", ",", " ", "do", " ", "not", " ", "round", ".", " ", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "express", "ion", " ", "self", ".\\u", "\\u", "abs", "\\u\\u", "(", "round", "=", "Fal", "se", ")", " ", "is", " ", "equivalent", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "copy", "\\u", "abs", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "round_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "copy", "\\u", "abs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\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_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u\\u", "neg", "\\u\\u_", "(_", "context_", "=_", "context_", ")_", "\\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 ", " _", "ans_", "=_", "self_", "._", "\\u\\u", "pos", "\\u\\u_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "self", " ", "+", " ", "other", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", "INF", " ", "+", " ", "INF", " ", "(", "or", " ", "the", " ", "reverse", ")", " ", "caus", "e", " ", "Inva", "lid", "Opera", "tion", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "bot", "h", " ", "INF", ",", " ", "same", " ", "sign", " ", "=>", " ", "same", " ", "as", " ", "bot", "h", ",", " ", "opposite", " ", "=>", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "sign_", "!=_", "other_", "._", "\\u", "sign_", "and_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'-", "INF", " ", "+", " ", "INF", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "other_", ")_", "#", " ", "Can", "'", "t", " ", "bot", "h", " ", "be", " ", "infinity", " ", "here_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exp_", "=_", "min_", "(_", "self_", "._", "\\u", "exp_", ",_", "other_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "negati", "ve", "zero_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "._", "rounding", "_", "==_", "ROUND", "\\u", "FLO", "OR_", "and_", "self_", "._", "\\u", "sign_", "!=_", "other_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "answer", " ", "is", " ", "0", ",", " ", "the", " ", "sign", " ", "shou", "ld", " ", "be", " ", "negati", "ve", ",", " ", "in", " ", "this", " ", "case", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "negati", "ve", "zero_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "and_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "min_", "(_", "self_", "._", "\\u", "sign_", ",_", "other_", "._", "\\u", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "negati", "ve", "zero_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "sign_", ",_", "'", "0", "'_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "=_", "max_", "(_", "exp_", ",_", "other_", "._", "\\u", "exp_", "-_", "context_", "._", "prec_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "other_", "._", "\\u", "rescale", "_", "(_", "exp_", ",_", "context_", "._", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "=_", "max_", "(_", "exp_", ",_", "self_", "._", "\\u", "exp_", "-_", "context_", "._", "prec_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "rescale", "_", "(_", "exp_", ",_", "context_", "._", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "op1_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op2_", "=_", "\\u", "Work", "Rep", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op1_", ",_", "op2_", "=_", "\\u", "normalize_", "(_", "op1_", ",_", "op2_", ",_", "context_", "._", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "\\u", "Work", "Rep", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "op1_", "._", "sign_", "!=_", "op2_", "._", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Equal", " ", "and", " ", "opposite", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "op1_", "._", "int_", "==_", "op2_", "._", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "negati", "ve", "zero_", ",_", "'", "0", "'_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "op1_", "._", "int_", "<_", "op2_", "._", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op1_", ",_", "op2_", "=_", "op2_", ",_", "op1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "OK", ",", " ", "now", " ", "abs", "(", "op", "1", ")", " ", ">", " ", "abs", "(", "op", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "op1_", "._", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "sign_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op1_", "._", "sign_", ",_", "op2_", "._", "sign_", "=_", "op2_", "._", "sign_", ",_", "op1_", "._", "sign_", "\\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 ", " _", "result_", "._", "sign_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "So", " ", "we", " ", "know", " ", "the", " ", "sign", ",", " ", "and", " ", "op", "1", " ", ">", " ", "0._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "op1_", "._", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "sign_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op1_", "._", "sign_", ",_", "op2_", "._", "sign_", "=_", "(_", "0_", ",_", "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 ", " _", "result_", "._", "sign_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "op", "1", " ", ">", " ", "abs", "(", "op", "2", ")", " ", ">", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "op2_", "._", "sign_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "int_", "=_", "op1_", "._", "int_", "+_", "op2_", "._", "int_", "\\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 ", " _", "result_", "._", "int_", "=_", "op1_", "._", "int_", "-_", "op2_", "._", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "exp_", "=_", "op1_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "Decimal_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "self", " ", "-", " ", "other", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", " ", "-", " ", "other", " ", "is", " ", "compute", "d", " ", "as", " ", "self", " ", "+", " ", "other", ".", "copy", "\\u", "negate", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "add\\u\\u_", "(_", "other_", "._", "copy", "\\u", "negate", "_", "(_", ")_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rsu", "b", "\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "other", " ", "-", " ", "self", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "other_", "._", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "mul\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "self", " ", "*", " ", "other", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "+-", ")", " ", "INF", " ", "*", " ", "0", " ", "(", "or", " ", "its", " ", "reverse", ")", " ", "raise", " ", "Inva", "lid", "Opera", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results", "ign_", "=_", "self_", "._", "\\u", "sign_", "^_", "other_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'(", "+-", ")", "INF", " ", "*", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "results", "ign_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "0", " ", "*", " ", "(", "+-", ")", "INF", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "results", "ign_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result", "exp_", "=_", "self_", "._", "\\u", "exp_", "+_", "other_", "._", "\\u", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Special", " ", "case", " ", "for", " ", "multipl", "ying", " ", "by", " ", "zero_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "or_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "results", "ign_", ",_", "'", "0", "'_", ",_", "result", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fix", "ing", " ", "in", " ", "case", " ", "the", " ", "expon", "ent", " ", "is", " ", "out", " ", "of", " ", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Special", " ", "case", " ", "for", " ", "multipl", "ying", " ", "by", " ", "power", " ", "of", " ", "10_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "int_", "==_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "results", "ign_", ",_", "other_", "._", "\\u", "int_", ",_", "result", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "int_", "==_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "results", "ign_", ",_", "self_", "._", "\\u", "int_", ",_", "result", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "op1_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op2_", "=_", "\\u", "Work", "Rep", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "results", "ign_", ",_", "str_", "(_", "op1_", "._", "int_", "*_", "op2_", "._", "int_", ")_", ",_", "result", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "true", "div\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "self", " ", "/", " ", "other", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sign_", "=_", "self_", "._", "\\u", "sign_", "^_", "other_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "and_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'(", "+-", ")", "INF", "/(", "+-", ")", "INF", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "sign_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Cla", "mpe", "d_", ",_", "'", "Divis", "ion", " ", "by", " ", "infinity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "sign_", ",_", "'", "0", "'_", ",_", "context_", "._", "Et", "in", "y_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Special", " ", "case", "s", " ", "for", " ", "zero", "es_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "Unde", "fined", "_", ",_", "'", "0", " ", "/", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "By", "Zero_", ",_", "'", "x", " ", "/", " ", "0", "'_", ",_", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "=_", "self_", "._", "\\u", "exp_", "-_", "other_", "._", "\\u", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeff_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "OK", ",", " ", "so", " ", "nei", "ther", " ", "=", " ", "0", ",", " ", "INF", " ", "or", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shift_", "=_", "len_", "(_", "other_", "._", "\\u", "int_", ")_", "-_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "+_", "context_", "._", "prec_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp_", "=_", "self_", "._", "\\u", "exp_", "-_", "other_", "._", "\\u", "exp_", "-_", "shift_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op1_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op2_", "=_", "\\u", "Work", "Rep", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shift_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeff_", ",_", "remainder_", "=_", "divmod_", "(_", "op1_", "._", "int_", "*_", "10_", "**_", "shift_", ",_", "op2_", "._", "int_", ")_", "\\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 ", " _", "coeff_", ",_", "remainder_", "=_", "divmod_", "(_", "op1_", "._", "int_", ",_", "op2_", "._", "int_", "*_", "10_", "**_", "-_", "shift_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "remainder_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "result", " ", "is", " ", "not", " ", "exact", ";", " ", "adjust", " ", "to", " ", "ensure", " ", "correct", " ", "rounding", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "coeff_", "%_", "5_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coeff_", "+=_", "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_", "#", " ", "result", " ", "is", " ", "exact", ";", " ", "get", " ", "as", " ", "close", " ", "to", " ", "ideal", " ", "expon", "ent", " ", "as", " ", "possible_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ideal", "\\u", "exp_", "=_", "self_", "._", "\\u", "exp_", "-_", "other_", "._", "\\u", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "exp_", "<_", "ideal", "\\u", "exp_", "and_", "coeff_", "%_", "10_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coeff_", "//", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp_", "+=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "sign_", ",_", "str_", "(_", "coeff_", ")_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "divide_", "(_", "self_", ",_", "other_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "(", "self", " ", "//", " ", "other", ",", " ", "self", " ", "%", " ", "other", "),", " ", "to", " ", "context", ".", "prec", " ", "preci", "sion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Assume", "s", " ", "tha", "t", " ", "nei", "ther", " ", "self", " ", "nor", " ", "other", " ", "is", " ", "a", " ", "Na", "N", ",", " ", "tha", "t", " ", "self", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "infini", "te", " ", "and", " ", "tha", "t", " ", "other", " ", "is", " ", "nonzero", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sign_", "=_", "self_", "._", "\\u", "sign_", "^_", "other_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ideal", "\\u", "exp_", "=_", "self_", "._", "\\u", "exp_", "\\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 ", " _", "ideal", "\\u", "exp_", "=_", "min_", "(_", "self_", "._", "\\u", "exp_", ",_", "other_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exp", "diff_", "=_", "self_", "._", "adjusted", "_", "(_", ")_", "-_", "other_", "._", "adjusted", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "or_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "or_", "exp", "diff_", "<=_", "-_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "sign_", ",_", "'", "0", "'_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "rescale", "_", "(_", "ideal", "\\u", "exp_", ",_", "context_", "._", "rounding", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exp", "diff_", "<=_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op1_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op2_", "=_", "\\u", "Work", "Rep", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "op1_", "._", "exp_", ">=_", "op2_", "._", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op1_", "._", "int_", "*=_", "10_", "**_", "(_", "op1_", "._", "exp_", "-_", "op2_", "._", "exp_", ")_", "\\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 ", " _", "op2_", "._", "int_", "*=_", "10_", "**_", "(_", "op2_", "._", "exp_", "-_", "op1_", "._", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q_", ",_", "r_", "=_", "divmod_", "(_", "op1_", "._", "int_", ",_", "op2_", "._", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", "<_", "10_", "**_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "sign_", ",_", "str_", "(_", "q_", ")_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "str_", "(_", "r_", ")_", ",_", "ideal", "\\u", "exp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Her", "e", " ", "the", " ", "quot", "ient", " ", "is", " ", "too", " ", "large", " ", "to", " ", "be", " ", "represent", "able_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "Imp", "oss", "ible_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quot", "ient", " ", "too", " ", "large", " ", "in", " ", "//", ",", " ", "%", " ", "or", " ", "div", "mod", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", ",_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rtr", "ued", "iv", "\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Swa", "ps", " ", "self", "/", "other", " ", "and", " ", "return", "s", " ", "\\u\\u", "true", "div", "\\u\\u", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "other_", "._", "\\u\\u", "true", "div\\u\\u_", "(_", "self_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "div", "mod", "\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "(", "self", " ", "//", " ", "other", ",", " ", "self", " ", "%", " ", "other", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "ans_", ",_", "ans_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sign_", "=_", "self_", "._", "\\u", "sign_", "^_", "other_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "div", "mod", "(", "INF", ",", " ", "INF", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", ",_", "ans_", "\\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_", "(_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "sign_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "INF", " ", "%", " ", "x", "'_", ")_", ")_", "\\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_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "Unde", "fined", "_", ",_", "'", "div", "mod", "(", "0", ",", " ", "0", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", ",_", "ans_", "\\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_", "(_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "By", "Zero_", ",_", "'", "x", " ", "//", " ", "0", "'_", ",_", "sign_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "x", " ", "%", " ", "0", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quot", "ient_", ",_", "remainder_", "=_", "self_", "._", "\\u", "divide_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remainder_", "=_", "remainder_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "quot", "ient_", ",_", "remainder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rdi", "vmo", "d\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Swa", "ps", " ", "self", "/", "other", " ", "and", " ", "return", "s", " ", "\\u\\u", "div", "mod", "\\u\\u", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "other_", "._", "\\u\\u", "div", "mod", "\\u\\u_", "(_", "self_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "mod", "\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "self", " ", "%", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "INF", " ", "%", " ", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "x", " ", "%", " ", "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 ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "Unde", "fined", "_", ",_", "'", "0", " ", "%", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remainder_", "=_", "self_", "._", "\\u", "divide_", "(_", "other_", ",_", "context_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remainder_", "=_", "remainder_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "remainder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rmo", "d\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Swa", "ps", " ", "self", "/", "other", " ", "and", " ", "return", "s", " ", "\\u\\u", "mod", "\\u\\u", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "other_", "._", "\\u\\u", "mod", "\\u\\u_", "(_", "self_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remainder", "\\u", "near_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rema", "inde", "r", " ", "near", "est", " ", "to", " ", "0", "-", " ", " ", "abs", "(", "remainder", "-", "near", ")", " ", "<=", " ", "other", "/", "2", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", " ", "==", " ", "+/-", "infinity", " ", "->", " ", "Inva", "lid", "Operation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remainder", "\\u", "near", "(", "infinity", ",", " ", "x", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "==", " ", "0", " ", "->", " ", "eit", "her", " ", "Inva", "lid", "Opera", "tion", " ", "or", " ", "Divis", "ion", "Unde", "fined", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remainder", "\\u", "near", "(", "x", ",", " ", "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 ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "Unde", "fined", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remainder", "\\u", "near", "(", "0", ",", " ", "0", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "=", " ", "+/-", "infinity", " ", "->", " ", "remainder", " ", "=", " ", "self_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", " ", "=", " ", "0", " ", "->", " ", "remainder", " ", "=", " ", "self", ",", " ", "with", " ", "ideal", " ", "exponent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ideal", "\\u", "exponent_", "=_", "min_", "(_", "self_", "._", "\\u", "exp_", ",_", "other_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "ideal", "\\u", "exponent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "catch", " ", "most", " ", "case", "s", " ", "of", " ", "large", " ", "or", " ", "small", " ", "quot", "ient_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exp", "diff_", "=_", "self_", "._", "adjusted", "_", "(_", ")_", "-_", "other_", "._", "adjusted", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exp", "diff_", ">=_", "context_", "._", "prec_", "+_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exp", "diff", " ", ">=", " ", "prec", "+", "1", " ", "=>", " ", "abs", "(", "self", "/", "other", ")", " ", ">", " ", "10", "**", "prec_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "Imp", "oss", "ible_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exp", "diff_", "<=_", "-_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exp", "diff", " ", "<=", " ", "-", "2", " ", "=>", " ", "abs", "(", "self", "/", "other", ")", " ", "<", " ", "0.1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "rescale", "_", "(_", "ideal", "\\u", "exponent_", ",_", "context_", "._", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adjust", " ", "bot", "h", " ", "argu", "ment", "s", " ", "to", " ", "have", " ", "the", " ", "same", " ", "expon", "ent", ",", " ", "then", " ", "divide_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "op1_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op2_", "=_", "\\u", "Work", "Rep", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "op1_", "._", "exp_", ">=_", "op2_", "._", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op1_", "._", "int_", "*=_", "10_", "**_", "(_", "op1_", "._", "exp_", "-_", "op2_", "._", "exp_", ")_", "\\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 ", " _", "op2_", "._", "int_", "*=_", "10_", "**_", "(_", "op2_", "._", "exp_", "-_", "op1_", "._", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q_", ",_", "r_", "=_", "divmod_", "(_", "op1_", "._", "int_", ",_", "op2_", "._", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remainder", " ", "is", " ", "r", "*", "10", "**", "ideal", "\\u", "expon", "ent", ";", " ", "other", " ", "is", " ", "+/-", "op", "2", ".", "int", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "10", "**", "ideal", "\\u", "expon", "ent", ".", " ", " ", " ", "Apply", " ", "correcti", "on", " ", "to", " ", "ensure", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "abs", "(", "remainder", ")", " ", "<=", " ", "abs", "(", "other", ")/", "2_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "2_", "*_", "r_", "+_", "(_", "q_", "&_", "1_", ")_", ">_", "op2_", "._", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "-=_", "op2_", "._", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "q_", ">=_", "10_", "**_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "Imp", "oss", "ible_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", " ", "has", " ", "same", " ", "sign", " ", "as", " ", "self", " ", "unl", "ess", " ", "r", " ", "is", " ", "negative_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sign_", "=_", "self_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "1_", "-_", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "-_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "sign_", ",_", "str_", "(_", "r_", ")_", ",_", "ideal", "\\u", "exponent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "floor", "div\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "self", " ", "//", " ", "other", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "INF", " ", "//", " ", "INF", "'_", ")_", "\\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_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "self_", "._", "\\u", "sign_", "^_", "other_", "._", "\\u", "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_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "By", "Zero_", ",_", "'", "x", " ", "//", " ", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "sign_", "^_", "other_", "._", "\\u", "sign_", ")_", "\\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_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "Unde", "fined", "_", ",_", "'", "0", " ", "//", " ", "0", "'_", ")_", "\\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_", "self_", "._", "\\u", "divide_", "(_", "other_", ",_", "context_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rfl", "oor", "div\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Swa", "ps", " ", "self", "/", "other", " ", "and", " ", "return", "s", " ", "\\u\\u", "floor", "div", "\\u\\u", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "other_", "._", "\\u\\u", "floor", "div\\u\\u_", "(_", "self_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "float", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Float", " ", "represent", "ation", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "float_", "(_", "str_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "int\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", "s", " ", "self", " ", "to", " ", "an", " ", "int", ",", " ", "truncat", "ing", " ", "if", " ", "necessar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "isnan_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Cann", "ot", " ", "convert", " ", "Na", "N", " ", "to", " ", "integ", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Over", "flow", "Error_", "(_", "\"", "Cann", "ot", " ", "convert", " ", "infinity", " ", "to", " ", "integ", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "(_", "-_", "1_", ")_", "**_", "self_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "*_", "int_", "(_", "self_", "._", "\\u", "int_", ")_", "*_", "10_", "**_", "self_", "._", "\\u", "exp_", "\\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_", "*_", "int_", "(_", "self_", "._", "\\u", "int_", "[_", ":_", "self_", "._", "\\u", "exp_", "]_", "or_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "real_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "imag_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "conjugate", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "complex", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "complex_", "(_", "float_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "long", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", "s", " ", "to", " ", "a", " ", "long", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Equivalent", " ", "to", " ", "long", "(", "int", "(", "self", "))\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "long_", "(_", "self_", "._", "\\u\\u", "int\\u", "\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "fix", "\\u", "nan_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "De", "capi", "tate", " ", "the", " ", "payload", " ", "of", " ", "a", " ", "Na", "N", " ", "to", " ", "fit", " ", "the", " ", "context", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "self_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "maxim", "um", " ", "length", " ", "of", " ", "payload", " ", "is", " ", "preci", "sion", " ", "if", " ", "\\u", "clamp", "=", "0", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "preci", "sion", "-1", " ", "if", " ", "\\u", "clamp", "=", "1._", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "payload", "\\u", "len_", "=_", "context_", "._", "prec_", "-_", "context_", "._", "\\u", "clamp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "payload_", ")_", ">_", "max", "\\u", "payload", "\\u", "len_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "payload_", "=_", "payload_", "[_", "len_", "(_", "payload_", ")_", "-_", "max", "\\u", "payload", "\\u", "len_", ":_", "]_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "payload_", ",_", "self_", "._", "\\u", "exp_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "fix_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", " ", "if", " ", "it", " ", "is", " ", "necessar", "y", " ", "to", " ", "keep", " ", "self", " ", "within", " ", "prec", " ", "preci", "sion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Round", "s", " ", "and", " ", "fixes", " ", "the", " ", "expon", "ent", ".", " ", " ", "Do", "es", " ", "not", " ", "raise", " ", "on", " ", "a", " ", "s", "Na", "N", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "self", " ", "-", " ", "Deci", "mal", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "context", " ", "-", " ", "context", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "isnan_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "deca", "pit", "ate", " ", "payload", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fix", "\\u", "nan_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", " ", "is", " ", "+/-", "Infinit", "y", ";", " ", "return", " ", "unal", "tere", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "self", " ", "is", " ", "zero", " ", "then", " ", "expon", "ent", " ", "shou", "ld", " ", "be", " ", "bet", "ween", " ", "Et", "in", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ema", "x", " ", "if", " ", "\\u", "clamp", "==", "0", ",", " ", "and", " ", "bet", "ween", " ", "Et", "in", "y", " ", "and", " ", "Et", "op", " ", "if", " ", "\\u", "clamp", "==", "1._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Et", "in", "y_", "=_", "context_", "._", "Et", "in", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Et", "op_", "=_", "context_", "._", "Et", "op_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp", "\\u", "max_", "=_", "[_", "context_", "._", "Ema", "x_", ",_", "Et", "op_", "]_", "[_", "context_", "._", "\\u", "clamp", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "exp_", "=_", "min_", "(_", "max_", "(_", "self_", "._", "\\u", "exp_", ",_", "Et", "in", "y_", ")_", ",_", "exp", "\\u", "max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "exp_", "!=_", "self_", "._", "\\u", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Cla", "mpe", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "new", "\\u", "exp_", ")_", "\\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_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exp", "\\u", "min", " ", "is", " ", "the", " ", "smallest", " ", "allow", "able", " ", "expon", "ent", " ", "of", " ", "the", " ", "result", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "equal", " ", "to", " ", "max", "(", "self", ".", "adjusted", "()", "-", "context", ".", "prec", "+", "1", ",", " ", "Et", "in", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exp", "\\u", "min_", "=_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "+_", "self_", "._", "\\u", "exp_", "-_", "context_", "._", "prec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exp", "\\u", "min_", ">_", "Et", "op_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "overflow", ":", " ", "exp", "\\u", "min", " ", ">", " ", "Et", "op", " ", "iff", " ", "self", ".", "adjusted", "()", " ", ">", " ", "Ema", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Over", "flow_", ",_", "'", "above", " ", "Ema", "x", "'_", ",_", "self_", "._", "\\u", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Ine", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Round", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self", "\\u", "is", "\\u", "subn", "ormal", "_", "=_", "exp", "\\u", "min_", "<_", "Et", "in", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self", "\\u", "is", "\\u", "subn", "ormal", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp", "\\u", "min_", "=_", "Et", "in", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "round", " ", "if", " ", "self", " ", "has", " ", "too", " ", "many", " ", "digits_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", "<_", "exp", "\\u", "min_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digits_", "=_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "+_", "self_", "._", "\\u", "exp_", "-_", "exp", "\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "digits_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "'", "1", "'_", ",_", "exp", "\\u", "min_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "digits_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rounding", "\\u", "method_", "=_", "self_", "._", "\\u", "pick", "\\u", "rounding", "\\u", "function_", "[_", "context_", "._", "rounding", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changed_", "=_", "getattr_", "(_", "self_", ",_", "rounding", "\\u", "method_", ")_", "(_", "digits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeff_", "=_", "self_", "._", "\\u", "int_", "[_", ":_", "digits_", "]_", "or_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "changed_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeff_", "=_", "str_", "(_", "int_", "(_", "coeff_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "coeff_", ")_", ">_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coeff_", "=_", "coeff_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp", "\\u", "min_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "whe", "ther", " ", "the", " ", "rounding", " ", "pushed", " ", "the", " ", "expon", "ent", " ", "out", " ", "of", " ", "range_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exp", "\\u", "min_", ">_", "Et", "op_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Over", "flow_", ",_", "'", "above", " ", "Ema", "x", "'_", ",_", "self_", "._", "\\u", "sign_", ")_", "\\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 ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "coeff_", ",_", "exp", "\\u", "min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raise", " ", "the", " ", "appropr", "iate", " ", "signal", "s", ",", " ", "tak", "ing", " ", "care", " ", "to", " ", "respec", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "preceden", "ce", " ", "descri", "bed", " ", "in", " ", "the", " ", "specification_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "changed_", "and_", "self", "\\u", "is", "\\u", "subn", "ormal", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Under", "flow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "is", "\\u", "subn", "ormal", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Sub", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Ine", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Round", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "raise", " ", "Cla", "mpe", "d", " ", "on", " ", "under", "flow", " ", "to", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Cla", "mpe", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "is", "\\u", "subn", "ormal", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Sub", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fold", " ", "down", " ", "if", " ", "\\u", "clamp", " ", "==", " ", "1", " ", "and", " ", "self", " ", "has", " ", "too", " ", "few", " ", "digits_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "._", "\\u", "clamp", "_", "==_", "1_", "and_", "self_", "._", "\\u", "exp_", ">_", "Et", "op_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Cla", "mpe", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self", "\\u", "padde", "d_", "=_", "self_", "._", "\\u", "int_", "+_", "'", "0", "'_", "*_", "(_", "self_", "._", "\\u", "exp_", "-_", "Et", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "self", "\\u", "padde", "d_", ",_", "Et", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "here", " ", "self", " ", "was", " ", "represent", "able", " ", "to", " ", "begin", " ", "with", ";", " ", "return", " ", "unchanged", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "round", "\\u", "down_", "(_", "self_", ",_", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Al", "so", " ", "know", "n", " ", "as", " ", "round", "-", "towards", "-0", ",", " ", "truncat", "e", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "all", "\\u", "zeros_", "(_", "self_", "._", "\\u", "int_", ",_", "prec_", ")_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "\\u", "round", "\\u", "up_", "(_", "self_", ",_", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", "s", " ", "awa", "y", " ", "from", " ", "0.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "-_", "self_", "._", "\\u", "round", "\\u", "down_", "(_", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "round", "\\u", "half", "\\u", "up_", "(_", "self_", ",_", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", "s", " ", "5", " ", "up", " ", "(", "awa", "y", " ", "from", " ", "0", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "int_", "[_", "prec_", "]_", "in_", "'", "5678", "9", "'_", ":_", "\\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_", "elif_", "\\u", "all", "\\u", "zeros_", "(_", "self_", "._", "\\u", "int_", ",_", "prec_", ")_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "\\u", "round", "\\u", "half", "\\u", "down_", "(_", "self_", ",_", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", " ", "5", " ", "down", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "exact", "\\u", "half_", "(_", "self_", "._", "\\u", "int_", ",_", "prec_", ")_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "round", "\\u", "half", "\\u", "up_", "(_", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "\\u", "round", "\\u", "half", "\\u", "even_", "(_", "self_", ",_", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", " ", "5", " ", "to", " ", "even", ",", " ", "rest", " ", "to", " ", "near", "est", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "exact", "\\u", "half_", "(_", "self_", "._", "\\u", "int_", ",_", "prec_", ")_", "and_", "(_", "prec_", "==_", "0_", "or_", "self_", "._", "\\u", "int_", "[_", "prec_", "-_", "1_", "]_", "in_", "'", "024", "6", "8", "'_", ")_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "round", "\\u", "half", "\\u", "up_", "(_", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "\\u", "round", "\\u", "ceil", "ing_", "(_", "self_", ",_", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", "s", " ", "up", " ", "(", "not", " ", "awa", "y", " ", "from", " ", "0", " ", "if", " ", "negati", "ve", ".)", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "round", "\\u", "down_", "(_", "prec_", ")_", "\\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_", "._", "\\u", "round", "\\u", "down_", "(_", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "\\u", "round", "\\u", "floor_", "(_", "self_", ",_", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", "s", " ", "down", " ", "(", "not", " ", "towards", " ", "0", " ", "if", " ", "negati", "ve", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "round", "\\u", "down_", "(_", "prec_", ")_", "\\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_", "._", "\\u", "round", "\\u", "down_", "(_", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "\\u", "round", "\\u", "05", "up_", "(_", "self_", ",_", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", " ", "down", " ", "unl", "ess", " ", "digit", " ", "prec", "-1", " ", "is", " ", "0", " ", "or", " ", "5", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prec_", "and_", "self_", "._", "\\u", "int_", "[_", "prec_", "-_", "1_", "]_", "not_", "in_", "'", "05", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "round", "\\u", "down_", "(_", "prec_", ")_", "\\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_", "._", "\\u", "round", "\\u", "down_", "(_", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "fma", "_", "(_", "self_", ",_", "other_", ",_", "third_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fus", "ed", " ", "multipl", "y", "-", "add", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "self", "*", "other", "+", "third", " ", "with", " ", "no", " ", "rounding", " ", "of", " ", "the", " ", "intermediate", "\\", "10", ";", " ", " ", " ", " ", "product", " ", "self", "*", "other", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "self", " ", "and", " ", "other", " ", "are", " ", "multiplie", "d", " ", "tog", "ether", ",", " ", "with", " ", "no", " ", "rounding", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "result", ".", " ", " ", "The", " ", "third", " ", "operand", " ", "is", " ", "then", " ", "adde", "d", " ", "to", " ", "the", " ", "result", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "a", " ", "single", " ", "final", " ", "rounding", " ", "is", " ", "perform", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "product", ";", " ", "raise", " ", "Inva", "lid", "Opera", "tion", " ", "if", " ", "eit", "her", " ", "operand", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "signal", "ing", " ", "Na", "N", " ", "or", " ", "if", " ", "the", " ", "product", " ", "is", " ", "zero", " ", "times", " ", "infinity", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", "==_", "'", "N", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "s", "Na", "N", "'_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "exp_", "==_", "'", "N", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "s", "Na", "N", "'_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", "==_", "'", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "product_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "other_", "._", "\\u", "exp_", "==_", "'", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "product_", "=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "exp_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "INF", " ", "*", " ", "0", " ", "in", " ", "fma", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "product_", "=_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "self_", "._", "\\u", "sign_", "^_", "other_", "._", "\\u", "sign_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "other_", "._", "\\u", "exp_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "0", " ", "*", " ", "INF", " ", "in", " ", "fma", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "product_", "=_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "self_", "._", "\\u", "sign_", "^_", "other_", "._", "\\u", "sign_", "]_", "\\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 ", " _", "product_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", "^_", "other_", "._", "\\u", "sign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "int_", "(_", "self_", "._", "\\u", "int_", ")_", "*_", "int_", "(_", "other_", "._", "\\u", "int_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "exp_", "+_", "other_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "third_", "=_", "\\u", "convert", "\\u", "other_", "(_", "third_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "product_", "._", "\\u\\u", "add\\u\\u_", "(_", "third_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "power", "\\u", "modulo", "_", "(_", "self_", ",_", "other_", ",_", "modulo", "_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thre", "e", " ", "argu", "ment", " ", "version", " ", "of", " ", "\\u\\u", "pow", "\\u\\u\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "can", "'", "t", " ", "convert", " ", "other", " ", "and", " ", "modulo", " ", "to", " ", "Deci", "mal", ",", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Type", "Error", ";", " ", "there", "'", "s", " ", "no", " ", "point", " ", "return", "ing", " ", "Not", "Impl", "ement", "ed", " ", "(", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "equivalent", " ", "of", " ", "\\u\\u", "rpo", "w", "\\u\\u", " ", "for", " ", "three", " ", "argu", "ment", " ", "pow", ")_", "\\u\\u\\uNL\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modulo", "_", "=_", "\\u", "convert", "\\u", "other_", "(_", "modulo", "_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "deal", " ", "with", " ", "Na", "Ns", ":", " ", "if", " ", "there", " ", "are", " ", "any", " ", "s", "Na", "Ns", " ", "then", " ", "first", " ", "one", " ", "wins", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "i", ".", "e", ".", " ", "behaviour", " ", "for", " ", "Na", "Ns", " ", "is", " ", "identi", "cal", " ", "to", " ", "tha", "t", " ", "of", " ", "fma", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self", "\\u", "is", "\\u", "nan_", "=_", "self_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "is", "\\u", "nan_", "=_", "other_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modulo", "\\u", "is", "\\u", "nan_", "=_", "modulo", "_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self", "\\u", "is", "\\u", "nan_", "or_", "other", "\\u", "is", "\\u", "nan_", "or_", "modulo", "\\u", "is", "\\u", "nan_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self", "\\u", "is", "\\u", "nan_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "s", "Na", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other", "\\u", "is", "\\u", "nan_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "s", "Na", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modulo", "\\u", "is", "\\u", "nan_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "s", "Na", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modulo", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "is", "\\u", "nan_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "fix", "\\u", "nan_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other", "\\u", "is", "\\u", "nan_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "._", "\\u", "fix", "\\u", "nan_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "modulo", "_", "._", "\\u", "fix", "\\u", "nan_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "inputs", ":", " ", "we", " ", "appl", "y", " ", "same", " ", "restriction", "s", " ", "as", " ", "Pyth", "on", "'", "s", " ", "pow", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "self_", "._", "\\u", "isin", "teg", "er_", "(_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "other_", "._", "\\u", "isin", "teg", "er_", "(_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "modulo", "_", "._", "\\u", "isin", "teg", "er_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pow", "()", " ", "3", "rd", " ", "argu", "ment", " ", "not", " ", "allow", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unl", "ess", " ", "all", " ", "argu", "ment", "s", " ", "are", " ", "integ", "ers", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pow", "()", " ", "2n", "d", " ", "argu", "ment", " ", "cann", "ot", " ", "be", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "negati", "ve", " ", "whe", "n", " ", "3", "rd", " ", "argu", "ment", " ", "specified", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "modulo", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pow", "()", " ", "3", "rd", " ", "argu", "ment", " ", "cann", "ot", " ", "be", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addition", "al", " ", "restriction", " ", "for", " ", "decima", "l", ":", " ", "the", " ", "modulus", " ", "must", " ", "be", " ", "less_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "than", " ", "10", "**", "prec", " ", "in", " ", "abs", "olute", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modulo", "_", "._", "adjusted", "_", "(_", ")_", ">=_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "insuf", "ficient", " ", "preci", "sion", ":", " ", "pow", "()", " ", "3", "rd", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "argu", "ment", " ", "must", " ", "not", " ", "have", " ", "more", " ", "than", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "preci", "sion", " ", "digit", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "0", "**", "0", " ", "==", " ", "Na", "N", ",", " ", "for", " ", "consiste", "nc", "y", " ", "with", " ", "two", "-", "argu", "ment", " ", "pow_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "even", " ", "tho", "ugh", " ", "it", " ", "hur", "ts", "!)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "other_", "and_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "at", " ", "leas", "t", " ", "one", " ", "of", " ", "pow", "()", " ", "1s", "t", " ", "argu", "ment", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", " ", "2n", "d", " ", "argu", "ment", " ", "must", " ", "be", " ", "nonzero", " ", ";'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "0", "**", "0", " ", "is", " ", "not", " ", "defin", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "sign", " ", "of", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "ise", "ven", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "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 ", " _", "sign_", "=_", "self_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "modulo", " ", "to", " ", "a", " ", "Pyth", "on", " ", "integ", "er", ",", " ", "and", " ", "self", " ", "and", " ", "other", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Deci", "mal", " ", "integ", "ers", " ", "(", "i", ".", "e", ".", " ", "force", " ", "thei", "r", " ", "expon", "ents", " ", "to", " ", "be", " ", ">=", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modulo", "_", "=_", "abs_", "(_", "int_", "(_", "modulo", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", "._", "to", "\\u", "integral", "\\u", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exponent_", "=_", "\\u", "Work", "Rep", "_", "(_", "other_", "._", "to", "\\u", "integral", "\\u", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "result", " ", "usi", "ng", " ", "integ", "er", " ", "pow", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "(_", "base_", "._", "int_", "%_", "modulo", "_", "*_", "pow_", "(_", "10_", ",_", "base_", "._", "exp_", ",_", "modulo", "_", ")_", ")_", "%_", "modulo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "exponent_", "._", "exp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "pow_", "(_", "base_", ",_", "10_", ",_", "modulo", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "base_", "=_", "pow_", "(_", "base_", ",_", "exponent_", "._", "int_", ",_", "modulo", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "sign_", ",_", "str_", "(_", "base_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "power", "\\u", "exact_", "(_", "self_", ",_", "other_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Atte", "mpt", " ", "to", " ", "compute", " ", "self", "**", "other", " ", "exact", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "Deci", "mal", "s", " ", "self", " ", "and", " ", "other", " ", "and", " ", "an", " ", "integ", "er", " ", "p", ",", " ", "atte", "mpt", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "compute", " ", "an", " ", "exact", " ", "result", " ", "for", " ", "the", " ", "power", " ", "self", "**", "other", ",", " ", "with", " ", "p", "\\", "10", ";", " ", " ", " ", " ", "digit", "s", " ", "of", " ", "preci", "sion", ".", " ", " ", "Return", " ", "Non", "e", " ", "if", " ", "self", "**", "other", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "exact", "ly", " ", "represent", "able", " ", "in", " ", "p", " ", "digit", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Assume", "s", " ", "tha", "t", " ", "eliminat", "ion", " ", "of", " ", "special", " ", "case", "s", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", "\\", "10", ";", " ", " ", " ", " ", "perform", "ed", ":", " ", "self", " ", "and", " ", "other", " ", "must", " ", "bot", "h", " ", "be", " ", "nons", "pec", "ial", ";", " ", "self", " ", "must", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "posit", "ive", " ", "and", " ", "not", " ", "numerical", "ly", " ", "equal", " ", "to", " ", "1", ";", " ", "other", " ", "must", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "nonzero", ".", " ", " ", "For", " ", "efficien", "cy", ",", " ", "other", ".\\u", "exp", " ", "shou", "ld", " ", "not", " ", "be", " ", "too", " ", "large", ",", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "tha", "t", " ", "10", "**", "abs", "(", "other", ".\\u", "exp", ")", " ", "is", " ", "a", " ", "feas", "ibl", "e", " ", "calculati", "on", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "the", " ", "comment", "s", " ", "belo", "w", ",", " ", "we", " ", "write", " ", "x", " ", "for", " ", "the", " ", "value", " ", "of", " ", "self", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "y", " ", "for", " ", "the", " ", "value", " ", "of", " ", "other", ".", " ", " ", "Write", " ", "x", " ", "=", " ", "xc", "*", "10", "**", "xe", " ", "and", " ", "y", " ", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "yc", "*", "10", "**", "ye", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "main", " ", "purpose", " ", "of", " ", "this", " ", "method", " ", "is", " ", "to", " ", "identify", " ", "the", " ", "*", "fail", "ure", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "x", "**", "y", " ", "to", " ", "be", " ", "exact", "ly", " ", "represent", "able", " ", "with", " ", "as", " ", "litt", "le", " ", "effort", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "possib", "le", ".", " ", " ", "So", " ", "we", " ", "look", " ", "for", " ", "che", "ap", " ", "and", " ", "easy", " ", "tests", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "eliminat", "e", " ", "the", " ", "possibilit", "y", " ", "of", " ", "x", "**", "y", " ", "bei", "ng", " ", "exact", ".", " ", " ", "On", "ly", " ", "if", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "tests", " ", "are", " ", "pass", "ed", " ", "do", " ", "we", " ", "go", " ", "on", " ", "to", " ", "actual", "ly", " ", "compute", " ", "x", "**", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Her", "e", "'", "s", " ", "the", " ", "main", " ", "idea", ".", " ", " ", "Fi", "rst", " ", "normali", "ze", " ", "bot", "h", " ", "x", " ", "and", " ", "y", ".", " ", " ", "We", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "express", " ", "y", " ", "as", " ", "a", " ", "rational", " ", "m", "/", "n", ",", " ", "with", " ", "m", " ", "and", " ", "n", " ", "relative", "ly", " ", "prime_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "n", ">", "0.", " ", " ", "The", "n", " ", "for", " ", "x", "**", "y", " ", "to", " ", "be", " ", "exact", "ly", " ", "represent", "able", " ", "(", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", "any", "*", " ", "preci", "sion", "),", " ", "xc", " ", "must", " ", "be", " ", "the", " ", "nth", " ", "power", " ", "of", " ", "a", " ", "positive_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integ", "er", " ", "and", " ", "xe", " ", "must", " ", "be", " ", "divisi", "ble", " ", "by", " ", "n", ".", " ", " ", "If", " ", "m", " ", "is", " ", "negative_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "addition", "ally", " ", "xc", " ", "must", " ", "be", " ", "a", " ", "power", " ", "of", " ", "eit", "her", " ", "2", " ", "or", " ", "5", ",", " ", "hen", "ce_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "power", " ", "of", " ", "2", "**", "n", " ", "or", " ", "5", "**", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", "'", "s", " ", "a", " ", "limit", " ", "to", " ", "how", " ", "small", " ", "|", "y", "|", " ", "can", " ", "be", ":", " ", "if", " ", "y", "=", "m", "/", "n", " ", "as", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "(", "1", ")", " ", "if", " ", "xc", " ", "!=", " ", "1", " ", "then", " ", "for", " ", "the", " ", "result", " ", "to", " ", "be", " ", "represent", "able", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "need", " ", "xc", "**", "(", "1", "/", "n", ")", " ", ">=", " ", "2", ",", " ", "and", " ", "hen", "ce", " ", "als", "o", " ", "xc", "**", "|", "y", "|", " ", ">=", " ", "2", ".", " ", " ", "So", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "if", " ", "|", "y", "|", " ", "<=", " ", "1", "/", "nbi", "ts", "(", "xc", ")", " ", "then", " ", "xc", " ", "<", " ", "2", "**", "nbi", "ts", "(", "xc", ")", " ", "<=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "2", "**", "(", "1", "/|", "y", "|)", ",", " ", "hen", "ce", " ", "xc", "**", "|", "y", "|", " ", "<", " ", "2", " ", "and", " ", "the", " ", "result", " ", "is", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "represent", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "(", "2", ")", " ", "if", " ", "xe", " ", "!=", " ", "0", ",", " ", "|", "xe", "|", "*(", "1", "/", "n", ")", " ", ">=", " ", "1", ",", " ", "so", " ", "|", "xe", "|", "*|", "y", "|", " ", ">=", " ", "1", ".", " ", " ", "Hen", "ce", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "|", "y", "|", " ", "<", " ", "1", "/|", "xe", "|", " ", "then", " ", "the", " ", "result", " ", "is", " ", "not", " ", "represent", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "sinc", "e", " ", "x", " ", "is", " ", "not", " ", "equal", " ", "to", " ", "1", ",", " ", "at", " ", "leas", "t", " ", "one", " ", "of", " ", "(", "1", ")", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "2", ")", " ", "must", " ", "appl", "y", ".", " ", " ", "No", "w", " ", "|", "y", "|", " ", "<", " ", "1", "/", "nbi", "ts", "(", "xc", ")", " ", "iff", " ", "|", "yc", "|", "*", "nbi", "ts", "(", "xc", ")", " ", "<_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "10", "**", "-", "ye", " ", "iff", " ", "len", "(", "str", "(", "|", "yc", "|", "*", "nbi", "ts", "(", "xc", "))", " ", "<=", " ", "-", "ye", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", "'", "s", " ", "als", "o", " ", "a", " ", "limit", " ", "to", " ", "how", " ", "large", " ", "y", " ", "can", " ", "be", ",", " ", "at", " ", "leas", "t", " ", "if", " ", "it", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "posit", "ive", ":", " ", "the", " ", "normali", "zed", " ", "result", " ", "will", " ", "have", " ", "coefficient", " ", "xc", "**", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "if", " ", "it", "'", "s", " ", "represent", "able", " ", "then", " ", "xc", "**", "y", " ", "<", " ", "10", "**", "p", ",", " ", "and", " ", "y", " ", "<_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "p", "/", "log", "10", "(", "xc", ").", " ", " ", "Hen", "ce", " ", "if", " ", "y", "*", "log", "10", "(", "xc", ")", " ", ">=", " ", "p", " ", "then", " ", "the", " ", "result", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "exact", "ly", " ", "represent", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "len", "(", "str", "(", "abs", "(", "yc", "*", "xe", "))", " ", "<=", " ", "-", "ye", " ", "then", " ", "abs", "(", "yc", "*", "xe", ")", " ", "<", " ", "10", "**", "-", "ye", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "|", "y", "|", " ", "<", " ", "1", "/", "xe", " ", "and", " ", "the", " ", "result", " ", "is", " ", "not", " ", "represent", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simil", "arl", "y", ",", " ", "len", "(", "str", "(", "abs", "(", "yc", ")*", "xc", "\\u", "bits", "))", " ", "<=", " ", "-", "ye", " ", "implies", " ", "|", "y", "|_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", " ", "1", "/", "nbi", "ts", "(", "xc", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc_", ",_", "xe_", "=_", "x_", "._", "int_", ",_", "x_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "xc_", "%_", "10_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xc_", "//", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xe_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "y_", "=_", "\\u", "Work", "Rep", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yc_", ",_", "ye", "_", "=_", "y_", "._", "int_", ",_", "y_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "yc_", "%_", "10_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yc_", "//", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ye", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", " ", "where", " ", "xc", " ", "==", " ", "1", ":", " ", "result", " ", "is", " ", "10", "**", "(", "xe", "*", "y", "),", " ", "with", " ", "xe", "*", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "d", " ", "to", " ", "be", " ", "an", " ", "integer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xc_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xe_", "*=_", "yc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "result", " ", "is", " ", "now", " ", "10", "**", "(", "xe", " ", "*", " ", "10", "**", "ye", ");", " ", " ", "xe", " ", "*", " ", "10", "**", "ye", " ", "must", " ", "be", " ", "integral_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "xe_", "%_", "10_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xe_", "//", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ye", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ye", "_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exponent_", "=_", "xe_", "*_", "10_", "**_", "ye", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "y_", "._", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exponent_", "=_", "-_", "exponent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "other", " ", "is", " ", "a", " ", "nonn", "egat", "ive", " ", "integ", "er", ",", " ", "use", " ", "ideal", " ", "exponent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "isin", "teg", "er_", "(_", ")_", "and_", "other_", "._", "\\u", "sign_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ideal", "\\u", "exponent_", "=_", "self_", "._", "\\u", "exp_", "*_", "int_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zeros_", "=_", "min_", "(_", "exponent_", "-_", "ideal", "\\u", "exponent_", ",_", "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 ", " _", "zeros_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "'", "1", "'_", "+_", "'", "0", "'_", "*_", "zeros_", ",_", "exponent_", "-_", "zeros_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", " ", "where", " ", "y", " ", "is", " ", "negati", "ve", ":", " ", "xc", " ", "must", " ", "be", " ", "eit", "her", " ", "a", " ", "power_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "2", " ", "or", " ", "a", " ", "power", " ", "of", " ", "5._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "y_", "._", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "digit_", "=_", "xc_", "%_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "digit_", "in_", "(_", "2_", ",_", "4_", ",_", "6_", ",_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "quick", " ", "test", " ", "for", " ", "power", " ", "of", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "xc_", "&_", "-_", "xc_", "!=_", "xc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "xc", " ", "is", " ", "a", " ", "power", " ", "of", " ", "2", ";", " ", "e", " ", "is", " ", "its", " ", "exponent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "e_", "=_", "\\u", "nbi", "ts_", "(_", "xc_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "e", "*", "y", " ", "and", " ", "xe", "*", "y", ";", " ", "bot", "h", " ", "must", " ", "be", " ", "integers_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ye", "_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "y", "\\u", "as", "\\u", "int_", "=_", "yc_", "*_", "10_", "**_", "ye", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "e_", "*_", "y", "\\u", "as", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xe_", "=_", "xe_", "*_", "y", "\\u", "as", "\\u", "int_", "\\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 ", " ", "_", "ten", "\\u", "pow_", "=_", "10_", "**_", "-_", "ye", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", ",_", "remainder_", "=_", "divmod_", "(_", "e_", "*_", "yc_", ",_", "ten", "\\u", "pow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remainder_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xe_", ",_", "remainder_", "=_", "divmod_", "(_", "xe_", "*_", "yc_", ",_", "ten", "\\u", "pow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remainder_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "e_", "*_", "65_", ">=_", "p_", "*_", "93_", ":_", "#", " ", "9", "3", "/", "6", "5", " ", ">", " ", "log", "(", "10", ")/", "log", "(", "5", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xc_", "=_", "5_", "**_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "last", "\\u", "digit_", "==_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", " ", ">=", " ", "log", "\\u", "5", "(", "xc", ")", " ", "if", " ", "xc", " ", "is", " ", "a", " ", "power", " ", "of", " ", "5", ";", " ", "we", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "equality", " ", "all", " ", "the", " ", "way", " ", "up", " ", "to", " ", "xc", "=", "5", "**", "265", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "\\u", "nbi", "ts_", "(_", "xc_", ")_", "*_", "28_", "//_", "65_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc_", ",_", "remainder_", "=_", "divmod_", "(_", "5_", "**_", "e_", ",_", "xc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remainder_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "xc_", "%_", "5_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "xc_", "//", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ye", "_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "y", "\\u", "as", "\\u", "integer_", "=_", "yc_", "*_", "10_", "**_", "ye", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "e_", "*_", "y", "\\u", "as", "\\u", "integer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xe_", "=_", "xe_", "*_", "y", "\\u", "as", "\\u", "integer_", "\\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 ", " ", "_", "ten", "\\u", "pow_", "=_", "10_", "**_", "-_", "ye", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", ",_", "remainder_", "=_", "divmod_", "(_", "e_", "*_", "yc_", ",_", "ten", "\\u", "pow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remainder_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xe_", ",_", "remainder_", "=_", "divmod_", "(_", "xe_", "*_", "yc_", ",_", "ten", "\\u", "pow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remainder_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "e_", "*_", "3_", ">=_", "p_", "*_", "10_", ":_", "#", " ", "10", "/", "3", " ", ">", " ", "log", "(", "10", ")/", "log", "(", "2", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xc_", "=_", "2_", "**_", "e_", "\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xc_", ">=_", "10_", "**_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xe_", "=_", "-_", "e_", "-_", "xe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "str_", "(_", "xc_", ")_", ",_", "xe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "y", " ", "is", " ", "posit", "ive", ";", " ", "find", " ", "m", " ", "and", " ", "n", " ", "suc", "h", " ", "tha", "t", " ", "y", " ", "=", " ", "m", "/", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ye", "_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "n_", "=_", "yc_", "*_", "10_", "**_", "ye", "_", ",_", "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 ", " _", "if_", "xe_", "!=_", "0_", "and_", "len_", "(_", "str_", "(_", "abs_", "(_", "yc_", "*_", "xe_", ")_", ")_", ")_", "<=_", "-_", "ye", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xc", "\\u", "bits_", "=_", "\\u", "nbi", "ts_", "(_", "xc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xc_", "!=_", "1_", "and_", "len_", "(_", "str_", "(_", "abs_", "(_", "yc_", ")_", "*_", "xc", "\\u", "bits_", ")_", ")_", "<=_", "-_", "ye", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", ",_", "n_", "=_", "yc_", ",_", "10_", "**_", "(_", "-_", "ye", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "m_", "%_", "2_", "==_", "n_", "%_", "2_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "//", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "//", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "m_", "%_", "5_", "==_", "n_", "%_", "5_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "//", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "//", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "nth", " ", "root", " ", "of", " ", "xc", "*", "10", "**", "xe_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "1", " ", "<", " ", "xc", " ", "<", " ", "2", "**", "n", " ", "then", " ", "xc", " ", "isn", "'", "t", " ", "an", " ", "nth", " ", "power_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "xc_", "!=_", "1_", "and_", "xc", "\\u", "bits_", "<=_", "n_", ":_", "\\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_", "xe_", ",_", "rem_", "=_", "divmod_", "(_", "xe_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rem_", "!=_", "0_", ":_", "\\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_", "#", " ", "compute", " ", "nth", " ", "root", " ", "of", " ", "xc", " ", "usi", "ng", " ", "New", "ton", "'", "s", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a_", "=_", "1_", "L_", "<<_", "-_", "(_", "-_", "\\u", "nbi", "ts_", "(_", "xc_", ")_", "//_", "n_", ")_", "#", " ", "initial", " ", "estimate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", ",_", "r_", "=_", "divmod_", "(_", "xc_", ",_", "a_", "**_", "(_", "n_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "<=_", "q_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "a_", "=_", "(_", "a_", "*_", "(_", "n_", "-_", "1_", ")_", "+_", "q_", ")_", "//_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "a_", "==_", "q_", "and_", "r_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xc_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "xc", "*", "10", "**", "xe", " ", "is", " ", "the", " ", "nth", " ", "root", " ", "of", " ", "the", " ", "original", " ", "xc", "*", "10", "**", "xe_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "mt", "h", " ", "power", " ", "of", " ", "xc", "*", "10", "**", "xe_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "m", " ", ">", " ", "p", "*", "100", "//", "\\u", "log", "10", "\\u", "lb", "(", "xc", ")", " ", "then", " ", "m", " ", ">", " ", "p", "/", "log", "10", "(", "xc", "),", " ", "hen", "ce", " ", "xc", "**", "m", " ", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "10", "**", "p", " ", "and", " ", "the", " ", "result", " ", "is", " ", "not", " ", "represent", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xc_", ">_", "1_", "and_", "m_", ">_", "p_", "*_", "100_", "//_", "\\u", "log", "10", "\\u", "lb_", "(_", "xc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xc_", "=_", "xc_", "**_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xe_", "*=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xc_", ">_", "10_", "**_", "p_", ":_", "\\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_", "#", " ", "by", " ", "this", " ", "point", " ", "the", " ", "result", " ", "*", "is", "*", " ", "exact", "ly", " ", "represent", "able_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adjust", " ", "the", " ", "expon", "ent", " ", "to", " ", "get", " ", "as", " ", "close", " ", "as", " ", "possib", "le", " ", "to", " ", "the", " ", "ideal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expon", "ent", ",", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "str", "\\u", "xc_", "=_", "str_", "(_", "xc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "._", "\\u", "isin", "teg", "er_", "(_", ")_", "and_", "other_", "._", "\\u", "sign_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ideal", "\\u", "exponent_", "=_", "self_", "._", "\\u", "exp_", "*_", "int_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zeros_", "=_", "min_", "(_", "xe_", "-_", "ideal", "\\u", "exponent_", ",_", "p_", "-_", "len_", "(_", "str", "\\u", "xc_", ")_", ")_", "\\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 ", " _", "zeros_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "str", "\\u", "xc_", "+_", "'", "0", "'_", "*_", "zeros_", ",_", "xe_", "-_", "zeros_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "pow", "\\u\\u_", "(_", "self_", ",_", "other_", ",_", "modulo", "_", "=_", "None_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "self", " ", "**", " ", "other", " ", "[", " ", "%", " ", "modulo", "].", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "With", " ", "two", " ", "argu", "ment", "s", ",", " ", "compute", " ", "self", "**", "other", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "With", " ", "three", " ", "argu", "ment", "s", ",", " ", "compute", " ", "(", "self", "**", "other", ")", " ", "%", " ", "modulo", ".", " ", " ", "For", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "three", " ", "argu", "ment", " ", "form", ",", " ", "the", " ", "follow", "ing", " ", "restriction", "s", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", "s", " ", "hold", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "all", " ", "three", " ", "argu", "ment", "s", " ", "must", " ", "be", " ", "integral", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "other", " ", "must", " ", "be", " ", "nonn", "egat", "ive", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "eit", "her", " ", "self", " ", "or", " ", "other", " ", "(", "or", " ", "bot", "h", ")", " ", "must", " ", "be", " ", "nonzero", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "modulo", " ", "must", " ", "be", " ", "nonzero", " ", "and", " ", "must", " ", "have", " ", "at", " ", "most", " ", "p", " ", "digit", "s", ",", "\\", "10", ";", " ", " ", " ", "where", " ", "p", " ", "is", " ", "the", " ", "context", " ", "preci", "sion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "any", " ", "of", " ", "these", " ", "restriction", "s", " ", "is", " ", "viola", "ted", " ", "the", " ", "Inva", "lid", "Opera", "tion", "\\", "10", ";", " ", " ", " ", " ", "flag", " ", "is", " ", "raise", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "result", " ", "of", " ", "pow", "(", "self", ",", " ", "other", ",", " ", "modulo", ")", " ", "is", " ", "identi", "cal", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "tha", "t", " ", "wou", "ld", " ", "be", " ", "obtain", "ed", " ", "by", " ", "compu", "ting", " ", "(", "self", "**", "other", ")", " ", "%\\", "10", ";", " ", " ", " ", " ", "modulo", " ", "with", " ", "unbound", "ed", " ", "preci", "sion", ",", " ", "but", " ", "is", " ", "compute", "d", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "efficien", "tl", "y", ".", " ", " ", "It", " ", "is", " ", "alw", "ay", "s", " ", "exact", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "modulo", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "power", "\\u", "modulo", "_", "(_", "other_", ",_", "modulo", "_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "eit", "her", " ", "argu", "ment", " ", "is", " ", "a", " ", "Na", "N", " ", "=>", " ", "result", " ", "is", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0", "**", "0", " ", "=", " ", "Na", "N", " ", "(!", "),", " ", "x", "**", "0", " ", "=", " ", "1", " ", "for", " ", "nonzero", " ", "x", " ", "(", "inclu", "ding", " ", "+/-", "Infinit", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "0", " ", "**", " ", "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 ", " _", "return_", "\\u", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", " ", "has", " ", "sign", " ", "1", " ", "iff", " ", "self", ".\\u", "sign", " ", "is", " ", "1", " ", "and", " ", "other", " ", "is", " ", "an", " ", "odd", " ", "integer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result", "\\u", "sign_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "other_", "._", "\\u", "isin", "teg", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "other_", "._", "\\u", "ise", "ven", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result", "\\u", "sign_", "=_", "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_", "#", " ", "-", "ve", "**", "non", "integ", "er", " ", "=", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(-", "0", ")**", "non", "integ", "er", " ", "=", " ", "0", "**", "non", "integer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "x", " ", "**", " ", "y", " ", "with", " ", "x", " ", "negati", "ve", " ", "and", " ", "y", " ", "not", " ", "an", " ", "integ", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "negate", " ", "self", ",", " ", "with", "out", " ", "doi", "ng", " ", "any", " ", "unwa", "nte", "d", " ", "rounding", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "self_", "._", "copy", "\\u", "negate", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0", "**", "(", "+", "ve", " ", "or", " ", "Inf", ")=", " ", "0", ";", " ", "0", "**", "(-", "ve", " ", "or", " ", "-", "Inf", ")", " ", "=", " ", "Infinit", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "other_", "._", "\\u", "sign_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "result", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "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 ", " _", "return_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "result", "\\u", "sign_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inf", "**", "(", "+", "ve", " ", "or", " ", "Inf", ")", " ", "=", " ", "Inf", ";", " ", "Inf", "**", "(-", "ve", " ", "or", " ", "-", "Inf", ")", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "other_", "._", "\\u", "sign_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "result", "\\u", "sign_", "]_", "\\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_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "result", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", "**", "other", " ", "=", " ", "1", ",", " ", "but", " ", "the", " ", "choice", " ", "of", " ", "expon", "ent", " ", "and", " ", "the", " ", "flags_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "depend", " ", "on", " ", "the", " ", "expon", "ent", " ", "of", " ", "self", ",", " ", "and", " ", "on", " ", "whe", "ther", " ", "other", " ", "is", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "posit", "ive", " ", "integ", "er", ",", " ", "a", " ", "negati", "ve", " ", "integ", "er", ",", " ", "or", " ", "nei", "ther_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "==_", "\\u", "One_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "other_", "._", "\\u", "isin", "teg", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exp", " ", "=", " ", "max", "(", "self", ".\\u", "exp", "*", "max", "(", "int", "(", "other", "),", " ", "0", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", "-", "context", ".", "prec", ")", " ", "but", " ", "evaluat", "ing", " ", "int", "(", "other", ")", " ", "direct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "danger", "ous", " ", "unti", "l", " ", "we", " ", "know", " ", "other", " ", "is", " ", "small", " ", "(", "other_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coul", "d", " ", "be", " ", "1e", "999999999", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "other_", "._", "\\u", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "multiplier_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "other_", ">_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "multiplier_", "=_", "context_", "._", "prec_", "\\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 ", " ", "_", "multiplier_", "=_", "int_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exp_", "=_", "self_", "._", "\\u", "exp_", "*_", "multiplier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exp_", "<_", "1_", "-_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exp_", "=_", "1_", "-_", "context_", "._", "prec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Round", "ed_", ")_", "\\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 ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Ine", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Round", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp_", "=_", "1_", "-_", "context_", "._", "prec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "result", "\\u", "sign_", ",_", "'", "1", "'_", "+_", "'", "0", "'_", "*_", "-_", "exp_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "adjusted", " ", "expon", "ent", " ", "of", " ", "self_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self", "\\u", "adj_", "=_", "self_", "._", "adjusted", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", " ", "**", " ", "infinity", " ", "is", " ", "infinity", " ", "if", " ", "self", " ", ">", " ", "1", ",", " ", "0", " ", "if", " ", "self", " ", "<", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", " ", "**", " ", "-", "infinity", " ", "is", " ", "infinity", " ", "if", " ", "self", " ", "<", " ", "1", ",", " ", "0", " ", "if", " ", "self", " ", ">", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "other_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "other_", "._", "\\u", "sign_", "==_", "0_", ")_", "==_", "(_", "self", "\\u", "adj_", "<_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "result", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "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 ", " _", "return_", "\\u", "Signe", "d", "Infinit", "y_", "[_", "result", "\\u", "sign_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "here", " ", "on", ",", " ", "the", " ", "result", " ", "alw", "ay", "s", " ", "go", "es", " ", "through", " ", "the", " ", "call_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "\\u", "fix", " ", "at", " ", "the", " ", "end", " ", "of", " ", "this", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exact_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "crud", "e", " ", "test", " ", "to", " ", "catch", " ", "case", "s", " ", "of", " ", "extreme", " ", "overflow", "/", "under", "flow", ".", " ", " ", "If_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", "10", "(", "self", ")*", "other", " ", ">=", " ", "10", "**", "bound", " ", "and", " ", "bound", " ", ">=", " ", "len", "(", "str", "(", "Ema", "x", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "10", "**", "bound", " ", ">=", " ", "10", "**", "len", "(", "str", "(", "Ema", "x", "))", " ", ">=", " ", "Ema", "x", "+", "1", " ", "and", " ", "hen", "ce_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", "**", "other", " ", ">=", " ", "10", "**", "(", "Ema", "x", "+", "1", "),", " ", "so", " ", "overflow", " ", "occur", "s", ".", " ", " ", "The", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "under", "flow", " ", "is", " ", "similar", "._", "\\u\\u\\uNL\\u\\u\\u_", "bound_", "=_", "self_", "._", "\\u", "log", "10", "\\u", "exp", "\\u", "bound_", "(_", ")_", "+_", "other_", "._", "adjusted", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self", "\\u", "adj_", ">=_", "0_", ")_", "==_", "(_", "other_", "._", "\\u", "sign_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", " ", ">", " ", "1", " ", "and", " ", "other", " ", "+", "ve", ",", " ", "or", " ", "self", " ", "<", " ", "1", " ", "and", " ", "other", " ", "-", "ve_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "possibilit", "y", " ", "of", " ", "overflow", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bound_", ">=_", "len_", "(_", "str_", "(_", "context_", "._", "Ema", "x_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "result", "\\u", "sign_", ",_", "'", "1", "'_", ",_", "context_", "._", "Ema", "x_", "+_", "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_", "#", " ", "self", " ", ">", " ", "1", " ", "and", " ", "other", " ", "-", "ve", ",", " ", "or", " ", "self", " ", "<", " ", "1", " ", "and", " ", "other", " ", "+", "ve_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "possibilit", "y", " ", "of", " ", "under", "flow", " ", "to", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Et", "in", "y_", "=_", "context_", "._", "Et", "in", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bound_", ">=_", "len_", "(_", "str_", "(_", "-_", "Et", "in", "y_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "result", "\\u", "sign_", ",_", "'", "1", "'_", ",_", "Et", "in", "y_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "for", " ", "an", " ", "exact", " ", "result", " ", "with", " ", "preci", "sion", " ", "+", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ans_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "power", "\\u", "exact_", "(_", "other_", ",_", "context_", "._", "prec_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result", "\\u", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "1_", ",_", "ans_", "._", "\\u", "int_", ",_", "ans_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exact_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usual", " ", "case", ":", " ", "ine", "xac", "t", " ", "result", ",", " ", "x", "**", "y", " ", "compute", "d", " ", "direct", "ly", " ", "as", " ", "exp", "(", "y", "*", "log", "(", "x", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ans_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "context_", "._", "prec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc_", ",_", "xe_", "=_", "x_", "._", "int_", ",_", "x_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "\\u", "Work", "Rep", "_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yc_", ",_", "ye", "_", "=_", "y_", "._", "int_", ",_", "y_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "y_", "._", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yc_", "=_", "-_", "yc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "correct", "ly", " ", "rounded", " ", "result", ":", " ", " ", "start", " ", "with", " ", "preci", "sion", " ", "+", "3", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "increase", " ", "preci", "sion", " ", "unti", "l", " ", "result", " ", "is", " ", "una", "mbi", "guous", "ly", " ", "round", "able_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeff_", ",_", "exp_", "=_", "\\u", "dpo", "wer", "_", "(_", "xc_", ",_", "xe_", ",_", "yc_", ",_", "ye", "_", ",_", "p_", "+_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coeff_", "%_", "(_", "5_", "*_", "10_", "**_", "(_", "len_", "(_", "str_", "(_", "coeff_", ")_", ")_", "-_", "p_", "-_", "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_", "extra_", "+=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "result", "\\u", "sign_", ",_", "str_", "(_", "coeff_", ")_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unli", "ke", " ", "exp", ",", " ", "ln", " ", "and", " ", "log", "10", ",", " ", "the", " ", "power", " ", "function", " ", "respec", "ts", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rounding", " ", "mode", ";", " ", "no", " ", "need", " ", "to", " ", "switch", " ", "to", " ", "ROUND", "\\u", "HALF", "\\u", "EVE", "N", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", "'", "s", " ", "a", " ", "difficult", "y", " ", "here", " ", "whe", "n", " ", "'", "other", "'", " ", "is", " ", "not", " ", "an", " ", "integ", "er", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "result", " ", "is", " ", "exact", ".", " ", " ", "In", " ", "this", " ", "case", ",", " ", "the", " ", "specification_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "s", " ", "tha", "t", " ", "the", " ", "Ine", "xac", "t", " ", "flag", " ", "be", " ", "raise", "d", " ", "(", "in", " ", "spi", "te", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exact", "ness", "),", " ", "but", " ", "sinc", "e", " ", "the", " ", "result", " ", "is", " ", "exact", " ", "\\u", "fix", " ", "won", "'", "t", " ", "do", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "us", ".", " ", " ", "(", "Corre", "spon", "ding", "ly", ",", " ", "the", " ", "Under", "flow", " ", "signal", " ", "shou", "ld", " ", "als", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "raise", "d", " ", "for", " ", "subn", "ormal", " ", "results", ".)", " ", " ", "We", " ", "can", "'", "t", " ", "direct", "ly", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "signal", "s", " ", "eit", "her", " ", "bef", "ore", " ", "or", " ", "after", " ", "calling", " ", "\\u", "fix", ",", " ", "since_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "wou", "ld", " ", "viola", "te", " ", "the", " ", "preceden", "ce", " ", "for", " ", "signal", "s", ".", " ", " ", "So", " ", "we", " ", "wrap_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", ".\\u", "fix", " ", "call", " ", "in", " ", "a", " ", "temporar", "y", " ", "context", ",", " ", "and", " ", "reraise", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "after", "ward", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exact_", "and_", "not_", "other_", "._", "\\u", "isin", "teg", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pad", " ", "with", " ", "zero", "s", " ", "up", " ", "to", " ", "length", " ", "context", ".", "prec", "+", "1", " ", "if", " ", "necessar", "y", ";", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", "s", " ", "tha", "t", " ", "the", " ", "Round", "ed", " ", "signal", " ", "will", " ", "be", " ", "raise", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "ans_", "._", "\\u", "int_", ")_", "<=_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp", "diff_", "=_", "context_", "._", "prec_", "+_", "1_", "-_", "len_", "(_", "ans_", "._", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "ans_", "._", "\\u", "sign_", ",_", "ans_", "._", "\\u", "int_", "+_", "'", "0", "'_", "*_", "exp", "diff_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans_", "._", "\\u", "exp_", "-_", "exp", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "current", " ", "context", ",", " ", "with", " ", "clear", "ed", " ", "flags", "/", "trap", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newco", "ntext", "_", "=_", "context_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newco", "ntext", "_", "._", "clear", "\\u", "flags_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "exception_", "in_", "\\u", "signals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newco", "ntext", "_", "._", "trap", "s_", "[_", "exception_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "round", " ", "in", " ", "the", " ", "new", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "newco", "ntext", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raise", " ", "Ine", "xac", "t", ",", " ", "and", " ", "if", " ", "necessar", "y", ",", " ", "Under", "flow_", "\\u\\u\\uNL\\u\\u\\u_", "newco", "ntext", "_", "._", "\\u", "raise", "\\u", "error_", "(_", "Ine", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "newco", "ntext", "_", "._", "flags_", "[_", "Sub", "normal_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newco", "ntext", "_", "._", "\\u", "raise", "\\u", "error_", "(_", "Under", "flow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "propagate", " ", "signal", "s", " ", "to", " ", "the", " ", "original", " ", "context", ";", " ", "\\u", "fix", " ", "coul", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "raise", "d", " ", "any", " ", "of", " ", "Over", "flow", ",", " ", "Under", "flow", ",", " ", "Sub", "normal", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ine", "xac", "t", ",", " ", "Round", "ed", ",", " ", "Cla", "mpe", "d", ".", " ", " ", "Over", "flow", " ", "need", "s", " ", "the", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", "s", ".", " ", " ", "Not", "e", " ", "tha", "t", " ", "the", " ", "order", " ", "of", " ", "the", " ", "exception", "s", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "importa", "nt", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "newco", "ntext", "_", "._", "flags_", "[_", "Over", "flow_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Over", "flow_", ",_", "'", "above", " ", "Ema", "x", "'_", ",_", "ans_", "._", "\\u", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "exception_", "in_", "Under", "flow_", ",_", "Sub", "normal_", ",_", "Ine", "xac", "t_", ",_", "Round", "ed_", ",_", "Cla", "mpe", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "newco", "ntext", "_", "._", "flags_", "[_", "exception_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "exception_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rpo", "w", "\\u\\u_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Swa", "ps", " ", "self", "/", "other", " ", "and", " ", "return", "s", " ", "\\u\\u", "pow", "\\u\\u", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other_", "is_", "Not", "Implemented_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "other_", "._", "\\u\\u", "pow", "\\u\\u_", "(_", "self_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "normalize_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Normalize", "-", " ", "strip", " ", "trail", "ing", " ", "0", "s", ",", " ", "change", " ", "anyt", "hing", " ", "equal", " ", "to", " ", "0", " ", "to", " ", "0e", "0", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dup_", "=_", "self_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dup_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "dup_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "dup_", "._", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exp", "\\u", "max_", "=_", "[_", "context_", "._", "Ema", "x_", ",_", "context_", "._", "Et", "op_", "(_", ")_", "]_", "[_", "context_", "._", "\\u", "clamp", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "len_", "(_", "dup_", "._", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp_", "=_", "dup_", "._", "\\u", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "dup_", "._", "\\u", "int_", "[_", "end_", "-_", "1_", "]_", "==_", "'", "0", "'_", "and_", "exp_", "<_", "exp", "\\u", "max_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "dup_", "._", "\\u", "sign_", ",_", "dup_", "._", "\\u", "int_", "[_", ":_", "end_", "]_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "quantize", "_", "(_", "self_", ",_", "exp_", ",_", "rounding", "_", "=_", "None_", ",_", "context_", "=_", "None_", ",_", "watch", "exp_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Quanti", "ze", " ", "self", " ", "so", " ", "its", " ", "expon", "ent", " ", "is", " ", "the", " ", "same", " ", "as", " ", "tha", "t", " ", "of", " ", "exp", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Simil", "ar", " ", "to", " ", "self", ".\\u", "rescale", "(", "exp", ".\\u", "exp", ")", " ", "but", " ", "with", " ", "error", " ", "checking", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp_", "=_", "\\u", "convert", "\\u", "other_", "(_", "exp_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rounding", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rounding", "_", "=_", "context_", "._", "rounding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "exp_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "exp_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exp_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "or_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exp_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "and_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "Decimal_", "(_", "self_", ")_", "#", " ", "if", " ", "bot", "h", " ", "are", " ", "inf", ",", " ", "it", " ", "is", " ", "OK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quantize", " ", "with", " ", "one", " ", "INF", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", "'", "re", " ", "not", " ", "watch", "ing", " ", "expon", "ents", ",", " ", "do", " ", "a", " ", "simple", " ", "rescale", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "watch", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "rescale", "_", "(_", "exp_", "._", "\\u", "exp_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "raise", " ", "Ine", "xac", "t", " ", "and", " ", "Round", "ed", " ", "where", " ", "appropr", "iate", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ans_", "._", "\\u", "exp_", ">_", "self_", "._", "\\u", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Round", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", "!=_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Ine", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exp", ".\\u", "exp", " ", "shou", "ld", " ", "be", " ", "bet", "ween", " ", "Et", "in", "y", " ", "and", " ", "Ema", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "context_", "._", "Et", "in", "y_", "(_", ")_", "<=_", "exp_", "._", "\\u", "exp_", "<=_", "context_", "._", "Ema", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", " ", "expon", "ent", " ", "out", " ", "of", " ", "bound", "s", " ", "in", " ", "quantize", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "exp_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self", "\\u", "adjusted", "_", "=_", "self_", "._", "adjusted", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self", "\\u", "adjusted", "_", ">_", "context_", "._", "Ema", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expon", "ent", " ", "of", " ", "quantize", " ", "result", " ", "too", " ", "large", " ", "for", " ", "current", " ", "context", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "adjusted", "_", "-_", "exp_", "._", "\\u", "exp_", "+_", "1_", ">_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quantize", " ", "result", " ", "has", " ", "too", " ", "many", " ", "digit", "s", " ", "for", " ", "current", " ", "context", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "rescale", "_", "(_", "exp_", "._", "\\u", "exp_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", "._", "adjusted", "_", "(_", ")_", ">_", "context_", "._", "Ema", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expon", "ent", " ", "of", " ", "quantize", " ", "result", " ", "too", " ", "large", " ", "for", " ", "current", " ", "context", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "ans_", "._", "\\u", "int_", ")_", ">_", "context_", "._", "prec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quantize", " ", "result", " ", "has", " ", "too", " ", "many", " ", "digit", "s", " ", "for", " ", "current", " ", "context", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raise", " ", "appropr", "iate", " ", "flags_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ans_", "and_", "ans_", "._", "adjusted", "_", "(_", ")_", "<_", "context_", "._", "Emi", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Sub", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ans_", "._", "\\u", "exp_", ">_", "self_", "._", "\\u", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ans_", "!=_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Ine", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Round", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "to", " ", "fix", " ", "take", "s", " ", "care", " ", "of", " ", "any", " ", "necessar", "y", " ", "fold", "down", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "signal", "s", " ", "Cla", "mpe", "d", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "same", "\\u", "quantum", "_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "and", " ", "other", " ", "have", " ", "the", " ", "same", " ", "expon", "ent", ";", " ", "other", "wis", "e", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "eit", "her", " ", "operand", " ", "is", " ", "a", " ", "special", " ", "value", ",", " ", "the", " ", "follow", "ing", " ", "rule", "s", " ", "are", " ", "used", ":", "\\", "10", ";", " ", " ", " ", "*", " ", "return", " ", "Tru", "e", " ", "if", " ", "bot", "h", " ", "operand", "s", " ", "are", " ", "infini", "ties", "\\", "10", ";", " ", " ", " ", "*", " ", "return", " ", "Tru", "e", " ", "if", " ", "bot", "h", " ", "operand", "s", " ", "are", " ", "Na", "Ns", "\\", "10", ";", " ", " ", " ", "*", " ", "other", "wis", "e", ",", " ", "return", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "is", "\\u", "nan_", "(_", ")_", "and_", "other_", "._", "is", "\\u", "nan_", "(_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "is", "\\u", "infini", "te_", "(_", ")_", "and_", "other_", "._", "is", "\\u", "infini", "te_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "exp_", "==_", "other_", "._", "\\u", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rescale", "_", "(_", "self_", ",_", "exp_", ",_", "rounding", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Resc", "ale", " ", "self", " ", "so", " ", "tha", "t", " ", "the", " ", "expon", "ent", " ", "is", " ", "exp", ",", " ", "eit", "her", " ", "by", " ", "padd", "ing", " ", "with", " ", "zero", "s", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "by", " ", "truncat", "ing", " ", "digit", "s", ",", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "rounding", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Special", "s", " ", "are", " ", "return", "ed", " ", "with", "out", " ", "change", ".", " ", " ", "Thi", "s", " ", "operati", "on", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "quie", "t", ":", " ", "it", " ", "raise", "s", " ", "no", " ", "flags", ",", " ", "and", " ", "use", "s", " ", "no", " ", "informati", "on", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "exp", " ", "=", " ", "exp", " ", "to", " ", "scale", " ", "to", " ", "(", "an", " ", "integ", "er", ")", "\\", "10", ";", " ", " ", " ", " ", "rounding", " ", "=", " ", "rounding", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", ">=_", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pad", " ", "answer", " ", "with", " ", "zero", "s", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "int_", "+_", "'", "0", "'_", "*_", "(_", "self_", "._", "\\u", "exp_", "-_", "exp_", ")_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "too", " ", "many", " ", "digit", "s", ";", " ", "round", " ", "and", " ", "lose", " ", "data", ".", " ", " ", "If", " ", "self", ".", "adjusted", "()", " ", "<_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exp", "-1", ",", " ", "replace", " ", "self", " ", "by", " ", "10", "**", "(", "exp", "-1", ")", " ", "bef", "ore", " ", "rounding", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "digits_", "=_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "+_", "self_", "._", "\\u", "exp_", "-_", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "digits_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "'", "1", "'_", ",_", "exp_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "digits_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "this", "\\u", "function_", "=_", "getattr_", "(_", "self_", ",_", "self_", "._", "\\u", "pick", "\\u", "rounding", "\\u", "function_", "[_", "rounding", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changed_", "=_", "this", "\\u", "function_", "(_", "digits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coeff_", "=_", "self_", "._", "\\u", "int_", "[_", ":_", "digits_", "]_", "or_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "changed_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeff_", "=_", "str_", "(_", "int_", "(_", "coeff_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "coeff_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "round_", "(_", "self_", ",_", "places_", ",_", "rounding", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", " ", "a", " ", "nonzero", ",", " ", "nons", "pec", "ial", " ", "Deci", "mal", " ", "to", " ", "a", " ", "fixed", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "significant", " ", "figure", "s", ",", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "rounding", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Infinit", "ies", ",", " ", "Na", "Ns", " ", "and", " ", "zero", "s", " ", "are", " ", "return", "ed", " ", "unal", "tere", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "operati", "on", " ", "is", " ", "quie", "t", ":", " ", "it", " ", "raise", "s", " ", "no", " ", "flags", ",", " ", "and", " ", "use", "s", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "informati", "on", " ", "from", " ", "the", " ", "context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "places_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "argu", "ment", " ", "shou", "ld", " ", "be", " ", "at", " ", "leas", "t", " ", "1", " ", "in", " ", "\\u", "round", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "rescale", "_", "(_", "self_", "._", "adjusted", "_", "(_", ")_", "+_", "1_", "-_", "places_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "can", " ", "happ", "en", " ", "tha", "t", " ", "the", " ", "rescale", " ", "alter", "s", " ", "the", " ", "adjusted", " ", "expon", "ent", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "example", " ", "whe", "n", " ", "rounding", " ", "99.", "9", "7", " ", "to", " ", "3", " ", "significant", " ", "figure", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "this", " ", "happ", "ens", " ", "we", " ", "end", " ", "up", " ", "with", " ", "an", " ", "extra", " ", "0", " ", "at", " ", "the", " ", "end", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "number", ";", " ", "a", " ", "second", " ", "rescale", " ", "fixes", " ", "this", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ans_", "._", "adjusted", "_", "(_", ")_", "!=_", "self_", "._", "adjusted", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "ans_", "._", "\\u", "rescale", "_", "(_", "ans_", "._", "adjusted", "_", "(_", ")_", "+_", "1_", "-_", "places_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "integral", "\\u", "exact_", "(_", "self_", ",_", "rounding", "_", "=_", "None_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", "s", " ", "to", " ", "a", " ", "nearby", " ", "integ", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "rounding", " ", "mode", " ", "is", " ", "specified", ",", " ", "take", " ", "the", " ", "rounding", " ", "mode", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "context", ".", " ", " ", "Thi", "s", " ", "method", " ", "raise", "s", " ", "the", " ", "Round", "ed", " ", "and", " ", "Ine", "xac", "t", " ", "flags", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "appropr", "iate", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "als", "o", ":", " ", "to", "\\u", "integral", "\\u", "value", ",", " ", "whi", "ch", " ", "doe", "s", " ", "exact", "ly", " ", "the", " ", "same", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "method", " ", "except", " ", "tha", "t", " ", "it", " ", "doe", "sn", "'", "t", " ", "raise", " ", "Ine", "xac", "t", " ", "or", " ", "Round", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rounding", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rounding", "_", "=_", "context_", "._", "rounding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "rescale", "_", "(_", "0_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", "!=_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Ine", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Round", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "integral", "\\u", "value_", "(_", "self_", ",_", "rounding", "_", "=_", "None_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Round", "s", " ", "to", " ", "the", " ", "near", "est", " ", "integ", "er", ",", " ", "with", "out", " ", "rais", "ing", " ", "ine", "xac", "t", ",", " ", "rounded", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rounding", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rounding", "_", "=_", "context_", "._", "rounding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "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 ", " _", "return_", "self_", "._", "\\u", "rescale", "_", "(_", "0_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "sqrt_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "square", " ", "root", " ", "of", " ", "self", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "and_", "self_", "._", "\\u", "sign_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "self_", ")_", "\\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_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "expon", "ent", " ", "=", " ", "self", ".\\u", "exp", " ", "//", " ", "2", ".", " ", " ", "sqrt", "(-", "0", ")", " ", "=", " ", "-0", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "'", "0", "'_", ",_", "self_", "._", "\\u", "exp_", "//_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "'", "sqrt", "(-", "x", "),", " ", "x", " ", ">", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "At", " ", "this", " ", "point", " ", "self", " ", "represent", "s", " ", "a", " ", "posit", "ive", " ", "number", ".", " ", " ", "Let", " ", "p", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "desi", "red", " ", "preci", "sion", " ", "and", " ", "express", " ", "self", " ", "in", " ", "the", " ", "form", " ", "c", "*", "100", "**", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "c", " ", "a", " ", "posit", "ive", " ", "real", " ", "number", " ", "and", " ", "e", " ", "an", " ", "integ", "er", ",", " ", "c", " ", "and", " ", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bei", "ng", " ", "chosen", " ", "so", " ", "tha", "t", " ", "100", "**", "(", "p", "-1", ")", " ", "<=", " ", "c", " ", "<", " ", "100", "**", "p", ".", " ", " ", "The", "n", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "exact", ")", " ", "square", " ", "root", " ", "of", " ", "self", " ", "is", " ", "sqrt", "(", "c", ")*", "10", "**", "e", ",", " ", "and", " ", "10", "**", "(", "p", "-1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<=", " ", "sqrt", "(", "c", ")", " ", "<", " ", "10", "**", "p", ",", " ", "so", " ", "the", " ", "closest", " ", "represent", "able", " ", "Deci", "mal", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "preci", "sion", " ", "p", " ", "is", " ", "n", "*", "10", "**", "e", " ", "where", " ", "n", " ", "=", " ", "round", "\\u", "half", "\\u", "even", "(", "sqrt", "(", "c", "))", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "closest", " ", "integ", "er", " ", "to", " ", "sqrt", "(", "c", ")", " ", "with", " ", "the", " ", "even", " ", "integ", "er", " ", "chosen", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "case", " ", "of", " ", "a", " ", "tie", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "ensure", " ", "correct", " ", "rounding", " ", "in", " ", "all", " ", "case", "s", ",", " ", "we", " ", "use", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "follow", "ing", " ", "trick", ":", " ", "we", " ", "compute", " ", "the", " ", "square", " ", "root", " ", "to", " ", "an", " ", "extra_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "place", " ", "(", "preci", "sion", " ", "p", "+", "1", " ", "inst", "ead", " ", "of", " ", "preci", "sion", " ", "p", "),", " ", "rounding", " ", "down", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", ",", " ", "if", " ", "the", " ", "result", " ", "is", " ", "ine", "xac", "t", " ", "and", " ", "its", " ", "last", " ", "digit", " ", "is", " ", "0", " ", "or", " ", "5", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "increase", " ", "the", " ", "last", " ", "digit", " ", "to", " ", "1", " ", "or", " ", "6", " ", "respec", "tiv", "el", "y", ";", " ", "if", " ", "it", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exact", " ", "we", " ", "lea", "ve", " ", "the", " ", "last", " ", "digit", " ", "alo", "ne", ".", " ", " ", "No", "w", " ", "the", " ", "final", " ", "round", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "p", " ", "place", "s", " ", "(", "or", " ", "few", "er", " ", "in", " ", "the", " ", "case", " ", "of", " ", "under", "flow", ")", " ", "will", " ", "round_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "correct", "ly", " ", "and", " ", "raise", " ", "the", " ", "appropr", "iate", " ", "flags", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "an", " ", "extra", " ", "digit", " ", "of", " ", "precision_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prec_", "=_", "context_", "._", "prec_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "argu", "ment", " ", "in", " ", "the", " ", "form", " ", "c", "*", "100", "**", "e", " ", "where", " ", "e", " ", "=", " ", "self", ".\\u", "exp", "//", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "the", " ", "'", "ideal", "'", " ", "expon", "ent", ",", " ", "to", " ", "be", " ", "used", " ", "if", " ", "the", " ", "square", " ", "root", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exact", "ly", " ", "represent", "able", ".", " ", " ", "l", " ", "is", " ", "the", " ", "number", " ", "of", " ", "'", "digit", "s", "'", " ", "of", " ", "c", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "100", ",", " ", "so", " ", "tha", "t", " ", "100", "**", "(", "l", "-1", ")", " ", "<=", " ", "c", " ", "<", " ", "100", "**", "l", "._", "\\u\\u\\uNL\\u\\u\\u_", "op_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "op_", "._", "exp_", ">>_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "op_", "._", "exp_", "&_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "op_", "._", "int_", "*_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "(_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", ">>_", "1_", ")_", "+_", "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 ", " _", "c_", "=_", "op_", "._", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "+_", "1_", ">>_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rescale", " ", "so", " ", "tha", "t", " ", "c", " ", "has", " ", "exact", "ly", " ", "prec", " ", "base", " ", "100", " ", "'", "digit", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shift_", "=_", "prec_", "-_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shift_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "*=_", "100_", "**_", "shift_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exact_", "=_", "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 ", " _", "c_", ",_", "remainder_", "=_", "divmod_", "(_", "c_", ",_", "100_", "**_", "-_", "shift_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exact_", "=_", "not_", "remainder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "e_", "-=_", "shift_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "n", " ", "=", " ", "floor", "(", "sqrt", "(", "c", "))", " ", "usi", "ng", " ", "New", "ton", "'", "s", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "10_", "**_", "prec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "c_", "//_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "<=_", "q_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "n_", "+_", "q_", ">>_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exact_", "=_", "exact_", "and_", "n_", "*_", "n_", "==_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "exact_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "result", " ", "is", " ", "exact", ";", " ", "rescale", " ", "to", " ", "use", " ", "ideal", " ", "expon", "ent", " ", "e_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "shift_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "n", " ", "%", " ", "10", "**", "shift", " ", "==", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "//", "=_", "10_", "**_", "shift_", "\\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 ", " _", "n_", "*=_", "10_", "**_", "-_", "shift_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "e_", "+=_", "shift_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "result", " ", "is", " ", "not", " ", "exact", ";", " ", "fix", " ", "last", " ", "digit", " ", "as", " ", "descri", "bed", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "n_", "%_", "5_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "+=_", "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_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "str_", "(_", "n_", ")_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "round", ",", " ", "and", " ", "fit", " ", "to", " ", "current", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", "._", "\\u", "shallow", "\\u", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rounding", "_", "=_", "context_", "._", "\\u", "set\\u", "rounding", "_", "(_", "ROUND", "\\u", "HALF", "\\u", "EVE", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "rounding", "_", "=_", "rounding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "max_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "large", "r", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Lik", "e", " ", "max", "(", "self", ",", " ", "other", ")", " ", "except", " ", "if", " ", "one", " ", "is", " ", "not", " ", "a", " ", "number", ",", " ", "return", "s", "\\", "10", ";", " ", " ", " ", " ", "Na", "N", " ", "(", "and", " ", "signal", "s", " ", "if", " ", "one", " ", "is", " ", "s", "Na", "N", ").", " ", " ", "Al", "so", " ", "round", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "one", " ", "operand", " ", "is", " ", "a", " ", "quie", "t", " ", "Na", "N", " ", "and", " ", "the", " ", "other", " ", "is", " ", "number", ",", " ", "then", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "is", " ", "alw", "ay", "s", " ", "returned_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sn_", "=_", "self_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on_", "=_", "other_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sn_", "or_", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "on_", "==_", "1_", "and_", "sn_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sn_", "==_", "1_", "and_", "on_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "other_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "bot", "h", " ", "operand", "s", " ", "are", " ", "finite", " ", "and", " ", "equal", " ", "in", " ", "numerical", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "an", " ", "orderi", "ng", " ", "is", " ", "applied", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "signs", " ", "differ", " ", "then", " ", "max", " ", "return", "s", " ", "the", " ", "operand", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "posit", "ive", " ", "sign", " ", "and", " ", "min", " ", "return", "s", " ", "the", " ", "operand", " ", "with", " ", "the", " ", "negati", "ve", " ", "sign_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "signs", " ", "are", " ", "the", " ", "same", " ", "then", " ", "the", " ", "expon", "ent", " ", "is", " ", "used", " ", "to", " ", "select_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "result", ".", " ", " ", "Thi", "s", " ", "is", " ", "exact", "ly", " ", "the", " ", "orderi", "ng", " ", "used", " ", "in", " ", "compare", "\\u", "total", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "compare", "\\u", "total_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "other_", "\\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 ", " _", "ans_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "min_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "small", "er", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Lik", "e", " ", "min", "(", "self", ",", " ", "other", ")", " ", "except", " ", "if", " ", "one", " ", "is", " ", "not", " ", "a", " ", "number", ",", " ", "return", "s", "\\", "10", ";", " ", " ", " ", " ", "Na", "N", " ", "(", "and", " ", "signal", "s", " ", "if", " ", "one", " ", "is", " ", "s", "Na", "N", ").", " ", " ", "Al", "so", " ", "round", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "one", " ", "operand", " ", "is", " ", "a", " ", "quie", "t", " ", "Na", "N", " ", "and", " ", "the", " ", "other", " ", "is", " ", "number", ",", " ", "then", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "is", " ", "alw", "ay", "s", " ", "returned_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sn_", "=_", "self_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on_", "=_", "other_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sn_", "or_", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "on_", "==_", "1_", "and_", "sn_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sn_", "==_", "1_", "and_", "on_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "other_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "compare", "\\u", "total_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "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 ", " _", "ans_", "=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "isin", "teg", "er_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "whe", "ther", " ", "self", " ", "is", " ", "an", " ", "integ", "er", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\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_", "if_", "self_", "._", "\\u", "exp_", ">=_", "0_", ":_", "\\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_", "rest_", "=_", "self_", "._", "\\u", "int_", "[_", "self_", "._", "\\u", "exp_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rest_", "==_", "'", "0", "'_", "*_", "len_", "(_", "rest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ise", "ven", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "even", ".", " ", " ", "Assume", "s", " ", "self", " ", "is", " ", "an", " ", "integ", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "or_", "self_", "._", "\\u", "exp_", ">_", "0_", ":_", "\\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_", "self_", "._", "\\u", "int_", "[_", "-_", "1_", "+_", "self_", "._", "\\u", "exp_", "]_", "in_", "'", "024", "6", "8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "adjusted", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "adjusted", " ", "expon", "ent", " ", "of", " ", "self", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "exp_", "+_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "Na", "N", " ", "or", " ", "Infinit", "y", ",", " ", "self", ".\\u", "exp", " ", "is", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "canonical", "_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "same", " ", "Deci", "mal", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "As", " ", "we", " ", "do", " ", "not", " ", "have", " ", "different", " ", "encoding", "s", " ", "for", " ", "the", " ", "same", " ", "number", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "receive", "d", " ", "object", " ", "alr", "ead", "y", " ", "is", " ", "in", " ", "its", " ", "canonical", " ", "form", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compare", "\\u", "signal_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compare", "s", " ", "self", " ", "to", " ", "the", " ", "other", " ", "operand", " ", "numerical", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", "'", "s", " ", "pretty", " ", "muc", "h", " ", "like", " ", "compare", "()", ",", " ", "but", " ", "all", " ", "Na", "Ns", " ", "signal", ",", " ", "with", " ", "signal", "ing", "\\", "10", ";", " ", " ", " ", " ", "Na", "Ns", " ", "tak", "ing", " ", "preceden", "ce", " ", "over", " ", "quie", "t", " ", "Na", "Ns", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "compare", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "compare_", "(_", "other_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compare", "\\u", "total_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compare", "s", " ", "self", " ", "to", " ", "other", " ", "usi", "ng", " ", "the", " ", "abstract", " ", "representations", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "not", " ", "like", " ", "the", " ", "standard", " ", "compare", ",", " ", "whi", "ch", " ", "use", " ", "thei", "r", " ", "numerical", "\\", "10", ";", " ", " ", " ", " ", "value", ".", " ", "Not", "e", " ", "tha", "t", " ", "a", " ", "total", " ", "orderi", "ng", " ", "is", " ", "defin", "ed", " ", "for", " ", "all", " ", "possib", "le", " ", "abstract", "\\", "10", ";", " ", " ", " ", " ", "representations", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "one", " ", "is", " ", "negati", "ve", " ", "and", " ", "the", " ", "other", " ", "is", " ", "posit", "ive", ",", " ", "it", "'", "s", " ", "easy", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", "and_", "not_", "other_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Nega", "tiv", "e", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "sign_", "and_", "other_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sign_", "=_", "self_", "._", "\\u", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", "'", "s", " ", "handle", " ", "bot", "h", " ", "Na", "N", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "self", "\\u", "nan_", "=_", "self_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "nan_", "=_", "other_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self", "\\u", "nan_", "or_", "other", "\\u", "nan_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self", "\\u", "nan_", "==_", "other", "\\u", "nan_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "compare", " ", "payload", "s", " ", "as", " ", "tho", "ugh", " ", "the", "y", "'", "re", " ", "integers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self", "\\u", "key_", "=_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", ",_", "self_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "key_", "=_", "len_", "(_", "other_", "._", "\\u", "int_", ")_", ",_", "other_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self", "\\u", "key_", "<_", "other", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u", "One_", "\\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_", "\\u", "Nega", "tiv", "e", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "key_", ">_", "other", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u", "Nega", "tiv", "e", "One_", "\\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_", "\\u", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "Zero_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self", "\\u", "nan_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u", "Nega", "tiv", "e", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other", "\\u", "nan_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "nan_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u", "Nega", "tiv", "e", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other", "\\u", "nan_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u", "One_", "\\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", "\\u", "nan_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other", "\\u", "nan_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u", "Nega", "tiv", "e", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "\\u", "nan_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other", "\\u", "nan_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u", "Nega", "tiv", "e", "One_", "\\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_", "self_", "<_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Nega", "tiv", "e", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", ">_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", "<_", "other_", "._", "\\u", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "One_", "\\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_", "\\u", "Nega", "tiv", "e", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp_", ">_", "other_", "._", "\\u", "exp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Nega", "tiv", "e", "One_", "\\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_", "\\u", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "Zero_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compare", "\\u", "total", "\\u", "mag_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compare", "s", " ", "self", " ", "to", " ", "other", " ", "usi", "ng", " ", "abstract", " ", "repr", ".,", " ", "ign", "orin", "g", " ", "sign", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Lik", "e", " ", "compare", "\\u", "total", ",", " ", "but", " ", "with", " ", "operand", "'", "s", " ", "sign", " ", "ignore", "d", " ", "and", " ", "assume", "d", " ", "to", " ", "be", " ", "0.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "self_", "._", "copy", "\\u", "abs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "=_", "other_", "._", "copy", "\\u", "abs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "._", "compare", "\\u", "total_", "(_", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "\\u", "abs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "copy", " ", "with", " ", "the", " ", "sign", " ", "set", " ", "to", " ", "0.", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "self_", "._", "\\u", "int_", ",_", "self_", "._", "\\u", "exp_", ",_", "self_", "._", "\\u", "is", "\\u", "special_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "\\u", "negate", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "copy", " ", "with", " ", "the", " ", "sign", " ", "inverted", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "self_", "._", "\\u", "int_", ",_", "self_", "._", "\\u", "exp_", ",_", "self_", "._", "\\u", "is", "\\u", "special_", ")_", "\\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_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "1_", ",_", "self_", "._", "\\u", "int_", ",_", "self_", "._", "\\u", "exp_", ",_", "self_", "._", "\\u", "is", "\\u", "special_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "copy", "\\u", "sign_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "self", " ", "with", " ", "the", " ", "sign", " ", "of", " ", "other", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "other_", "._", "\\u", "sign_", ",_", "self_", "._", "\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "exp_", ",_", "self_", "._", "\\u", "is", "\\u", "special_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exp_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "e", " ", "**", " ", "self", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exp", "(", "Na", "N", ")", " ", "=", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exp", "(-", "Infinit", "y", ")", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Zero_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exp", "(", "0", ")", " ", "=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "One_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exp", "(", "Infinit", "y", ")", " ", "=", " ", "Infinit", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "result", " ", "is", " ", "now", " ", "guaran", "tee", "d", " ", "to", " ", "be", " ", "ine", "xac", "t", " ", "(", "the", " ", "true_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mathe", "matical", " ", "result", " ", "is", " ", "transc", "ende", "nta", "l", ").", " ", "There", "'", "s", " ", "no", " ", "need", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raise", " ", "Round", "ed", " ", "and", " ", "Ine", "xac", "t", " ", "here", "---", "the", "y", "'", "ll", " ", "alw", "ay", "s", " ", "be", " ", "raise", "d", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "result", " ", "of", " ", "the", " ", "call", " ", "to", " ", "\\u", "fix", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "context_", "._", "prec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adj_", "=_", "self_", "._", "adjusted", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "only", " ", "need", " ", "to", " ", "do", " ", "any", " ", "computation", " ", "for", " ", "quite", " ", "a", " ", "small", " ", "range_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "adjusted", " ", "expon", "ents", "---", "for", " ", "example", ",", " ", "-", "2", "9", " ", "<=", " ", "adj", " ", "<=", " ", "10", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "default", " ", "context", ".", " ", " ", "For", " ", "small", "er", " ", "expon", "ent", " ", "the", " ", "result", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "indi", "stin", "gui", "sha", "ble", " ", "from", " ", "1", " ", "at", " ", "the", " ", "give", "n", " ", "preci", "sion", ",", " ", "whi", "le", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "large", "r", " ", "expon", "ent", " ", "the", " ", "result", " ", "eit", "her", " ", "overflow", "s", " ", "or", " ", "under", "flow", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", "==_", "0_", "and_", "adj_", ">_", "len_", "(_", "str_", "(_", "(_", "context_", "._", "Ema", "x_", "+_", "1_", ")_", "*_", "3_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "overflow", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "'", "1", "'_", ",_", "context_", "._", "Ema", "x_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "sign_", "==_", "1_", "and_", "adj_", ">_", "len_", "(_", "str_", "(_", "(_", "-_", "context_", "._", "Et", "in", "y_", "(_", ")_", "+_", "1_", ")_", "*_", "3_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "under", "flow", " ", "to", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "'", "1", "'_", ",_", "context_", "._", "Et", "in", "y_", "(_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "sign_", "==_", "0_", "and_", "adj_", "<_", "-_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "p", "+", "1", " ", "digit", "s", ";", " ", "final", " ", "round", " ", "will", " ", "raise", " ", "correct", " ", "flags_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "'", "1", "'_", "+_", "'", "0", "'_", "*_", "(_", "p_", "-_", "1_", ")_", "+_", "'", "1", "'_", ",_", "-_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "sign_", "==_", "1_", "and_", "adj_", "<_", "-_", "p_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "p", "+", "1", " ", "digit", "s", ";", " ", "final", " ", "round", " ", "will", " ", "raise", " ", "correct", " ", "flags_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "'", "9", "'_", "*_", "(_", "p_", "+_", "1_", ")_", ",_", "-_", "p_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "genera", "l", " ", "case_", "\\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 ", " _", "op_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", ",_", "e_", "=_", "op_", "._", "int_", ",_", "op_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "op_", "._", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "-_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "correct", "ly", " ", "rounded", " ", "result", ":", " ", "increase", " ", "preci", "sion", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", " ", "digit", "s", " ", "at", " ", "a", " ", "time", " ", "unti", "l", " ", "we", " ", "get", " ", "an", " ", "una", "mbi", "guous", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "round", "able", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeff_", ",_", "exp_", "=_", "\\u", "dex", "p_", "(_", "c_", ",_", "e_", ",_", "p_", "+_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coeff_", "%_", "(_", "5_", "*_", "10_", "**_", "(_", "len_", "(_", "str_", "(_", "coeff_", ")_", ")_", "-_", "p_", "-_", "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_", "extra_", "+=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "str_", "(_", "coeff_", ")_", ",_", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "this", " ", "stage", ",", " ", "ans", " ", "shou", "ld", " ", "round", " ", "correct", "ly", " ", "with", " ", "*", "any", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rounding", " ", "mode", ",", " ", "not", " ", "just", " ", "with", " ", "ROUND", "\\u", "HALF", "\\u", "EVE", "N_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "context_", "._", "\\u", "shallow", "\\u", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rounding", "_", "=_", "context_", "._", "\\u", "set\\u", "rounding", "_", "(_", "ROUND", "\\u", "HALF", "\\u", "EVE", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "rounding", "_", "=_", "rounding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "canonical", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "canonical", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", "ly", ",", " ", "the", " ", "encoding", " ", "of", " ", "a", " ", "Deci", "mal", " ", "instance", " ", "is", " ", "alw", "ay", "s", "\\", "10", ";", " ", " ", " ", " ", "canonical", ",", " ", "so", " ", "this", " ", "method", " ", "return", "s", " ", "Tru", "e", " ", "for", " ", "any", " ", "Deci", "mal", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "finite", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "finite", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Deci", "mal", " ", "instance", " ", "is", " ", "consider", "ed", " ", "finite", " ", "if", " ", "it", " ", "is", " ", "nei", "ther", "\\", "10", ";", " ", " ", " ", " ", "infini", "te", " ", "nor", " ", "a", " ", "Na", "N", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "not_", "self_", "._", "\\u", "is", "\\u", "special_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "infini", "te_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "infini", "te", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "exp_", "==_", "'", "F", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "nan_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "a", " ", "q", "Na", "N", " ", "or", " ", "s", "Na", "N", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "exp_", "in_", "(_", "'", "n", "'_", ",_", "'", "N", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "normal_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "a", " ", "normal", " ", "number", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "not_", "self_", ":_", "\\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_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "context_", "._", "Emi", "n_", "<=_", "self_", "._", "adjusted", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "qna", "n_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "a", " ", "quie", "t", " ", "Na", "N", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "exp_", "==_", "'", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "signed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "negati", "ve", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "sign_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "sna", "n_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "a", " ", "signal", "ing", " ", "Na", "N", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "exp_", "==_", "'", "N", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "subn", "ormal", "_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "subn", "ormal", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "not_", "self_", ":_", "\\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_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "adjusted", "_", "(_", ")_", "<_", "context_", "._", "Emi", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "zero_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "a", " ", "zero", ";", " ", "other", "wis", "e", " ", "return", " ", "Fal", "se", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "not_", "self_", "._", "\\u", "is", "\\u", "special_", "and_", "self_", "._", "\\u", "int_", "==_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ln", "\\u", "exp", "\\u", "bound_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compute", " ", "a", " ", "lower", " ", "bound", " ", "for", " ", "the", " ", "adjusted", " ", "expon", "ent", " ", "of", " ", "self", ".", "ln", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "other", " ", "words", ",", " ", "compute", " ", "r", " ", "suc", "h", " ", "tha", "t", " ", "self", ".", "ln", "()", " ", ">=", " ", "10", "**", "r", ".", " ", " ", "Assume", "s", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "self", " ", "is", " ", "finite", " ", "and", " ", "posit", "ive", " ", "and", " ", "tha", "t", " ", "self", " ", "!=", " ", "1", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "0.", "1", " ", "<=", " ", "x", " ", "<=", " ", "10", " ", "we", " ", "use", " ", "the", " ", "inequal", "iti", "es", " ", "1", "-1", "/", "x", " ", "<=", " ", "ln", "(", "x", ")", " ", "<=", " ", "x", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "adj_", "=_", "self_", "._", "\\u", "exp_", "+_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "adj_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "argu", "ment", " ", ">=", " ", "10", ";", " ", "we", " ", "use", " ", "23", "/", "10", " ", "=", " ", "2.3", " ", "as", " ", "a", " ", "lower", " ", "bound", " ", "for", " ", "ln", "(", "10", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "str_", "(_", "adj_", "*_", "23_", "//_", "10_", ")_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "adj_", "<=_", "-_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "argu", "ment", " ", "<=", " ", "0.1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "str_", "(_", "(_", "-_", "1_", "-_", "adj_", ")_", "*_", "23_", "//_", "10_", ")_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "op_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", ",_", "e_", "=_", "op_", "._", "int_", ",_", "op_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "adj_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "1", " ", "<", " ", "self", " ", "<", " ", "10_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", "=_", "str_", "(_", "c_", "-_", "10_", "**_", "-_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "den_", "=_", "str_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "len_", "(_", "num_", ")_", "-_", "len_", "(_", "den_", ")_", "-_", "(_", "num_", "<_", "den_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "adj", " ", "==", " ", "-1", ",", " ", "0.", "1", " ", "<=", " ", "self", " ", "<", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "e_", "+_", "len_", "(_", "str_", "(_", "10_", "**_", "-_", "e_", "-_", "c_", ")_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ln_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "natur", "al", " ", "(", "base", " ", "e", ")", " ", "logar", "ithm", " ", "of", " ", "self", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ln", "(", "Na", "N", ")", " ", "=", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ln", "(", "0.", "0", ")", " ", "==", " ", "-", "Infinit", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Nega", "tiv", "e", "Infinit", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ln", "(", "Infinit", "y", ")", " ", "=", " ", "Infinit", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Infinit", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ln", "(", "1.0", ")", " ", "==", " ", "0.0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "==_", "\\u", "One_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Zero_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ln", "(", "negati", "ve", ")", " ", "raise", "s", " ", "Inva", "lid", "Operation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ln", " ", "of", " ", "a", " ", "negati", "ve", " ", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", " ", "is", " ", "irr", "ation", "al", ",", " ", "so", " ", "necessar", "il", "y", " ", "ine", "xac", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "op_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", ",_", "e_", "=_", "op_", "._", "int_", ",_", "op_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "context_", "._", "prec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "correct", "ly", " ", "rounded", " ", "result", ":", " ", "repeated", "ly", " ", "increase", " ", "preci", "sion", " ", "by", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unti", "l", " ", "we", " ", "get", " ", "an", " ", "una", "mbi", "guous", "ly", " ", "round", "able", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "places_", "=_", "p_", "-_", "self_", "._", "\\u", "ln", "\\u", "exp", "\\u", "bound_", "(_", ")_", "+_", "2_", "#", " ", "at", " ", "leas", "t", " ", "p", "+", "3", " ", "places_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeff_", "=_", "\\u", "dlo", "g_", "(_", "c_", ",_", "e_", ",_", "places_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "len", "(", "str", "(", "abs", "(", "coef", "f", ")))", "-", "p", " ", ">=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "coeff_", "%_", "(_", "5_", "*_", "10_", "**_", "(_", "len_", "(_", "str_", "(_", "abs_", "(_", "coeff_", ")_", ")_", ")_", "-_", "p_", "-_", "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_", "places_", "+=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "int_", "(_", "coeff_", "<_", "0_", ")_", ",_", "str_", "(_", "abs_", "(_", "coeff_", ")_", ")_", ",_", "-_", "places_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", "._", "\\u", "shallow", "\\u", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rounding", "_", "=_", "context_", "._", "\\u", "set\\u", "rounding", "_", "(_", "ROUND", "\\u", "HALF", "\\u", "EVE", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "rounding", "_", "=_", "rounding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "log", "10", "\\u", "exp", "\\u", "bound_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compute", " ", "a", " ", "lower", " ", "bound", " ", "for", " ", "the", " ", "adjusted", " ", "expon", "ent", " ", "of", " ", "self", ".", "log", "10", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "other", " ", "words", ",", " ", "find", " ", "r", " ", "suc", "h", " ", "tha", "t", " ", "self", ".", "log", "10", "()", " ", ">=", " ", "10", "**", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "Assume", "s", " ", "tha", "t", " ", "self", " ", "is", " ", "finite", " ", "and", " ", "posit", "ive", " ", "and", " ", "tha", "t", " ", "self", " ", "!=", " ", "1", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "x", " ", ">=", " ", "10", " ", "or", " ", "x", " ", "<", " ", "0.", "1", " ", "we", " ", "only", " ", "need", " ", "a", " ", "bound", " ", "on", " ", "the", " ", "integer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", " ", "of", " ", "log", "10", "(", "self", "),", " ", "and", " ", "this", " ", "come", "s", " ", "direct", "ly", " ", "from", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expon", "ent", " ", "of", " ", "x", ".", " ", " ", "For", " ", "0.", "1", " ", "<=", " ", "x", " ", "<=", " ", "10", " ", "we", " ", "use", " ", "the", " ", "inequal", "ities_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", "-1", "/", "x", " ", "<=", " ", "log", "(", "x", ")", " ", "<=", " ", "x", "-1", ".", " ", "If", " ", "x", " ", ">", " ", "1", " ", "we", " ", "have", " ", "|", "log", "10", "(", "x", ")|", " ", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "1", "-1", "/", "x", ")/", "2.3", "1", " ", ">", " ", "0.", " ", " ", "If", " ", "x", " ", "<", " ", "1", " ", "then", " ", "|", "log", "10", "(", "x", ")|", " ", ">", " ", "(", "1", "-", "x", ")/", "2.3", "1", " ", ">", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "adj_", "=_", "self_", "._", "\\u", "exp_", "+_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "adj_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", " ", ">=", " ", "10_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "str_", "(_", "adj_", ")_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "adj_", "<=_", "-_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", " ", "<", " ", "0.1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "str_", "(_", "-_", "1_", "-_", "adj_", ")_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "op_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", ",_", "e_", "=_", "op_", "._", "int_", ",_", "op_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "adj_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "1", " ", "<", " ", "self", " ", "<", " ", "10_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", "=_", "str_", "(_", "c_", "-_", "10_", "**_", "-_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "den_", "=_", "str_", "(_", "231_", "*_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "len_", "(_", "num_", ")_", "-_", "len_", "(_", "den_", ")_", "-_", "(_", "num_", "<_", "den_", ")_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "adj", " ", "==", " ", "-1", ",", " ", "0.", "1", " ", "<=", " ", "self", " ", "<", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num_", "=_", "str_", "(_", "10_", "**_", "-_", "e_", "-_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "len_", "(_", "num_", ")_", "+_", "e_", "-_", "(_", "num_", "<_", "\"", "231", "\"_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log10_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "base", " ", "10", " ", "logar", "ithm", " ", "of", " ", "self", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", "10", "(", "Na", "N", ")", " ", "=", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", "10", "(", "0.", "0", ")", " ", "==", " ", "-", "Infinit", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Nega", "tiv", "e", "Infinit", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", "10", "(", "Infinit", "y", ")", " ", "=", " ", "Infinit", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Infinit", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", "10", "(", "negati", "ve", " ", "or", " ", "-", "Infinit", "y", ")", " ", "raise", "s", " ", "Inva", "lid", "Operation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "10", " ", "of", " ", "a", " ", "negati", "ve", " ", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", "10", "(", "10", "**", "n", ")", " ", "=", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "int_", "[_", "0_", "]_", "==_", "'", "1", "'_", "and_", "self_", "._", "\\u", "int_", "[_", "1_", ":_", "]_", "==_", "'", "0", "'_", "*_", "(_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "answer", " ", "may", " ", "need", " ", "rounding", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "Decimal_", "(_", "self_", "._", "\\u", "exp_", "+_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "result", " ", "is", " ", "irr", "ation", "al", ",", " ", "so", " ", "necessar", "il", "y", " ", "ine", "xac", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op_", "=_", "\\u", "Work", "Rep", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", ",_", "e_", "=_", "op_", "._", "int_", ",_", "op_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "context_", "._", "prec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "correct", "ly", " ", "rounded", " ", "result", ":", " ", "repeated", "ly", " ", "increase", " ", "precision_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unti", "l", " ", "result", " ", "is", " ", "una", "mbi", "guous", "ly", " ", "round", "able_", "\\u\\u\\uNL\\u\\u\\u_", "places_", "=_", "p_", "-_", "self_", "._", "\\u", "log", "10", "\\u", "exp", "\\u", "bound_", "(_", ")_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coeff_", "=_", "\\u", "dlo", "g1", "0_", "(_", "c_", ",_", "e_", ",_", "places_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "len", "(", "str", "(", "abs", "(", "coef", "f", ")))", "-", "p", " ", ">=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "coeff_", "%_", "(_", "5_", "*_", "10_", "**_", "(_", "len_", "(_", "str_", "(_", "abs_", "(_", "coeff_", ")_", ")_", ")_", "-_", "p_", "-_", "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_", "places_", "+=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "int_", "(_", "coeff_", "<_", "0_", ")_", ",_", "str_", "(_", "abs_", "(_", "coeff_", ")_", ")_", ",_", "-_", "places_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "context_", "._", "\\u", "shallow", "\\u", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rounding", "_", "=_", "context_", "._", "\\u", "set\\u", "rounding", "_", "(_", "ROUND", "\\u", "HALF", "\\u", "EVE", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ans_", "=_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "rounding", "_", "=_", "rounding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "b_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "the", " ", "expon", "ent", " ", "of", " ", "the", " ", "magnitude", " ", "of", " ", "self", "'", "s", " ", "MS", "D", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "result", " ", "is", " ", "the", " ", "integ", "er", " ", "whi", "ch", " ", "is", " ", "the", " ", "expon", "ent", " ", "of", " ", "the", " ", "magnitude", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "most", " ", "significant", " ", "digit", " ", "of", " ", "self", " ", "(", "as", " ", "tho", "ugh", " ", "it", " ", "wer", "e", " ", "truncat", "ed", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "a", " ", "single", " ", "digit", " ", "whi", "le", " ", "maintain", "ing", " ", "the", " ", "value", " ", "of", " ", "tha", "t", " ", "digit", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "with", "out", " ", "limit", "ing", " ", "the", " ", "result", "ing", " ", "expon", "ent", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "log", "b", "(", "Na", "N", ")", " ", "=", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", "b", "(", "+/-", "Inf", ")", " ", "=", " ", "+", "Inf", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Infinit", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", "b", "(", "0", ")", " ", "=", " ", "-", "Inf", ",", " ", "Divis", "ion", "By", "Zero_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Divis", "ion", "By", "Zero_", ",_", "'", "log", "b", "(", "0", ")'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", "wis", "e", ",", " ", "simp", "ly", " ", "return", " ", "the", " ", "adjusted", " ", "expon", "ent", " ", "of", " ", "self", ",", " ", "as", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Deci", "mal", ".", " ", " ", "Not", "e", " ", "tha", "t", " ", "no", " ", "atte", "mpt", " ", "is", " ", "made", " ", "to", " ", "fit", " ", "the", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "int", "o", " ", "the", " ", "current", " ", "context", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "Decimal_", "(_", "self_", "._", "adjusted", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "isl", "ogi", "cal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "self", " ", "is", " ", "a", " ", "logical", " ", "operand", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "bei", "ng", " ", "logical", ",", " ", "it", " ", "must", " ", "be", " ", "a", " ", "finite", " ", "number", " ", "with", " ", "a", " ", "sign", " ", "of", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "expon", "ent", " ", "of", " ", "0", ",", " ", "and", " ", "a", " ", "coefficient", " ", "who", "se", " ", "digit", "s", " ", "must", " ", "all", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "eit", "her", " ", "0", " ", "or", " ", "1", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", "!=_", "0_", "or_", "self_", "._", "\\u", "exp_", "!=_", "0_", ":_", "\\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_", "for_", "dig", "_", "in_", "self_", "._", "\\u", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dig", "_", "not_", "in_", "'", "01", "'_", ":_", "\\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]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "fill", "\\u", "logical", "_", "(_", "self_", ",_", "context_", ",_", "opa", "_", ",_", "op", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dif_", "=_", "context_", "._", "prec_", "-_", "len_", "(_", "opa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dif_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opa", "_", "=_", "'", "0", "'_", "*_", "dif_", "+_", "opa", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dif_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opa", "_", "=_", "opa", "_", "[_", "-_", "context_", "._", "prec_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dif_", "=_", "context_", "._", "prec_", "-_", "len_", "(_", "op", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dif_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op", "b_", "=_", "'", "0", "'_", "*_", "dif_", "+_", "op", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dif_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op", "b_", "=_", "op", "b_", "[_", "-_", "context_", "._", "prec_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "opa", "_", ",_", "op", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logical", "\\u", "and_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Appl", "ies", " ", "an", " ", "'", "and", "'", " ", "operati", "on", " ", "bet", "ween", " ", "self", " ", "and", " ", "other", "'", "s", " ", "digit", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "isl", "ogi", "cal_", "(_", ")_", "or_", "not_", "other_", "._", "\\u", "isl", "ogi", "cal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fill", " ", "to", " ", "context", ".", "prec_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "opa", "_", ",_", "op", "b_", ")_", "=_", "self_", "._", "\\u", "fill", "\\u", "logical", "_", "(_", "context_", ",_", "self_", "._", "\\u", "int_", ",_", "other_", "._", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "the", " ", "operati", "on", ",", " ", "and", " ", "clean", " ", "startin", "g", " ", "zero", "es_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "\"\"_", "._", "join_", "(_", "[_", "str_", "(_", "int_", "(_", "a_", ")_", "&_", "int_", "(_", "b_", ")_", ")_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "opa", "_", ",_", "op", "b_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "result_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "or_", "'", "0", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logical", "\\u", "invert_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Invert", " ", "all", " ", "its", " ", "digit", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "logical", "\\u", "xor_", "(_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "'", "1", "'_", "*_", "context_", "._", "prec_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logical", "\\u", "or_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Appl", "ies", " ", "an", " ", "'", "or", "'", " ", "operati", "on", " ", "bet", "ween", " ", "self", " ", "and", " ", "other", "'", "s", " ", "digit", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "isl", "ogi", "cal_", "(_", ")_", "or_", "not_", "other_", "._", "\\u", "isl", "ogi", "cal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fill", " ", "to", " ", "context", ".", "prec_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "opa", "_", ",_", "op", "b_", ")_", "=_", "self_", "._", "\\u", "fill", "\\u", "logical", "_", "(_", "context_", ",_", "self_", "._", "\\u", "int_", ",_", "other_", "._", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "the", " ", "operati", "on", ",", " ", "and", " ", "clean", " ", "startin", "g", " ", "zero", "es_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "\"\"_", "._", "join_", "(_", "[_", "str_", "(_", "int_", "(_", "a_", ")_", "|_", "int_", "(_", "b_", ")_", ")_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "opa", "_", ",_", "op", "b_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "result_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "or_", "'", "0", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logical", "\\u", "xor_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Appl", "ies", " ", "an", " ", "'", "xor", "'", " ", "operati", "on", " ", "bet", "ween", " ", "self", " ", "and", " ", "other", "'", "s", " ", "digit", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "isl", "ogi", "cal_", "(_", ")_", "or_", "not_", "other_", "._", "\\u", "isl", "ogi", "cal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fill", " ", "to", " ", "context", ".", "prec_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "opa", "_", ",_", "op", "b_", ")_", "=_", "self_", "._", "\\u", "fill", "\\u", "logical", "_", "(_", "context_", ",_", "self_", "._", "\\u", "int_", ",_", "other_", "._", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "the", " ", "operati", "on", ",", " ", "and", " ", "clean", " ", "startin", "g", " ", "zero", "es_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "\"\"_", "._", "join_", "(_", "[_", "str_", "(_", "int_", "(_", "a_", ")_", "^_", "int_", "(_", "b_", ")_", ")_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "opa", "_", ",_", "op", "b_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "result_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "or_", "'", "0", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "max", "\\u", "mag_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compare", "s", " ", "the", " ", "values", " ", "numerical", "ly", " ", "with", " ", "thei", "r", " ", "sign", " ", "ignore", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "one", " ", "operand", " ", "is", " ", "a", " ", "quie", "t", " ", "Na", "N", " ", "and", " ", "the", " ", "other", " ", "is", " ", "number", ",", " ", "then", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "is", " ", "alw", "ay", "s", " ", "returned_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sn_", "=_", "self_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on_", "=_", "other_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sn_", "or_", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "on_", "==_", "1_", "and_", "sn_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sn_", "==_", "1_", "and_", "on_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "other_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "self_", "._", "copy", "\\u", "abs_", "(_", ")_", "._", "\\u", "cmp_", "(_", "other_", "._", "copy", "\\u", "abs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "compare", "\\u", "total_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "other_", "\\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 ", " _", "ans_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "min", "\\u", "mag_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compare", "s", " ", "the", " ", "values", " ", "numerical", "ly", " ", "with", " ", "thei", "r", " ", "sign", " ", "ignore", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", "or_", "other_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "one", " ", "operand", " ", "is", " ", "a", " ", "quie", "t", " ", "Na", "N", " ", "and", " ", "the", " ", "other", " ", "is", " ", "number", ",", " ", "then", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "is", " ", "alw", "ay", "s", " ", "returned_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sn_", "=_", "self_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on_", "=_", "other_", "._", "\\u", "isnan_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sn_", "or_", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "on_", "==_", "1_", "and_", "sn_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sn_", "==_", "1_", "and_", "on_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "other_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "self_", "._", "copy", "\\u", "abs_", "(_", ")_", "._", "\\u", "cmp_", "(_", "other_", "._", "copy", "\\u", "abs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "compare", "\\u", "total_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "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 ", " _", "ans_", "=_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ans_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next", "\\u", "minus_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "large", "st", " ", "represent", "able", " ", "number", " ", "small", "er", " ", "than", " ", "its", "elf", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Nega", "tiv", "e", "Infinit", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "'", "9", "'_", "*_", "context_", "._", "prec_", ",_", "context_", "._", "Et", "op_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "context_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "set\\u", "rounding", "_", "(_", "ROUND", "\\u", "FLO", "OR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "ignore", "\\u", "all", "\\u", "flags_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "self_", "=_", "self_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "self_", "!=_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "new", "\\u", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "sub\\u", "\\u_", "(_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "'", "1", "'_", ",_", "context_", "._", "Et", "in", "y_", "(_", ")_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next", "\\u", "plus_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "smallest", " ", "represent", "able", " ", "number", " ", "large", "r", " ", "than", " ", "its", "elf", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "Infinit", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "1_", ",_", "'", "9", "'_", "*_", "context_", "._", "prec_", ",_", "context_", "._", "Et", "op_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "context_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "set\\u", "rounding", "_", "(_", "ROUND", "\\u", "CE", "ILI", "NG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "ignore", "\\u", "all", "\\u", "flags_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "self_", "=_", "self_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "self_", "!=_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "new", "\\u", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "add\\u\\u_", "(_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "0_", ",_", "'", "1", "'_", ",_", "context_", "._", "Et", "in", "y_", "(_", ")_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next", "\\u", "tow", "ard_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "number", " ", "closest", " ", "to", " ", "self", ",", " ", "in", " ", "the", " ", "direction", " ", "towards", " ", "other", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "result", " ", "is", " ", "the", " ", "closest", " ", "represent", "able", " ", "number", " ", "to", " ", "self", "\\", "10", ";", " ", " ", " ", " ", "(", "excluding", " ", "self", ")", " ", "tha", "t", " ", "is", " ", "in", " ", "the", " ", "direction", " ", "towards", " ", "other", ",", "\\", "10", ";", " ", " ", " ", " ", "unl", "ess", " ", "bot", "h", " ", "have", " ", "the", " ", "same", " ", "value", ".", " ", " ", "If", " ", "the", " ", "two", " ", "operand", "s", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "numerical", "ly", " ", "equal", ",", " ", "then", " ", "the", " ", "result", " ", "is", " ", "a", " ", "copy", " ", "of", " ", "self", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "sign", " ", "set", " ", "to", " ", "be", " ", "the", " ", "same", " ", "as", " ", "the", " ", "sign", " ", "of", " ", "other", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "comparison_", "=_", "self_", "._", "\\u", "cmp_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "comparison_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "copy", "\\u", "sign_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "comparison_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "next", "\\u", "plus_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "compa", "ris", "on", " ", "==", " ", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ans_", "=_", "self_", "._", "next", "\\u", "minus_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "decide", " ", "whi", "ch", " ", "flags", " ", "to", " ", "raise", " ", "usi", "ng", " ", "value", " ", "of", " ", "ans_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ans_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Over", "flow_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Infinit", "e", " ", "result", " ", "from", " ", "next", "\\u", "tow", "ard", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ans_", "._", "\\u", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Ine", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Round", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ans_", "._", "adjusted", "_", "(_", ")_", "<_", "context_", "._", "Emi", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Under", "flow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Sub", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Ine", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Round", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "preci", "sion", " ", "==", " ", "1", " ", "then", " ", "we", " ", "don", "'", "t", " ", "raise", " ", "Cla", "mpe", "d", " ", "for", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "result", " ", "0E", "-", "Et", "in", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Cla", "mpe", "d_", ")_", "\\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_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "number", "\\u", "class_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "an", " ", "indicati", "on", " ", "of", " ", "the", " ", "class", " ", "of", " ", "self", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "class", " ", "is", " ", "one", " ", "of", " ", "the", " ", "follow", "ing", " ", "string", "s", ":", "\\", "10", ";", " ", " ", "s", "Na", "N", "\\", "10", ";", " ", " ", "Na", "N", "\\", "10", ";", " ", " ", "-", "Infinit", "y", "\\", "10", ";", " ", " ", "-", "Normal", "\\", "10", ";", " ", " ", "-", "Sub", "normal", "\\", "10", ";", " ", " ", "-", "Zero", "\\", "10", ";", " ", " ", "+", "Zero", "\\", "10", ";", " ", " ", "+", "Sub", "normal", "\\", "10", ";", " ", " ", "+", "Normal", "\\", "10", ";", " ", " ", "+", "Infinit", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "sna", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "s", "Na", "N", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "qna", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Na", "N", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inf_", "=_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "inf_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"+", "Infinit", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "inf_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"-", "Infinit", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "zero_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"-", "Zero", "\"_", "\\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_", "\"+", "Zero", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "subn", "ormal", "_", "(_", "context_", "=_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"-", "Sub", "normal", "\"_", "\\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_", "\"+", "Sub", "normal", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "a", " ", "normal", ",", " ", "regular", ",", " ", "bor", "ing", " ", "number", ",", " ", ":)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "sign_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"-", "Normal", "\"_", "\\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_", "\"+", "Normal", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "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_", "radi", "x_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ju", "st", " ", "return", "s", " ", "10", ",", " ", "as", " ", "this", " ", "is", " ", "Deci", "mal", ",", " ", ":)", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Decimal_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rotate_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "rotated", " ", "copy", " ", "of", " ", "self", ",", " ", "value", "-", "of", "-", "other", " ", "times", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "exp_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "-_", "context_", "._", "prec_", "<=_", "int_", "(_", "other_", ")_", "<=_", "context_", "._", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "values", ",", " ", "pad", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tor", "ot_", "=_", "int_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rot", "dig", "_", "=_", "self_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "ad_", "=_", "context_", "._", "prec_", "-_", "len_", "(_", "rot", "dig", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "top", "ad_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rot", "dig", "_", "=_", "'", "0", "'_", "*_", "top", "ad_", "+_", "rot", "dig", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "top", "ad_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rot", "dig", "_", "=_", "rot", "dig", "_", "[_", "-_", "top", "ad_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", "'", "s", " ", "rota", "te", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rotated", "_", "=_", "rot", "dig", "_", "[_", "tor", "ot_", ":_", "]_", "+_", "rot", "dig", "_", "[_", ":_", "tor", "ot_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rotated", "_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "or_", "'", "0", "'_", ",_", "self_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "scale", "b_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "self", " ", "operand", " ", "after", " ", "addin", "g", " ", "the", " ", "second", " ", "value", " ", "to", " ", "its", " ", "exp", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "exp_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lim", "inf_", "=_", "-_", "2_", "*_", "(_", "context_", "._", "Ema", "x_", "+_", "context_", "._", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lim", "sup_", "=_", "2_", "*_", "(_", "context_", "._", "Ema", "x_", "+_", "context_", "._", "prec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "lim", "inf_", "<=_", "int_", "(_", "other_", ")_", "<=_", "lim", "sup_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "self_", "._", "\\u", "int_", ",_", "self_", "._", "\\u", "exp_", "+_", "int_", "(_", "other_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "d_", "._", "\\u", "fix_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shift_", "(_", "self_", ",_", "other_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "shifted", " ", "copy", " ", "of", " ", "self", ",", " ", "value", "-", "of", "-", "other", " ", "times", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other_", "=_", "\\u", "convert", "\\u", "other_", "(_", "other_", ",_", "raise", "it_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ans_", "=_", "self_", "._", "\\u", "check", "\\u", "nans", "_", "(_", "other_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ans_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "other_", "._", "\\u", "exp_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "-_", "context_", "._", "prec_", "<=_", "int_", "(_", "other_", ")_", "<=_", "context_", "._", "prec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "context_", "._", "\\u", "raise", "\\u", "error_", "(_", "Inva", "lid", "Operation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "isinf", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Decimal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "values", ",", " ", "pad", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tor", "ot_", "=_", "int_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rot", "dig", "_", "=_", "self_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "ad_", "=_", "context_", "._", "prec_", "-_", "len_", "(_", "rot", "dig", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "top", "ad_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rot", "dig", "_", "=_", "'", "0", "'_", "*_", "top", "ad_", "+_", "rot", "dig", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "top", "ad_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rot", "dig", "_", "=_", "rot", "dig", "_", "[_", "-_", "top", "ad_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", "'", "s", " ", "shift", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tor", "ot_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shifted", "_", "=_", "rot", "dig", "_", "[_", ":_", "tor", "ot_", "]_", "\\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 ", " _", "shifted", "_", "=_", "rot", "dig", "_", "+_", "'", "0", "'_", "*_", "tor", "ot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shifted", "_", "=_", "shifted", "_", "[_", "-_", "context_", "._", "prec_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shifted", "_", "._", "lstrip_", "(_", "'", "0", "'_", ")_", "or_", "'", "0", "'_", ",_", "self_", "._", "\\u", "exp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "reduce", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "(_", "str_", "(_", "self_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "copy", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "self_", ")_", "is_", "Decimal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "#", " ", "I", "'", "m", " ", "immutable", ";", " ", "there", "fore", " ", "I", " ", "am", " ", "my", " ", "own", " ", "clone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "str_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "self_", ")_", "is_", "Decimal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "#", " ", "My", " ", "component", "s", " ", "are", " ", "als", "o", " ", "immutable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "str_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "format\\u", "\\u_", "(_", "self_", ",_", "specifier", "_", ",_", "context_", "=_", "None_", ",_", "\\u", "locale", "conv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Format", " ", "a", " ", "Deci", "mal", " ", "instance", " ", "according", " ", "to", " ", "the", " ", "give", "n", " ", "specifier", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "specifier", " ", "shou", "ld", " ", "be", " ", "a", " ", "standard", " ", "format", " ", "specifier", ",", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "form", " ", "descri", "bed", " ", "in", " ", "PE", "P", " ", "310", "1", ".", " ", " ", "Formatt", "ing", " ", "types", " ", "'", "e", "',", " ", "'", "E", "',", " ", "'", "f", "',", "\\", "10", ";", " ", " ", " ", " ", "'", "F", "',", " ", "'", "g", "',", " ", "'", "G", "',", " ", "'", "n", "'", " ", "and", " ", "'%", "'", " ", "are", " ", "support", "ed", ".", " ", " ", "If", " ", "the", " ", "format", "ting", "\\", "10", ";", " ", " ", " ", " ", "type", " ", "is", " ", "omit", "ted", " ", "it", " ", "default", "s", " ", "to", " ", "'", "g", "'", " ", "or", " ", "'", "G", "',", " ", "depend", "ing", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "of", " ", "context", ".", "capital", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "PE", "P", " ", "310", "1", " ", "say", "s", " ", "tha", "t", " ", "if", " ", "the", " ", "type", " ", "is", " ", "not", " ", "presen", "t", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "shou", "ld", " ", "be", " ", "at", " ", "leas", "t", " ", "one", " ", "digit", " ", "after", " ", "the", " ", "decima", "l", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "take", " ", "the", " ", "liber", "ty", " ", "of", " ", "ign", "orin", "g", " ", "this", " ", "require", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Deci", "mal", "---", "it", "'", "s", " ", "presu", "mab", "ly", " ", "there", " ", "to", " ", "make", " ", "sure", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "format", "(", "float", ",", " ", "''", ")", " ", "behave", "s", " ", "similar", "ly", " ", "to", " ", "str", "(", "float", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "getcon", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "=_", "\\u", "parse", "\\u", "format\\u", "specifier", "_", "(_", "specifier", "_", ",_", "\\u", "locale", "conv_", "=_", "\\u", "locale", "conv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "special", " ", "values", " ", "don", "'", "t", " ", "care", " ", "abo", "ut", " ", "the", " ", "type", " ", "or", " ", "precision_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sign_", "=_", "\\u", "format\\u", "sign_", "(_", "self_", "._", "\\u", "sign_", ",_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "str_", "(_", "self_", "._", "copy", "\\u", "abs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "format\\u", "align_", "(_", "sign_", ",_", "body_", ",_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "type", " ", "of", " ", "Non", "e", " ", "default", "s", " ", "to", " ", "'", "g", "'", " ", "or", " ", "'", "G", "',", " ", "depend", "ing", " ", "on", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "spec_", "[_", "'", "type", "'_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "[_", "'", "type", "'_", "]_", "=_", "[_", "'", "g", "'_", ",_", "'", "G", "'_", "]_", "[_", "context_", "._", "capital", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "type", " ", "is", " ", "'%", "',", " ", "adjust", " ", "expon", "ent", " ", "of", " ", "self", " ", "according", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "spec_", "[_", "'", "type", "'_", "]_", "==_", "'%'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "\\u", "dec", "\\u", "from", "\\u", "triple_", "(_", "self_", "._", "\\u", "sign_", ",_", "self_", "._", "\\u", "int_", ",_", "self_", "._", "\\u", "exp_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "round", " ", "if", " ", "necessar", "y", ",", " ", "tak", "ing", " ", "rounding", " ", "mode", " ", "from", " ", "the", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rounding", "_", "=_", "context_", "._", "rounding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "precision_", "=_", "spec_", "[_", "'", "preci", "sion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "precision_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "spec_", "[_", "'", "type", "'_", "]_", "in_", "'", "e", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "self_", "._", "\\u", "round_", "(_", "precision_", "+_", "1_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "spec_", "[_", "'", "type", "'_", "]_", "in_", "'", "f", "F", "%'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "self_", "._", "\\u", "rescale", "_", "(_", "-_", "precision_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "spec_", "[_", "'", "type", "'_", "]_", "in_", "'", "g", "G", "'_", "and_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", ">_", "precision_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "self_", "._", "\\u", "round_", "(_", "precision_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "special", " ", "case", ":", " ", "zero", "s", " ", "with", " ", "a", " ", "posit", "ive", " ", "expon", "ent", " ", "can", "'", "t", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "represent", "ed", " ", "in", " ", "fixed", " ", "point", ";", " ", "rescale", " ", "them", " ", "to", " ", "0e", "0._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "and_", "self_", "._", "\\u", "exp_", ">_", "0_", "and_", "spec_", "[_", "'", "type", "'_", "]_", "in_", "'", "f", "F", "%'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "self_", "._", "\\u", "rescale", "_", "(_", "0_", ",_", "rounding", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "figure", " ", "out", " ", "placem", "ent", " ", "of", " ", "the", " ", "decima", "l", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "left", "digits_", "=_", "self_", "._", "\\u", "exp_", "+_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "spec_", "[_", "'", "type", "'_", "]_", "in_", "'", "e", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "and_", "precision_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "place_", "=_", "1_", "-_", "precision_", "\\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 ", " _", "dot", "place_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "spec_", "[_", "'", "type", "'_", "]_", "in_", "'", "f", "F", "%'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "place_", "=_", "left", "digits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "spec_", "[_", "'", "type", "'_", "]_", "in_", "'", "g", "G", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "exp_", "<=_", "0_", "and_", "left", "digits_", ">_", "-_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dot", "place_", "=_", "left", "digits_", "\\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 ", " _", "dot", "place_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "digit", "s", " ", "bef", "ore", " ", "and", " ", "after", " ", "decima", "l", " ", "point", ",", " ", "and", " ", "get", " ", "exponent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dot", "place_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "intp", "art_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frac", "part_", "=_", "'", "0", "'_", "*_", "(_", "-_", "dot", "place_", ")_", "+_", "self_", "._", "\\u", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dot", "place_", ">_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "intp", "art_", "=_", "self_", "._", "\\u", "int_", "+_", "'", "0", "'_", "*_", "(_", "dot", "place_", "-_", "len_", "(_", "self_", "._", "\\u", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frac", "part_", "=_", "''_", "\\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 ", " _", "intp", "art_", "=_", "self_", "._", "\\u", "int_", "[_", ":_", "dot", "place_", "]_", "or_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frac", "part_", "=_", "self_", "._", "\\u", "int_", "[_", "dot", "place_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exp_", "=_", "left", "digits_", "-_", "dot", "place_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "e", " ", "with", " ", "the", " ", "decima", "l", "-", "specific", " ", "stu", "ff", ";", " ", " ", "hand", " ", "over", " ", "the", " ", "rest_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "format", "ting", " ", "to", " ", "the", " ", "\\u", "format\\u", "number", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u", "format\\u", "number_", "(_", "self_", "._", "\\u", "sign_", ",_", "intp", "art_", ",_", "frac", "part_", ",_", "exp_", ",_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decimal_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "to", "java", "\\u\\u_", "(_", "self_", ",_", "java", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "java", "\\u", "class_", "not_", "in_", "(_", "Big", "Decimal_", ",_", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Py_", "._", "No", "Conversion", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Big", "Decimal_", "(_", "str_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 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, 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 ]
Unused import
algorhythms/HackerRankAlgorithms/K Candy Store.py
[ { "content": "\"\"\"\nProblem Statement\n\nJim enters a candy shop which has N different types of candies, each candy is of the same price. Jim has enough money to\nbuy K candies. In how many different ways can he purchase K candies if there are infinite candies of each kind?\n\"\"\"\nMOD = 10 ** 9\n__author__ = 'Danyang'\n\n\n\n\nif __name__ == \"__main__\":\n import sys\n\n f = open(\"1.in\", \"r\")\n # f = sys.stdin\n testcases = int(f.readline().strip())\n solution = Solution()\n for t in xrange(testcases):\n # construct cipher\n N = int(f.readline().strip())\n K = int(f.readline().strip())\n cipher = N, K\n # solve\n s = \"%s\\n\" % (solution.solve(cipher))\n print s,\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Solution(object):\n", "metadata": "root.Solution", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def __init__(self):\n \"\"\"\n \\binom nk=\\binom{n-1}{k-1}+\\binom{n-1}k, \\text{ for } 0<k<n,\n \"\"\"\n self.C = [[1 for _ in xrange(2000)] for _ in xrange(2000)]\n for n in xrange(1, 2000):\n for k in xrange(1, n): # 0<k<n\n self.C[n][k] = self.C[n - 1][k - 1] + self.C[n - 1][k]", "metadata": "root.Solution.__init__", "header": "['class', 'Solution', '(', 'object', ')', ':', '___EOS___']", "index": 11 }, { "content": " def solve(self, cipher):\n \"\"\"\n Abstract: N types, K holes, repeatable\n nCk when items are duplicated\n\n reference:\n dp algorithm: https://github.com/derekhh/HackerRank/blob/master/k-candy-store.cpp\n\n :param cipher: the cipher\n \"\"\"\n N, K = cipher\n return self.C[N + K - 1][K] % MOD", "metadata": "root.Solution.solve", "header": "['class', 'Solution', '(', 'object', ')', ':', '___EOS___']", "index": 20 } ]
[ { "span": "import sys", "start_line": 35, "start_column": 4, "end_line": 35, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Prob", "lem", " ", "State", "ment", "\\", "10", ";", "\\", "10", ";", "Ji", "m", " ", "enter", "s", " ", "a", " ", "cand", "y", " ", "shop", " ", "whi", "ch", " ", "has", " ", "N", " ", "different", " ", "types", " ", "of", " ", "candi", "es", ",", " ", "each", " ", "cand", "y", " ", "is", " ", "of", " ", "the", " ", "same", " ", "price", ".", " ", "Ji", "m", " ", "has", " ", "eno", "ugh", " ", "money", " ", "to", "\\", "10", ";", "buy", " ", "K", " ", "candi", "es", ".", " ", "In", " ", "how", " ", "many", " ", "different", " ", "way", "s", " ", "can", " ", "he", " ", "purchase", " ", "K", " ", "candi", "es", " ", "if", " ", "there", " ", "are", " ", "infini", "te", " ", "candi", "es", " ", "of", " ", "each", " ", "kind", "?", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MOD", "_", "=_", "10_", "**_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Dan", "yan", "g", "'_", "\\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_", "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_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "\"", "1", ".", "in", "\"_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "f", " ", "=", " ", "sys", ".", "stdin_", "\\u\\u\\uNL\\u\\u\\u_", "testcases", "_", "=_", "int_", "(_", "f_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "solution_", "=_", "Solution_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "xrange_", "(_", "testcases", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "construct", " ", "cipher_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "int_", "(_", "f_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K_", "=_", "int_", "(_", "f_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cipher_", "=_", "N_", ",_", "K_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "solve_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "(_", "solution_", "._", "solve_", "(_", "cipher_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "s_", ",_", "\\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_", "Solution_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Solution_", "(_", "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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\\\\", "bino", "m", " ", "nk", "=\\\\", "bino", "m", "{", "n", "-1", "}{", "k", "-1", "}+", "\\\\", "bino", "m", "{", "n", "-1", "}", "k", ",", " ", "\\\\", "text", "{", " ", "for", " ", "}", " ", "0", "<", "k", "<", "n", ",", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "C_", "=_", "[_", "[_", "1_", "for_", "\\u_", "in_", "xrange_", "(_", "2000_", ")_", "]_", "for_", "\\u_", "in_", "xrange_", "(_", "2000_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "xrange_", "(_", "1_", ",_", "2000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "xrange_", "(_", "1_", ",_", "n_", ")_", ":_", "#", " ", "0", "<", "k", "<", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "C_", "[_", "n_", "]_", "[_", "k_", "]_", "=_", "self_", "._", "C_", "[_", "n_", "-_", "1_", "]_", "[_", "k_", "-_", "1_", "]_", "+_", "self_", "._", "C_", "[_", "n_", "-_", "1_", "]_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Solution_", "(_", "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_", "solve_", "(_", "self_", ",_", "cipher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Abstract", ":", " ", "N", " ", "types", ",", " ", "K", " ", "hole", "s", ",", " ", "repeat", "able", "\\", "10", ";", " ", " ", " ", " ", "n", "Ck", " ", "whe", "n", " ", "items", " ", "are", " ", "duplicated", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "reference", ":", "\\", "10", ";", " ", " ", " ", " ", "dp", " ", "algo", "rit", "hm", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "dere", "kh", "h", "/", "Hack", "er", "Rank", "/", "blob", "/", "master", "/", "k", "-", "cand", "y", "-", "store", ".", "cpp", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cipher", ":", " ", "the", " ", "cipher", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "N_", ",_", "K_", "=_", "cipher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "C_", "[_", "N_", "+_", "K_", "-_", "1_", "]_", "[_", "K_", "]_", "%_", "MOD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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, 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 ]
Unnecessary pass
dssg/ushine-learning/dssg/classifier.py
[ { "content": "class TooSkewedLabelsException(Exception):\n\n pass", "metadata": "root.TooSkewedLabelsException", "header": "['module', '___EOS___']", "index": 17 }, { "content": "class DssgBinaryClassifier(object):\n\n \"\"\" This is meant to be an abstract class\n \"\"\"\n\n\n\n\n\n pass", "metadata": "root.DssgBinaryClassifier", "header": "['module', '___EOS___']", "index": 28 }, { "content": "class DssgBinaryClassifierMajorityVote(DssgBinaryClassifier):\n\n \"\"\"\n Majority vote classifier.\n \"\"\"\n\n\n\n\n\n\n pass", "metadata": "root.DssgBinaryClassifierMajorityVote", "header": "['module', '___EOS___']", "index": 54 }, { "content": " def train(self, binaryLabeledMessageList):\n nPos = countTruth(lambda x: x[1] == 'pos', binaryLabeledMessageList)\n nNeg = countTruth(lambda x: x[1] == 'neg', binaryLabeledMessageList)\n assert(nPos + nNeg == len(binaryLabeledMessageList))\n posNegPrbDic = {'pos': float(\n nPos) / (nPos + nNeg),\n 'neg': float(nNeg) / (nPos + nNeg)}\n\n self._posNegPrbDic = posNegPrbDic\n pass", "metadata": "root.DssgBinaryClassifierMajorityVote.train", "header": "['class', 'DssgBinaryClassifierMajorityVote', '(', 'DssgBinaryClassifier', ')', ':', '___EOS___']", "index": 63 }, { "content": "class DssgBinaryClassifierSVC(DssgBinaryClassifier):\n\n \"\"\"\n Linear SVM binary classifier (based on LibLinear).\n \"\"\"\n\n\n\n\n\n\n pass", "metadata": "root.DssgBinaryClassifierSVC", "header": "['module', '___EOS___']", "index": 98 }, { "content": " def train(self, messageList):\n #--- prepare variables\n vectorizer = self._vectorizer\n balance = self._balance\n C = self._C\n tol = self._tol\n\n #---\n msgList = map(lambda x: x[0], messageList)\n y = np.array(map(lambda x: 1 if x[1] == 'pos' else 0, messageList))\n X = vectorizer.fitTransform(msgList)\n\n class_weight = 'auto' if balance else None\n classifier = LinearSVC(\n C=C, loss='l2', penalty='l1', dual=False, tol=tol,\n random_state=0, class_weight=class_weight)\n\n classifier.fit(X, y)\n\n #- learn sigmoid\n yDeci = classifier.decision_function(X)\n yy = [1 if v == 1 else -1 for v in y]\n [A, B] = platt.SigmoidTrain(yDeci, yy)\n plattModel = [A, B]\n\n #- save to instance variable\n self._classifier = classifier\n self._plattModel = plattModel\n pass", "metadata": "root.DssgBinaryClassifierSVC.train", "header": "['class', 'DssgBinaryClassifierSVC', '(', 'DssgBinaryClassifier', ')', ':', '___EOS___']", "index": 113 }, { "content": "class DssgBinaryClassifierLogisticRegression(DssgBinaryClassifier):\n\n \"\"\"\n Linear logistic regression binary classifier (based on LibLinear).\n \"\"\"\n\n\n\n\n\n\n pass", "metadata": "root.DssgBinaryClassifierLogisticRegression", "header": "['module', '___EOS___']", "index": 169 }, { "content": " def train(self, messageList):\n #--- prepare variables\n vectorizer = self._vectorizer\n balance = self._balance\n C = self._C\n tol = self._tol\n\n msgList = map(lambda x: x[0], messageList)\n y = np.array(map(lambda x: 1 if x[1] == 'pos' else 0, messageList))\n X = vectorizer.fitTransform(msgList)\n\n class_weight = 'auto' if balance else None\n classifier = LogisticRegression(\n C=C,\n penalty=\"l2\",\n dual=False,\n tol=tol,\n random_state=0,\n class_weight=class_weight)\n\n classifier.fit(X, y)\n\n #- save to instance variable\n self._classifier = classifier\n pass", "metadata": "root.DssgBinaryClassifierLogisticRegression.train", "header": "['class', 'DssgBinaryClassifierLogisticRegression', '(', 'DssgBinaryClassifier', ')', ':', '___EOS___']", "index": 183 }, { "content": "class DssgBinaryClassifierAdaptiveInterpolation(DssgBinaryClassifier):\n\n \"\"\"\n predicts by \"(1-alpha)*f_{global} * alpha*f_{local}\"\n It takes a trained global classifier, and untrained (initialized) local classifier,\n and then train local classifier and alpha.\n \"\"\"\n\n\n\n\n\n\n pass", "metadata": "root.DssgBinaryClassifierAdaptiveInterpolation", "header": "['module', '___EOS___']", "index": 234 }, { "content": " def train(self, messageList):\n globalClassifier = self._globalClassifier\n localClassifier = self._localClassifier\n trainLog = \"\"\n nFolds = 5\n\n msgList = map(lambda x: x[0], messageList)\n y = np.array(map(lambda x: 1 if x[1] == 'pos' else 0, messageList))\n\n #--- obtain global decision function list\n globalDFList = []\n for msg in msgList:\n v = globalClassifier.predictScore(msg)\n globalDFList.append(v['pos'])\n\n tt = tic()\n #--- obtain local decision function list (by cross-prediction)\n if (sum(y) < 2):\n #--- if there are less than 2 positive data points, set alpha=0\n trainLog += \"There are less than 2 positive data points. setting maxAlpha=0\\n\"\n maxAlpha = 0\n else:\n #--- split into 5 and cross-predict decision function\n localDFList = [float('nan')] * len(messageList)\n folds = StratifiedKFold(y, nFolds)\n for trainIdx, testIdx in folds:\n train = [messageList[i] for i in trainIdx]\n test = [messageList[i] for i in testIdx]\n\n tmpClassifier = copy.deepcopy(localClassifier)\n tmpClassifier.train(train)\n\n curDFList = []\n for x in test:\n v = tmpClassifier.predictScore(x[0])\n curDFList.append(v['pos'])\n\n for i in range(len(test)):\n localDFList[testIdx[i]] = curDFList[i]\n assert(countTruth(lambda x: np.isnan(x), localDFList) == 0)\n\n #--- try many alpha's, and measure F1\n f1List = []\n alphaList = np.linspace(0.0, 1.0, 101)\n for alpha in alphaList:\n combinedDFList = [(1 - alpha) * globalDFList[i] + alpha * localDFList[i]\n for i in range(len(globalDFList))]\n predy = [1 if v >= 0.0 else 0 for v in combinedDFList]\n #- measure F1\n f1 = metrics.f1_score(y, predy)\n f1List.append(f1)\n\n #--- pick alpha that maximizes F1\n trainLog += \"Finding alpha maximizing F1...\\n\"\n maxF1 = np.max(f1List)\n maxIdx = np.where(np.array(f1List) == maxF1)\n maxIdx = maxIdx[0]\n assert(len(maxIdx) != 0)\n candidateMaxAlpha = [alphaList[i] for i in maxIdx]\n maxAlpha = np.median(candidateMaxAlpha)\n\n trainLog += \"max(f1List) = %.3f\\n\" % maxF1\n trainLog += \"argmax_alpha = \\n%s\\n\" % str(\n np.array([alphaList[i] for i in maxIdx]))\n trainLog += \"chosen alpha by median = %.3f\\n\" % maxAlpha\n\n #--- train local classifier using all data\n localClassifier.train(binaryLabeledMessageList)\n\n elapsed = toc(tt)\n trainLog += \"Time taken for training: %.3f (sec)\\n\" % elapsed\n\n self._localClassifier = localClassifier\n self._alpha = maxAlpha\n self._trainLog = trainLog\n\n #--- learn sigmoid\n yDeci = [self.predictScore(msg)['pos'] for msg in messageList]\n yy = [1 if v == 1 else -1 for v in y]\n [A, B] = platt.SigmoidTrain(yDeci, yy)\n plattModel = [A, B]\n\n self._plattModel = plattModel\n pass", "metadata": "root.DssgBinaryClassifierAdaptiveInterpolation.train", "header": "['class', 'DssgBinaryClassifierAdaptiveInterpolation', '(', 'DssgBinaryClassifier', ')', ':', '___EOS___']", "index": 256 }, { "content": "class DssgBinaryClassifierAdaptiveSVC(DssgBinaryClassifier):\n\n \"\"\"\n predicts by a training SVM on feature vector like [f_{global}, f_{local}]\n \"\"\"\n\n\n\n\n\n\n pass", "metadata": "root.DssgBinaryClassifierAdaptiveSVC", "header": "['module', '___EOS___']", "index": 379 }, { "content": " def train(self, binaryLabeledMessageList):\n globalClassifier = self._globalClassifier\n localClassifier = self._localClassifier\n\n trainLog = \"\"\n nFolds = 5\n\n msgList = map(lambda x: x[0], binaryLabeledMessageList)\n y = np.array(\n map(lambda x: 1 if x[1] == 'pos' else 0,\n binaryLabeledMessageList))\n\n #--- obtain global decision function list\n globalDFList = []\n for msg in msgList:\n v = globalClassifier.predictScore(msg)\n globalDFList.append(v['pos'])\n\n tt = tic()\n #--- obtain local decision function list (by cross-prediction)\n metaClassifier = None\n if (sum(y) < 2):\n #--- if there are less than 2 positive data points, set alpha=0\n trainLog += \"There are less than 2 positive data points. using globalClassifier as the classifier\\n\"\n localClassifier = None\n else:\n #--- split into 5 and cross-predict decision function\n localDFList = [float('nan')] * len(binaryLabeledMessageList)\n folds = StratifiedKFold(y, nFolds)\n for trainIdx, testIdx in folds:\n train = [binaryLabeledMessageList[i] for i in trainIdx]\n test = [binaryLabeledMessageList[i] for i in testIdx]\n\n tmpClassifier = copy.deepcopy(localClassifier)\n tmpClassifier.train(train)\n\n curDFList = []\n for x in test:\n v = tmpClassifier.predictScore(x[0])\n curDFList.append(v['pos'])\n\n for i in range(len(test)):\n localDFList[testIdx[i]] = curDFList[i]\n assert(countTruth(lambda x: np.isnan(x), localDFList) == 0)\n\n #--- train SVC!!\n #- prepare X\n X = np.hstack(\n [np.matrix(globalDFList).T,\n np.matrix(localDFList).T])\n metaClassifier = LinearSVC(\n loss='l2', penalty='l1', dual=False, tol=1e-6,\n random_state=0)\n metaClassifier.fit(X, y)\n trainLog += \"Trained a meta classifier:\\n\"\n coef = metaClassifier.coef_[0]\n trainLog += \" coef for (global, local): (%.6f, %.6f)\\n\" % (\n coef[0], coef[1])\n trainLog += \" intercept: %.6f\\n\" % (metaClassifier.intercept_)\n\n #--- train local classifier using all data\n localClassifier.train(binaryLabeledMessageList)\n trainLog += \"Trained a meta classifier\"\n\n elapsed = toc(tt)\n trainLog += \"Time taken for training: %.3f (sec)\\n\" % elapsed\n\n self._metaClassifier = metaClassifier\n self._trainLog = trainLog\n\n #--- learn sigmoid\n yDeci = [self.predictScore(msg)['pos']\n for msg in binaryLabeledMessageList]\n yy = [1 if v == 1 else -1 for v in y]\n [A, B] = platt.SigmoidTrain(yDeci, yy)\n plattModel = [A, B]\n\n self._plattModel = plattModel\n pass", "metadata": "root.DssgBinaryClassifierAdaptiveSVC.train", "header": "['class', 'DssgBinaryClassifierAdaptiveSVC', '(', 'DssgBinaryClassifier', ')', ':', '___EOS___']", "index": 399 }, { "content": "class DssgCategoryClassifier(object):\n\n \"\"\"\n A generic category classifier, which is simply an aggregate of binary\n classifiers.\n \"\"\"\n _classifierDic = {}\n _categoryList = []\n _trainStats = {}\n\n\n\n\n\n\n\n pass # end of class", "metadata": "root.DssgCategoryClassifier", "header": "['module', '___EOS___']", "index": 523 }, { "content": " def __init__(self,\n untrainedBinaryClassifier,\n untrainedBinaryClassifierDic={},\n doCV=True,\n verbose=True,\n ):\n if (len(untrainedBinaryClassifierDic) != 0):\n assert untrainedBinaryClassifier is None\n self._binaryClassifier = untrainedBinaryClassifier\n self._binaryClassifierDic = untrainedBinaryClassifierDic\n self._doCV = doCV\n self._verbose = verbose\n\n self._classifierDic = {}\n self._categoryList = []\n self._trainStats = {}\n pass", "metadata": "root.DssgCategoryClassifier.__init__", "header": "['class', 'DssgCategoryClassifier', '(', 'object', ')', ':', '___EOS___']", "index": 536 }, { "content": " def train(self, messageList):\n \"\"\"\n messageList is a list of message in dictionary. Major keys are 'title', 'description', and 'categories', and so on.\n \"\"\"\n binaryClassifierDic = self._binaryClassifierDic\n doCV = self._doCV\n verbose = self._verbose\n\n #--- set up logger.\n logger = logging.getLogger(__name__)\n ch = logging.StreamHandler()\n logger.setLevel(logging.INFO if verbose else logging.WARNING)\n logger.info(\n ' len(binaryClassifierDic) = %d',\n len(binaryClassifierDic))\n\n #--- Empty variables\n classifierDic = {}\n\n #--- extract category list in dataset\n categorySet = set()\n for msg in messageList:\n categorySet.update(msg['categories'])\n #- there might be extra categories in binaryClassifierDic\n categorySet.update(binaryClassifierDic.keys())\n categoryList = sorted(list(categorySet))\n\n #--- for each category, train a binary classifier\n trainStats = {}\n totNTP = 0\n totNFP = 0\n totNTN = 0\n totNFN = 0\n for cat in categoryList:\n logger.info('Category: %s', cat)\n if (len(binaryClassifierDic) != 0):\n binaryClassifier = binaryClassifierDic[cat]\n else:\n binaryClassifier = copy.deepcopy(self._binaryClassifier)\n\n #- turn into a binary labeled data\n dset = []\n for msg in messageList:\n binaryLabel = 'pos' if cat in msg['categories'] else 'neg'\n dset.append((msg, binaryLabel))\n\n #- save stat\n nPos = countTruth(lambda x: x[1] == 'pos', dset)\n nNeg = countTruth(lambda x: x[1] == 'neg', dset)\n assert(len(dset) == nPos + nNeg)\n\n v = float(nPos) / (nPos + nNeg)\n mvAcc = max([v, 1 - v])\n logger.info(\n ' nPos,nNeg = (%d / %d), majority vote acc = %.3f',\n nPos,\n nNeg,\n mvAcc)\n\n statDic = {'nPos': nPos, 'nNeg': nNeg, 'majority vote acc': mvAcc}\n\n #--- run cross validation to estimate performance\n cvResDic = {}\n bContinue = False\n didCV = False\n if (doCV):\n try:\n cvResDic = dssgRunCV(self._binaryClassifier, dset)\n strList = (\n 'nFolds',\n 'mean of accuracy',\n '95% confidence interval',\n 'precision',\n 'recall',\n 'f1')\n msg = '%2d-CV: %s = %.3f, %s = [%.3f, %.3f]\\n' % \\\n (cvResDic[strList[0]], strList[1], cvResDic[strList[1]], strList[\n 2], cvResDic[strList[2]][0], cvResDic[strList[2]][1])\n for i in [1, 3, 4, 5]:\n msg += ' %s = %.3f' % (\n strList[i],\n cvResDic[strList[i]])\n if (i != 5):\n msg += '\\n'\n didCV = True\n except TooSkewedLabelsException:\n msg = 'CV accuracy estimate is not available due to skewed labels. Skipping'\n\n logger.info(' ' + msg)\n\n statDic['CV stat'] = cvResDic\n trainStats[cat] = statDic\n\n #--- build a classifier using all data.\n if (isinstance(binaryClassifier, DssgBinaryClassifierAdaptiveInterpolation) or\n isinstance(binaryClassifier, DssgBinaryClassifierAdaptiveSVC)):\n binaryClassifier.train(dset)\n else:\n if (nPos == 0 or nNeg == 0):\n #- when only one label presents, create a majority vote classifier\n mvClassifier = DssgBinaryClassifierMajorityVote()\n mvClassifier.train(dset)\n binaryClassifier = mvClassifier\n else:\n binaryClassifier.train(dset)\n\n #- report vocabulary\n if (isinstance(binaryClassifier, DssgBinaryClassifierAdaptiveInterpolation) or isinstance(binaryClassifier, DssgBinaryClassifierAdaptiveSVC) or isinstance(binaryClassifier, DssgBinaryClassifierMajorityVote)):\n logger.info(\n ' Can\\'t get nVoca since the classifier is: %s',\n repr(binaryClassifier))\n else:\n nVoca = len(binaryClassifier._vectorizer.getFeatureNameList())\n logger.info(' nVoca = %d', nVoca)\n if (isinstance(binaryClassifier._vectorizer, DssgMultiVectorizer)):\n logger.info(\n ' Vectorizer: %s',\n repr(binaryClassifier._vectorizer))\n\n #- add classifier to classifier dictionary.\n classifierDic[cat] = binaryClassifier\n\n logger.info(' type = %s', str(type(binaryClassifier)))\n if (didCV):\n totNTP += statDic['CV stat']['nTP']\n totNFP += statDic['CV stat']['nFP']\n totNTN += statDic['CV stat']['nTN']\n totNFN += statDic['CV stat']['nFN']\n\n if (doCV):\n didCVCategoryList = []\n for cat, v in trainStats.iteritems():\n if (len(v['CV stat']) != 0):\n didCVCategoryList.append(cat)\n logger.info('DID CV for categories: %s', str(didCVCategoryList))\n\n meanF1 = np.mean(\n np.array(map(lambda cat: trainStats[cat]['CV stat']['f1'], didCVCategoryList)))\n logger.info('Overall mean F1 = %.3f', meanF1)\n\n totPrecision = float(totNTP) / (totNTP + totNFP)\n totRecall = float(totNTP) / (totNTP + totNFN)\n logger.info(\n 'Overall aggregate prec = %.3f, recall = %.3f, F1 = %.3f',\n totPrecision, totRecall, sp.stats.hmean([totPrecision, totRecall]))\n\n self._classifierDic = classifierDic\n self._categoryList = categoryList\n self._trainStats = trainStats\n pass", "metadata": "root.DssgCategoryClassifier.train", "header": "['class', 'DssgCategoryClassifier', '(', 'object', ')', ':', '___EOS___']", "index": 560 } ]
[ { "span": "pass", "start_line": 21, "start_column": 4, "end_line": 21, "end_column": 8 }, { "span": "pass", "start_line": 51, "start_column": 4, "end_line": 51, "end_column": 8 }, { "span": "pass", "start_line": 95, "start_column": 4, "end_line": 95, "end_column": 8 }, { "span": "pass", "start_line": 72, "start_column": 8, "end_line": 72, "end_column": 12 }, { "span": "pass", "start_line": 166, "start_column": 4, "end_line": 166, "end_column": 8 }, { "span": "pass", "start_line": 141, "start_column": 8, "end_line": 141, "end_column": 12 }, { "span": "pass", "start_line": 231, "start_column": 4, "end_line": 231, "end_column": 8 }, { "span": "pass", "start_line": 207, "start_column": 8, "end_line": 207, "end_column": 12 }, { "span": "pass", "start_line": 376, "start_column": 4, "end_line": 376, "end_column": 8 }, { "span": "pass", "start_line": 339, "start_column": 8, "end_line": 339, "end_column": 12 }, { "span": "pass", "start_line": 516, "start_column": 4, "end_line": 516, "end_column": 8 }, { "span": "pass", "start_line": 477, "start_column": 8, "end_line": 477, "end_column": 12 }, { "span": "pass ", "start_line": 735, "start_column": 4, "end_line": 735, "end_column": 8 }, { "span": "pass", "start_line": 552, "start_column": 8, "end_line": 552, "end_column": 12 }, { "span": "pass", "start_line": 709, "start_column": 8, "end_line": 709, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Too", "Ske", "wed", "Label", "s", "Exception_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "class_", "Ds", "sg", "Bin", "ary", "Classifier_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Thi", "s", " ", "is", " ", "mean", "t", " ", "to", " ", "be", " ", "an", " ", "abstract", " ", "class", "\\", "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\\uDEDENT\\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_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Maj", "ori", "ty", "Vote", "_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Maj", "ori", "ty", " ", "vote", " ", "classif", "ier", ".", "\\", "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\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Maj", "ori", "ty", "Vote", "_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train_", "(_", "self_", ",_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n", "Pos_", "=_", "count", "Tru", "th_", "(_", "lambda_", "x_", ":_", "x_", "[_", "1_", "]_", "==_", "'", "pos", "'_", ",_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "Ne", "g_", "=_", "count", "Tru", "th_", "(_", "lambda_", "x_", ":_", "x_", "[_", "1_", "]_", "==_", "'", "neg", "'_", ",_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "n", "Pos_", "+_", "n", "Ne", "g_", "==_", "len_", "(_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos", "Ne", "g", "Pr", "b", "Dic_", "=_", "{_", "'", "pos", "'_", ":_", "float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "n", "Pos_", ")_", "/_", "(_", "n", "Pos_", "+_", "n", "Ne", "g_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "neg", "'_", ":_", "float_", "(_", "n", "Ne", "g_", ")_", "/_", "(_", "n", "Pos_", "+_", "n", "Ne", "g_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "pos", "Ne", "g", "Pr", "b", "Dic_", "=_", "pos", "Ne", "g", "Pr", "b", "Dic_", "\\u\\u\\uNEWLINE\\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_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "SVC_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Linea", "r", " ", "SV", "M", " ", "binar", "y", " ", "classif", "ier", " ", "(", "based", " ", "on", " ", "Lib", "Linea", "r", ").", "\\", "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\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "SVC_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train_", "(_", "self_", ",_", "message", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "--", " ", "prepar", "e", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vectorizer", "_", "=_", "self_", "._", "\\u", "vectorizer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "balance_", "=_", "self_", "._", "\\u", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "=_", "self_", "._", "\\u", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tol_", "=_", "self_", "._", "\\u", "tol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "List_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ",_", "message", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "np_", "._", "array_", "(_", "map_", "(_", "lambda_", "x_", ":_", "1_", "if_", "x_", "[_", "1_", "]_", "==_", "'", "pos", "'_", "else_", "0_", ",_", "message", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "vectorizer", "_", "._", "fit", "Transform_", "(_", "msg", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class", "\\u", "weight_", "=_", "'", "auto", "'_", "if_", "balance_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classifier_", "=_", "Linea", "r", "SVC_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "C_", "=_", "C_", ",_", "loss_", "=_", "'", "l2", "'_", ",_", "penalty_", "=_", "'", "l1", "'_", ",_", "dual", "_", "=_", "False_", ",_", "tol_", "=_", "tol_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random", "\\u", "state_", "=_", "0_", ",_", "class", "\\u", "weight_", "=_", "class", "\\u", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classifier_", "._", "fit_", "(_", "X_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", " ", "learn", " ", "sigmoid_", "\\u\\u\\uNL\\u\\u\\u_", "y", "Deci", "_", "=_", "classifier_", "._", "decision", "\\u", "function_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yy_", "=_", "[_", "1_", "if_", "v_", "==_", "1_", "else_", "-_", "1_", "for_", "v_", "in_", "y_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "A_", ",_", "B_", "]_", "=_", "plat", "t_", "._", "Sigm", "oid", "Train_", "(_", "y", "Deci", "_", ",_", "yy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plat", "t", "Model_", "=_", "[_", "A_", ",_", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", " ", "save", " ", "to", " ", "instance", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "classifier_", "=_", "classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "plat", "t", "Model_", "=_", "plat", "t", "Model_", "\\u\\u\\uNEWLINE\\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_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Logi", "stic", "Regression_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Linea", "r", " ", "logistic", " ", "regress", "ion", " ", "binar", "y", " ", "classif", "ier", " ", "(", "based", " ", "on", " ", "Lib", "Linea", "r", ").", "\\", "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\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Logi", "stic", "Regression_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train_", "(_", "self_", ",_", "message", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "--", " ", "prepar", "e", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vectorizer", "_", "=_", "self_", "._", "\\u", "vectorizer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "balance_", "=_", "self_", "._", "\\u", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "=_", "self_", "._", "\\u", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tol_", "=_", "self_", "._", "\\u", "tol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "List_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ",_", "message", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "np_", "._", "array_", "(_", "map_", "(_", "lambda_", "x_", ":_", "1_", "if_", "x_", "[_", "1_", "]_", "==_", "'", "pos", "'_", "else_", "0_", ",_", "message", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "vectorizer", "_", "._", "fit", "Transform_", "(_", "msg", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class", "\\u", "weight_", "=_", "'", "auto", "'_", "if_", "balance_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classifier_", "=_", "Logi", "stic", "Regression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "C_", "=_", "C_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "penalty_", "=_", "\"", "l2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dual", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "tol_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random", "\\u", "state_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "class", "\\u", "weight_", "=_", "class", "\\u", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classifier_", "._", "fit_", "(_", "X_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", " ", "save", " ", "to", " ", "instance", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "classifier_", "=_", "classifier_", "\\u\\u\\uNEWLINE\\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_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Adapti", "ve", "Interpolation", "_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "predi", "ct", "s", " ", "by", " ", "\"(", "1", "-", "alpha", ")*", "f", "\\u{", "global", "}", " ", "*", " ", "alpha", "*", "f", "\\u{", "local", "}\"", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "take", "s", " ", "a", " ", "trained", " ", "global", " ", "classif", "ier", ",", " ", "and", " ", "untr", "aine", "d", " ", "(", "initialize", "d", ")", " ", "local", " ", "classif", "ier", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "then", " ", "train", " ", "local", " ", "classif", "ier", " ", "and", " ", "alpha", ".", "\\", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Adapti", "ve", "Interpolation", "_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train_", "(_", "self_", ",_", "message", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global", "Classifier_", "=_", "self_", "._", "\\u", "global", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Classifier_", "=_", "self_", "._", "\\u", "local", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Log_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "Fold", "s_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "List_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ",_", "message", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "np_", "._", "array_", "(_", "map_", "(_", "lambda_", "x_", ":_", "1_", "if_", "x_", "[_", "1_", "]_", "==_", "'", "pos", "'_", "else_", "0_", ",_", "message", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "obtain", " ", "global", " ", "decision", " ", "function", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "global", "DF", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "msg_", "in_", "msg", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "global", "Classifier_", "._", "predi", "ct", "Score_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "DF", "List_", "._", "append_", "(_", "v_", "[_", "'", "pos", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tt_", "=_", "tic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "--", " ", "obtain", " ", "local", " ", "decision", " ", "function", " ", "list", " ", "(", "by", " ", "cross", "-", "predicti", "on", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "sum_", "(_", "y_", ")_", "<_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "--", " ", "if", " ", "there", " ", "are", " ", "less", " ", "than", " ", "2", " ", "posit", "ive", " ", "data", " ", "points", ",", " ", "set", " ", "alpha", "=", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train", "Log_", "+=_", "\"", "There", " ", "are", " ", "less", " ", "than", " ", "2", " ", "posit", "ive", " ", "data", " ", "points", ".", " ", "setti", "ng", " ", "max", "Al", "pha", "=", "0", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Alpha_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "--", " ", "split", " ", "int", "o", " ", "5", " ", "and", " ", "cross", "-", "predi", "ct", " ", "decision", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "DF", "List_", "=_", "[_", "float_", "(_", "'", "nan", "'_", ")_", "]_", "*_", "len_", "(_", "message", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folds_", "=_", "Strat", "ified", "KF", "old_", "(_", "y_", ",_", "n", "Fold", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "train", "Idx_", ",_", "test", "Idx_", "in_", "folds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train_", "=_", "[_", "message", "List_", "[_", "i_", "]_", "for_", "i_", "in_", "train", "Idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "=_", "[_", "message", "List_", "[_", "i_", "]_", "for_", "i_", "in_", "test", "Idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "Classifier_", "=_", "copy_", "._", "deepcopy_", "(_", "local", "Classifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "Classifier_", "._", "train_", "(_", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cur", "DF", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "test_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "tmp", "Classifier_", "._", "predi", "ct", "Score_", "(_", "x_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "DF", "List_", "._", "append_", "(_", "v_", "[_", "'", "pos", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "test_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "local", "DF", "List_", "[_", "test", "Idx_", "[_", "i_", "]_", "]_", "=_", "cur", "DF", "List_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "count", "Tru", "th_", "(_", "lambda_", "x_", ":_", "np_", "._", "isnan_", "(_", "x_", ")_", ",_", "local", "DF", "List_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "try", " ", "many", " ", "alpha", "'", "s", ",", " ", "and", " ", "measure", " ", "F1_", "\\u\\u\\uNL\\u\\u\\u_", "f1", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha", "List_", "=_", "np_", "._", "linspace_", "(_", "0.0_", ",_", "1.0_", ",_", "101_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "alpha_", "in_", "alpha", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "combin", "ed", "DF", "List_", "=_", "[_", "(_", "1_", "-_", "alpha_", ")_", "*_", "global", "DF", "List_", "[_", "i_", "]_", "+_", "alpha_", "*_", "local", "DF", "List_", "[_", "i_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "global", "DF", "List_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pred", "y_", "=_", "[_", "1_", "if_", "v_", ">=_", "0.0_", "else_", "0_", "for_", "v_", "in_", "combin", "ed", "DF", "List_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", " ", "measure", " ", "F1_", "\\u\\u\\uNL\\u\\u\\u_", "f1_", "=_", "metrics_", "._", "f1", "\\u", "score_", "(_", "y_", ",_", "pred", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1", "List_", "._", "append_", "(_", "f1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "pick", " ", "alpha", " ", "tha", "t", " ", "maximize", "s", " ", "F1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "train", "Log_", "+=_", "\"", "Finding", " ", "alpha", " ", "maxim", "izi", "ng", " ", "F1", "...", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "F1_", "=_", "np_", "._", "max_", "(_", "f1", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Idx_", "=_", "np_", "._", "where_", "(_", "np_", "._", "array_", "(_", "f1", "List_", ")_", "==_", "max", "F1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Idx_", "=_", "max", "Idx_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "max", "Idx_", ")_", "!=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "candidate", "Max", "Alpha_", "=_", "[_", "alpha", "List_", "[_", "i_", "]_", "for_", "i_", "in_", "max", "Idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Alpha_", "=_", "np_", "._", "median_", "(_", "candidate", "Max", "Alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "Log_", "+=_", "\"", "max", "(", "f1", "List", ")", " ", "=", " ", "%", ".3", "f", "\\\\", "n", "\"_", "%_", "max", "F1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Log_", "+=_", "\"", "argm", "ax", "\\u", "alpha", " ", "=", " ", "\\\\", "n", "%", "s", "\\\\", "n", "\"_", "%_", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "array_", "(_", "[_", "alpha", "List_", "[_", "i_", "]_", "for_", "i_", "in_", "max", "Idx_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Log_", "+=_", "\"", "chosen", " ", "alpha", " ", "by", " ", "median", " ", "=", " ", "%", ".3", "f", "\\\\", "n", "\"_", "%_", "max", "Alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "train", " ", "local", " ", "classif", "ier", " ", "usi", "ng", " ", "all", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "local", "Classifier_", "._", "train_", "(_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elapsed_", "=_", "toc_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Log_", "+=_", "\"", "Time", " ", "take", "n", " ", "for", " ", "train", "ing", ":", " ", "%", ".3", "f", " ", "(", "sec", ")\\\\", "n", "\"_", "%_", "elapsed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "local", "Classifier_", "=_", "local", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "alpha_", "=_", "max", "Alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "train", "Log_", "=_", "train", "Log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "learn", " ", "sigmoid_", "\\u\\u\\uNL\\u\\u\\u_", "y", "Deci", "_", "=_", "[_", "self_", "._", "predi", "ct", "Score_", "(_", "msg_", ")_", "[_", "'", "pos", "'_", "]_", "for_", "msg_", "in_", "message", "List_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yy_", "=_", "[_", "1_", "if_", "v_", "==_", "1_", "else_", "-_", "1_", "for_", "v_", "in_", "y_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "A_", ",_", "B_", "]_", "=_", "plat", "t_", "._", "Sigm", "oid", "Train_", "(_", "y", "Deci", "_", ",_", "yy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plat", "t", "Model_", "=_", "[_", "A_", ",_", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "plat", "t", "Model_", "=_", "plat", "t", "Model_", "\\u\\u\\uNEWLINE\\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_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Adapti", "ve", "SVC_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "predi", "ct", "s", " ", "by", " ", "a", " ", "train", "ing", " ", "SV", "M", " ", "on", " ", "feature", " ", "vector", " ", "like", " ", "[", "f", "\\u{", "global", "},", " ", "f", "\\u{", "local", "}]", "\\", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Adapti", "ve", "SVC_", "(_", "Ds", "sg", "Bin", "ary", "Classifier_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train_", "(_", "self_", ",_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global", "Classifier_", "=_", "self_", "._", "\\u", "global", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Classifier_", "=_", "self_", "._", "\\u", "local", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "Log_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "Fold", "s_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "List_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ",_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "np_", "._", "array_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "map_", "(_", "lambda_", "x_", ":_", "1_", "if_", "x_", "[_", "1_", "]_", "==_", "'", "pos", "'_", "else_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "obtain", " ", "global", " ", "decision", " ", "function", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "global", "DF", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "msg_", "in_", "msg", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "global", "Classifier_", "._", "predi", "ct", "Score_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "DF", "List_", "._", "append_", "(_", "v_", "[_", "'", "pos", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tt_", "=_", "tic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "--", " ", "obtain", " ", "local", " ", "decision", " ", "function", " ", "list", " ", "(", "by", " ", "cross", "-", "predicti", "on", ")_", "\\u\\u\\uNL\\u\\u\\u_", "meta", "Classifier_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "sum_", "(_", "y_", ")_", "<_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "--", " ", "if", " ", "there", " ", "are", " ", "less", " ", "than", " ", "2", " ", "posit", "ive", " ", "data", " ", "points", ",", " ", "set", " ", "alpha", "=", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train", "Log_", "+=_", "\"", "There", " ", "are", " ", "less", " ", "than", " ", "2", " ", "posit", "ive", " ", "data", " ", "points", ".", " ", "usi", "ng", " ", "global", "Classif", "ier", " ", "as", " ", "the", " ", "classif", "ier", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Classifier_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "--", " ", "split", " ", "int", "o", " ", "5", " ", "and", " ", "cross", "-", "predi", "ct", " ", "decision", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "DF", "List_", "=_", "[_", "float_", "(_", "'", "nan", "'_", ")_", "]_", "*_", "len_", "(_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folds_", "=_", "Strat", "ified", "KF", "old_", "(_", "y_", ",_", "n", "Fold", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "train", "Idx_", ",_", "test", "Idx_", "in_", "folds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train_", "=_", "[_", "binar", "y", "Label", "ed", "Messag", "e", "List_", "[_", "i_", "]_", "for_", "i_", "in_", "train", "Idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "=_", "[_", "binar", "y", "Label", "ed", "Messag", "e", "List_", "[_", "i_", "]_", "for_", "i_", "in_", "test", "Idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "Classifier_", "=_", "copy_", "._", "deepcopy_", "(_", "local", "Classifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "Classifier_", "._", "train_", "(_", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cur", "DF", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "test_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "tmp", "Classifier_", "._", "predi", "ct", "Score_", "(_", "x_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "DF", "List_", "._", "append_", "(_", "v_", "[_", "'", "pos", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "test_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "local", "DF", "List_", "[_", "test", "Idx_", "[_", "i_", "]_", "]_", "=_", "cur", "DF", "List_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "count", "Tru", "th_", "(_", "lambda_", "x_", ":_", "np_", "._", "isnan_", "(_", "x_", ")_", ",_", "local", "DF", "List_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "train", " ", "SVC", "!!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", " ", "prepar", "e", " ", "X_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "np_", "._", "hstack_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "np_", "._", "matrix_", "(_", "global", "DF", "List_", ")_", "._", "T_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "matrix_", "(_", "local", "DF", "List_", ")_", "._", "T_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "Classifier_", "=_", "Linea", "r", "SVC_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "loss_", "=_", "'", "l2", "'_", ",_", "penalty_", "=_", "'", "l1", "'_", ",_", "dual", "_", "=_", "False_", ",_", "tol_", "=_", "1e-6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random", "\\u", "state_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "Classifier_", "._", "fit_", "(_", "X_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Log_", "+=_", "\"", "Train", "ed", " ", "a", " ", "meta", " ", "classif", "ier", ":\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coef_", "=_", "meta", "Classifier_", "._", "coef\\u", "_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Log_", "+=_", "\"", " ", " ", "coef", " ", "for", " ", "(", "global", ",", " ", "local", "):", " ", "(%", ".6", "f", ",", " ", "%", ".6", "f", ")\\\\", "n", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "coef_", "[_", "0_", "]_", ",_", "coef_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Log_", "+=_", "\"", " ", " ", "intercept", ":", " ", "%", ".6", "f", "\\\\", "n", "\"_", "%_", "(_", "meta", "Classifier_", "._", "intercept", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "train", " ", "local", " ", "classif", "ier", " ", "usi", "ng", " ", "all", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "local", "Classifier_", "._", "train_", "(_", "binar", "y", "Label", "ed", "Messag", "e", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Log_", "+=_", "\"", "Train", "ed", " ", "a", " ", "meta", " ", "classif", "ier", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elapsed_", "=_", "toc_", "(_", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Log_", "+=_", "\"", "Time", " ", "take", "n", " ", "for", " ", "train", "ing", ":", " ", "%", ".3", "f", " ", "(", "sec", ")\\\\", "n", "\"_", "%_", "elapsed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "meta", "Classifier_", "=_", "meta", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "train", "Log_", "=_", "train", "Log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "learn", " ", "sigmoid_", "\\u\\u\\uNL\\u\\u\\u_", "y", "Deci", "_", "=_", "[_", "self_", "._", "predi", "ct", "Score_", "(_", "msg_", ")_", "[_", "'", "pos", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "msg_", "in_", "binar", "y", "Label", "ed", "Messag", "e", "List_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yy_", "=_", "[_", "1_", "if_", "v_", "==_", "1_", "else_", "-_", "1_", "for_", "v_", "in_", "y_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "A_", ",_", "B_", "]_", "=_", "plat", "t_", "._", "Sigm", "oid", "Train_", "(_", "y", "Deci", "_", ",_", "yy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plat", "t", "Model_", "=_", "[_", "A_", ",_", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "plat", "t", "Model_", "=_", "plat", "t", "Model_", "\\u\\u\\uNEWLINE\\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_", "class_", "Ds", "sg", "Cate", "gory", "Classifier_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "gener", "ic", " ", "category", " ", "classif", "ier", ",", " ", "whi", "ch", " ", "is", " ", "simp", "ly", " ", "an", " ", "aggre", "gate", " ", "of", " ", "binar", "y", "\\", "10", ";", " ", " ", " ", " ", "classif", "iers", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "classif", "ier", "Dic_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "category", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "train", "Stats_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "pass_", "#", " ", "end", " ", "of", " ", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ds", "sg", "Cate", "gory", "Classifier_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "untr", "aine", "d", "Bin", "ary", "Classifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "untr", "aine", "d", "Bin", "ary", "Classif", "ier", "Dic_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "CV_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "len_", "(_", "untr", "aine", "d", "Bin", "ary", "Classif", "ier", "Dic_", ")_", "!=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "untr", "aine", "d", "Bin", "ary", "Classifier_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "binar", "y", "Classifier_", "=_", "untr", "aine", "d", "Bin", "ary", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "binar", "y", "Classif", "ier", "Dic_", "=_", "untr", "aine", "d", "Bin", "ary", "Classif", "ier", "Dic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "CV_", "=_", "do", "CV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "verbose_", "=_", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "classif", "ier", "Dic_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "category", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "train", "Stats_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ds", "sg", "Cate", "gory", "Classifier_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train_", "(_", "self_", ",_", "message", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "message", "List", " ", "is", " ", "a", " ", "list", " ", "of", " ", "message", " ", "in", " ", "dictionar", "y", ".", " ", "Maj", "or", " ", "keys", " ", "are", " ", "'", "title", "',", " ", "'", "description", "',", " ", "and", " ", "'", "categor", "ies", "',", " ", "and", " ", "so", " ", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "Classif", "ier", "Dic_", "=_", "self_", "._", "\\u", "binar", "y", "Classif", "ier", "Dic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "CV_", "=_", "self_", "._", "\\u", "do", "CV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbose_", "=_", "self_", "._", "\\u", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "set", " ", "up", " ", "logg", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ch_", "=_", "logging_", "._", "Stream", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", "if_", "verbose_", "else_", "logging_", "._", "WARNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "len", "(", "binar", "y", "Classif", "ier", "Dic", ")", " ", "=", " ", "%", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "binar", "y", "Classif", "ier", "Dic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "Emp", "ty", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "classif", "ier", "Dic_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "extract", " ", "category", " ", "list", " ", "in", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "category", "Set_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "msg_", "in_", "message", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "category", "Set_", "._", "update_", "(_", "msg_", "[_", "'", "categor", "ies", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", " ", "there", " ", "mig", "ht", " ", "be", " ", "extra", " ", "categor", "ies", " ", "in", " ", "binar", "y", "Classif", "ier", "Dic_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "category", "Set_", "._", "update_", "(_", "binar", "y", "Classif", "ier", "Dic_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category", "List_", "=_", "sorted_", "(_", "list_", "(_", "category", "Set_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "for", " ", "each", " ", "category", ",", " ", "train", " ", "a", " ", "binar", "y", " ", "classifier_", "\\u\\u\\uNL\\u\\u\\u_", "train", "Stats_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "NTP", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "NF", "P_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "NT", "N_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "NF", "N_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cat_", "in_", "category", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Cate", "gory", ":", " ", "%", "s", "'_", ",_", "cat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "binar", "y", "Classif", "ier", "Dic_", ")_", "!=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "binar", "y", "Classifier_", "=_", "binar", "y", "Classif", "ier", "Dic_", "[_", "cat_", "]_", "\\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 ", " _", "binar", "y", "Classifier_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "\\u", "binar", "y", "Classifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", " ", "turn", " ", "int", "o", " ", "a", " ", "binar", "y", " ", "label", "ed", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dset_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "msg_", "in_", "message", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "binar", "y", "Label_", "=_", "'", "pos", "'_", "if_", "cat_", "in_", "msg_", "[_", "'", "categor", "ies", "'_", "]_", "else_", "'", "neg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dset_", "._", "append_", "(_", "(_", "msg_", ",_", "binar", "y", "Label_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", " ", "save", " ", "stat_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n", "Pos_", "=_", "count", "Tru", "th_", "(_", "lambda_", "x_", ":_", "x_", "[_", "1_", "]_", "==_", "'", "pos", "'_", ",_", "dset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "Ne", "g_", "=_", "count", "Tru", "th_", "(_", "lambda_", "x_", ":_", "x_", "[_", "1_", "]_", "==_", "'", "neg", "'_", ",_", "dset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "dset_", ")_", "==_", "n", "Pos_", "+_", "n", "Ne", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "=_", "float_", "(_", "n", "Pos_", ")_", "/_", "(_", "n", "Pos_", "+_", "n", "Ne", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mv", "Acc", "_", "=_", "max_", "(_", "[_", "v_", ",_", "1_", "-_", "v_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "n", "Pos", ",", "n", "Ne", "g", " ", "=", " ", "(%", "d", " ", "/", " ", "%", "d", "),", " ", "major", "it", "y", " ", "vote", " ", "acc", " ", "=", " ", "%", ".3", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "Pos_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "Ne", "g_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mv", "Acc", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stat", "Dic_", "=_", "{_", "'", "n", "Pos", "'_", ":_", "n", "Pos_", ",_", "'", "n", "Ne", "g", "'_", ":_", "n", "Ne", "g_", ",_", "'", "major", "it", "y", " ", "vote", " ", "acc", "'_", ":_", "mv", "Acc", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "run", " ", "cross", " ", "validation", " ", "to", " ", "estimate", " ", "performance_", "\\u\\u\\uNL\\u\\u\\u_", "cv", "Res", "Dic_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "Continu", "e_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "CV_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "do", "CV_", ")_", ":_", "\\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 ", " ", "_", "cv", "Res", "Dic_", "=_", "dss", "g", "Run", "CV_", "(_", "self_", "._", "\\u", "binar", "y", "Classifier_", ",_", "dset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "str", "List_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "n", "Fold", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mean", " ", "of", " ", "accu", "rac", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "9", "5", "%", " ", "confidence", " ", "interval", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "preci", "sion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reca", "ll", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "'%", "2d", "-", "CV", ":", " ", "%", "s", " ", "=", " ", "%", ".3", "f", ",", " ", "%", "s", " ", "=", " ", "[", "%", ".3", "f", ",", " ", "%", ".3", "f", "]\\\\", "n", "'_", "%_", "(_", "cv", "Res", "Dic_", "[_", "str", "List_", "[_", "0_", "]_", "]_", ",_", "str", "List_", "[_", "1_", "]_", ",_", "cv", "Res", "Dic_", "[_", "str", "List_", "[_", "1_", "]_", "]_", ",_", "str", "List_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "]_", ",_", "cv", "Res", "Dic_", "[_", "str", "List_", "[_", "2_", "]_", "]_", "[_", "0_", "]_", ",_", "cv", "Res", "Dic_", "[_", "str", "List_", "[_", "2_", "]_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "[_", "1_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "msg_", "+=_", "'", " ", " ", " ", "%", "s", " ", "=", " ", "%", ".3", "f", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "str", "List_", "[_", "i_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cv", "Res", "Dic_", "[_", "str", "List_", "[_", "i_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "i_", "!=_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "msg_", "+=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "did", "CV_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Too", "Ske", "wed", "Label", "s", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "'", "CV", " ", "accu", "rac", "y", " ", "estimate", " ", "is", " ", "not", " ", "avail", "able", " ", "due", " ", "to", " ", "skew", "ed", " ", "labels", ".", " ", "Ski", "ppi", "ng", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", " ", " ", "'_", "+_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stat", "Dic_", "[_", "'", "CV", " ", "stat", "'_", "]_", "=_", "cv", "Res", "Dic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "Stats_", "[_", "cat_", "]_", "=_", "stat", "Dic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "build", " ", "a", " ", "classif", "ier", " ", "usi", "ng", " ", "all", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "isinstance_", "(_", "binar", "y", "Classifier_", ",_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Adapti", "ve", "Interpolation", "_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "binar", "y", "Classifier_", ",_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Adapti", "ve", "SVC_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "binar", "y", "Classifier_", "._", "train_", "(_", "dset_", ")_", "\\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_", "(_", "n", "Pos_", "==_", "0_", "or_", "n", "Ne", "g_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", " ", "whe", "n", " ", "only", " ", "one", " ", "label", " ", "presen", "ts", ",", " ", "create", " ", "a", " ", "major", "it", "y", " ", "vote", " ", "classifier_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mv", "Classifier_", "=_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Maj", "ori", "ty", "Vote", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mv", "Classifier_", "._", "train_", "(_", "dset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "Classifier_", "=_", "mv", "Classifier_", "\\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 ", " ", "_", "binar", "y", "Classifier_", "._", "train_", "(_", "dset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", " ", "report", " ", "vocabulary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "isinstance_", "(_", "binar", "y", "Classifier_", ",_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Adapti", "ve", "Interpolation", "_", ")_", "or_", "isinstance_", "(_", "binar", "y", "Classifier_", ",_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Adapti", "ve", "SVC_", ")_", "or_", "isinstance_", "(_", "binar", "y", "Classifier_", ",_", "Ds", "sg", "Bin", "ary", "Classif", "ier", "Maj", "ori", "ty", "Vote", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "Can", "\\\\'", "t", " ", "get", " ", "n", "Voca", " ", "sinc", "e", " ", "the", " ", "classif", "ier", " ", "is", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repr_", "(_", "binar", "y", "Classifier_", ")_", ")_", "\\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 ", " _", "n", "Voca", "_", "=_", "len_", "(_", "binar", "y", "Classifier_", "._", "\\u", "vectorizer", "_", "._", "get", "Feature", "Name", "List_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", " ", " ", "n", "Voca", " ", "=", " ", "%", "d", "'_", ",_", "n", "Voca", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "isinstance_", "(_", "binar", "y", "Classifier_", "._", "\\u", "vectorizer", "_", ",_", "Ds", "sg", "Multi", "Vectorizer_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "Vector", "ize", "r", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repr_", "(_", "binar", "y", "Classifier_", "._", "\\u", "vectorizer", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", " ", "add", " ", "classif", "ier", " ", "to", " ", "classif", "ier", " ", "dictionar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "classif", "ier", "Dic_", "[_", "cat_", "]_", "=_", "binar", "y", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", " ", " ", "type", " ", "=", " ", "%", "s", "'_", ",_", "str_", "(_", "type_", "(_", "binar", "y", "Classifier_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "did", "CV_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tot", "NTP", "_", "+=_", "stat", "Dic_", "[_", "'", "CV", " ", "stat", "'_", "]_", "[_", "'", "n", "TP", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "NF", "P_", "+=_", "stat", "Dic_", "[_", "'", "CV", " ", "stat", "'_", "]_", "[_", "'", "n", "FP", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "NT", "N_", "+=_", "stat", "Dic_", "[_", "'", "CV", " ", "stat", "'_", "]_", "[_", "'", "n", "TN", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "NF", "N_", "+=_", "stat", "Dic_", "[_", "'", "CV", " ", "stat", "'_", "]_", "[_", "'", "n", "FN", "'_", "]_", "\\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_", "(_", "do", "CV_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "did", "CV", "Cate", "gory", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cat_", ",_", "v_", "in_", "train", "Stats_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "len_", "(_", "v_", "[_", "'", "CV", " ", "stat", "'_", "]_", ")_", "!=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "did", "CV", "Cate", "gory", "List_", "._", "append_", "(_", "cat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "DID", " ", "CV", " ", "for", " ", "categor", "ies", ":", " ", "%", "s", "'_", ",_", "str_", "(_", "did", "CV", "Cate", "gory", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mean", "F1_", "=_", "np_", "._", "mean_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "array_", "(_", "map_", "(_", "lambda_", "cat_", ":_", "train", "Stats_", "[_", "cat_", "]_", "[_", "'", "CV", " ", "stat", "'_", "]_", "[_", "'", "f1", "'_", "]_", ",_", "did", "CV", "Cate", "gory", "List_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "Over", "all", " ", "mean", " ", "F1", " ", "=", " ", "%", ".3", "f", "'_", ",_", "mean", "F1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tot", "Precis", "ion_", "=_", "float_", "(_", "tot", "NTP", "_", ")_", "/_", "(_", "tot", "NTP", "_", "+_", "tot", "NF", "P_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "Recal", "l_", "=_", "float_", "(_", "tot", "NTP", "_", ")_", "/_", "(_", "tot", "NTP", "_", "+_", "tot", "NF", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Over", "all", " ", "aggre", "gate", " ", "prec", " ", "=", " ", "%", ".3", "f", ",", " ", "reca", "ll", " ", "=", " ", "%", ".3", "f", ",", " ", "F1", " ", "=", " ", "%", ".3", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tot", "Precis", "ion_", ",_", "tot", "Recal", "l_", ",_", "sp_", "._", "stats_", "._", "hm", "ean_", "(_", "[_", "tot", "Precis", "ion_", ",_", "tot", "Recal", "l_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "classif", "ier", "Dic_", "=_", "classif", "ier", "Dic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "category", "List_", "=_", "category", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "train", "Stats_", "=_", "train", "Stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\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, 0, 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, 2, 2, 0, 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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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, 0, 2 ]
Unused local variable
HewlettPackard/python-hpOneView/examples/scripts/install-appliance-fw.py
[ { "content": "def upload(sts, path, name):\n ret = sts.get_pending_fw()\n if ret != '':\n print('Deleting exsisting FW on appliance: ', ret['fileName'])\n sts.delete_appliance_fw()\n f, e = os.path.splitext(name)\n ret = sts.upload_fw(path, name)\n print('Upploaded FW: %s Version: %s Reboot Required: %s' % (name,\n ret['version'], ret['rebootRequired']))\n ret = sts.get_pending_fw()\n if ret == '':\n print('ERROR: Can not locate fw upgrade')\n sys.exit()\n print(ret['fileName'])\n ret = sts.upgrade_appliance_fw(ret['fileName'])\n pprint(ret)", "metadata": "root.upload", "header": "['module', '___EOS___']", "index": 66 } ]
[ { "span": "f,", "start_line": 71, "start_column": 4, "end_line": 71, "end_column": 5 }, { "span": "e ", "start_line": 71, "start_column": 7, "end_line": 71, "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_", "upload_", "(_", "sts_", ",_", "path_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "sts_", "._", "get", "\\u", "pend", "ing", "\\u", "fw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Del", "eti", "ng", " ", "ex", "sis", "ting", " ", "FW", " ", "on", " ", "appliance", ":", " ", "'_", ",_", "ret_", "[_", "'", "file", "Name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sts_", "._", "delete", "\\u", "appliance", "\\u", "fw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", ",_", "e_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "sts_", "._", "upload", "\\u", "fw_", "(_", "path_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Upp", "load", "ed", " ", "FW", ":", " ", "%", "s", " ", "Version", ":", " ", "%", "s", " ", "Reboot", " ", "Requ", "ired", ":", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "[_", "'", "version", "'_", "]_", ",_", "ret_", "[_", "'", "rebo", "ot", "Requ", "ired", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "sts_", "._", "get", "\\u", "pend", "ing", "\\u", "fw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "ERROR", ":", " ", "Can", " ", "not", " ", "locat", "e", " ", "fw", " ", "upgrade", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "ret_", "[_", "'", "file", "Name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "sts_", "._", "upgrade", "\\u", "appliance", "\\u", "fw_", "(_", "ret_", "[_", "'", "file", "Name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pprint_", "(_", "ret_", ")_", "\\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, 0, 1, 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 ]
Imprecise assert
AppScale/appscale/AppDB/test/functional/test_zktransaction.py
[ { "content": " def test_getTransactionId(self):\n app = \"testapp\"\n id = self.zk.get_transaction_id(app)\n self.assertTrue(id > 0)", "metadata": "root.TestZKTransaction.test_getTransactionId", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 12 }, { "content": " def test_locksimple(self):\n app = \"testapp\"\n key = \"root\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.test_locksimple", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " def test_lockpathkey(self):\n app = \"testapp\"\n key = \"/root/child\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.test_lockpathkey", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_lockspecialcharapp(self):\n app = \"!@#$%^&*()-=_+[]{}\\\\|~`;:\\\"',.<>/?\"\n key = \"!@#$%^&*()-=_+[]{}\\\\|~`;:\\\"',.<>/?\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.test_lockspecialcharapp", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def test_locklongkey(self):\n app = \"testapp\"\n key = \"/root/child/looooooooooooooooooooooooooooooooooooooong\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.test_locklongkey", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_locktwice(self):\n app = \"testapp\"\n key = \"root\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.test_locktwice", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 57 }, { "content": " def test_lockdifferentkey(self):\n app = \"testapp\"\n key = \"root\"\n key2 = \"root2\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n try:\n ret = self.zk.acquire_lock(app, txid, key2)\n self.fail()\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_DIFFERENT_ROOTKEY, e.getType())\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.test_lockdifferentkey", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 69 }, { "content": " def test_lockafterrelease(self):\n app = \"testapp\"\n key = \"root\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)\n try:\n ret = self.zk.acquire_lock(app, txid, key)\n self.fail()\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_INVALID, e.getType())", "metadata": "root.TestZKTransaction.test_lockafterrelease", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def test_lock1000(self):\n app = \"testapp\"\n key = \"root\"\n for ii in range(1,1000):\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.test_lock1000", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 113 }, { "content": " def test_releasewithoutlock(self):\n app = \"testapp\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.release_lock(app, txid)\n self.assertFalse(ret)", "metadata": "root.TestZKTransaction.test_releasewithoutlock", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 135 }, { "content": " def test_releasedifferentkey(self):\n app = \"testapp\"\n key = \"root\"\n key2 = \"root2\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n try:\n ret = self.zk.release_lock(app, txid, key2)\n self.fail()\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_DIFFERENT_ROOTKEY, e.getType())\n ret = self.zk.release_lock(app, txid, key)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.test_releasedifferentkey", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 142 }, { "content": " def test_generateid(self):\n app = \"testapp\"\n key = \"root\"\n (id, block) = self.zk.generateIDBlock(app, key)\n print \"id=%d, block=%d\" % (id, block)\n self.assertTrue(id >= 0)\n self.assertTrue(block > 0)", "metadata": "root.TestZKTransaction.test_generateid", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 159 }, { "content": " def test_generateid_pathkey(self):\n app = \"testapp\"\n key = \"/root/child\"\n (id, block) = self.zk.generateIDBlock(app, key)\n print \"id=%d, block=%d\" % (id, block)\n self.assertTrue(id >= 0)\n self.assertTrue(block > 0)", "metadata": "root.TestZKTransaction.test_generateid_pathkey", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 167 }, { "content": " def test_generateid_specialcharacterkey(self):\n app = \"testapp\"\n key = \"!@#$%^&*()-=_+[]{}\\\\|~`;:\\\"',.<>/?\"\n (id, block) = self.zk.generateIDBlock(app, key)\n print \"id=%d, block=%d\" % (id, block)\n self.assertTrue(id >= 0)\n self.assertTrue(block > 0)", "metadata": "root.TestZKTransaction.test_generateid_specialcharacterkey", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 175 }, { "content": " def test_generateid_twoblocks(self):\n app = \"testapp\"\n key = \"root\"\n (id, block) = self.zk.generateIDBlock(app, key)\n print \"id=%d, block=%d\" % (id, block)\n self.assertTrue(id >= 0)\n self.assertTrue(block > 0)\n (nextid, block) = self.zk.generateIDBlock(app, key)\n print \"id=%d, block=%d\" % (nextid, block)\n self.assertTrue(nextid >= 0)\n self.assertTrue(nextid > id)\n self.assertTrue(block > 0)", "metadata": "root.TestZKTransaction.test_generateid_twoblocks", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 183 }, { "content": " def __increaseA(self):\n app = \"testapp\"\n key = \"roota\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n while not self.zk.acquire_lock(app, txid, key):\n time.sleep(0.1)\n print \"start increaseA %s\" % threading.currentThread()\n tmp = self.valueA\n # make conflict between threads.\n time.sleep(0.5)\n self.valueA = tmp + 1\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.__increaseA", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 238 }, { "content": " def __increaseB(self):\n app = \"testapp\"\n key = \"rootb\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n while not self.zk.acquire_lock(app, txid, key):\n time.sleep(0.1)\n print \"start increaseB %s\" % threading.currentThread()\n tmp = self.valueB\n # make conflict between threads.\n# time.sleep(0.5)\n self.valueB = tmp + 1\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.__increaseB", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 253 }, { "content": " def __decreaseA(self):\n app = \"testapp\"\n key = \"roota\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n while not self.zk.acquire_lock(app, txid, key):\n time.sleep(0.1)\n print \"start decreaseA %s\" % threading.currentThread()\n tmp = self.valueA\n # make conflict between threads.\n time.sleep(0.5)\n self.valueA = tmp - 1\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.__decreaseA", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 268 }, { "content": " def __decreaseB(self):\n app = \"testapp\"\n key = \"rootb\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n while not self.zk.acquire_lock(app, txid, key):\n time.sleep(0.1)\n print \"start decreaseB %s\" % threading.currentThread()\n tmp = self.valueB\n # make conflict between threads.\n# time.sleep(0.5)\n self.valueB = tmp - 1\n ret = self.zk.release_lock(app, txid)\n self.assertTrue(ret)", "metadata": "root.TestZKTransaction.__decreaseB", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 283 }, { "content": " def __lockonlyB(self):\n app = \"testapp\"\n key = \"rootb\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n while not self.zk.acquire_lock(app, txid, key):\n time.sleep(0.1)", "metadata": "root.TestZKTransaction.__lockonlyB", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 298 }, { "content": " def test_gcsimple(self):\n # timeout very fast\n# self.zk.stopGC()\n zkappscale.zktransaction.TX_TIMEOUT = 1\n zkappscale.zktransaction.GC_INTERVAL = 1\n# self.zk.setRollbackFunction(self.__rollbackReceiver)\n # restart gc thread\n self.keylist = None\n self.zk.startGC()\n\n app = \"testapp\"\n key = \"gctestkey\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n # wait for gc\n time.sleep(5)\n self.assertTrue(self.zk.is_blacklisted(app, txid))\n try:\n self.zk.release_lock(app, txid, key)\n self.fail()\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_EXPIRED, e.getType())\n try:\n self.zk.acquire_lock(app, txid, key)\n self.fail()\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_EXPIRED, e.getType())\n\n# self.assertEqual(txid, self.txid)\n# self.assertEqual(key, self.rootkey)\n# self.assertEqual([], self.keylist)\n\n # revert settings\n# self.zk.stopGC()\n zkappscale.zktransaction.TX_TIMEOUT = 30\n zkappscale.zktransaction.GC_INTERVAL = 30\n# self.zk.setRollbackFunction(None)\n self.zk.startGC()", "metadata": "root.TestZKTransaction.test_gcsimple", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 306 }, { "content": " def test_gcwithkeylist(self):\n # timeout very fast\n# self.zk.stopGC()\n zkappscale.zktransaction.TX_TIMEOUT = 1\n zkappscale.zktransaction.GC_INTERVAL = 1\n# self.zk.setRollbackFunction(self.__rollbackReceiver)\n # restart gc thread\n self.keylist = None\n self.zk.startGC()\n\n app = \"testapp\"\n key = \"gctestkey\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n vid = 100L\n self.zk.register_updated_key(app, txid, vid, key + \"/a\")\n # wait for gc\n time.sleep(5)\n self.assertTrue(self.zk.is_blacklisted(app, txid))\n try:\n self.zk.release_lock(app, txid, key)\n self.fail()\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_EXPIRED, e.getType())\n try:\n self.zk.acquire_lock(app, txid, key)\n self.fail()\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_EXPIRED, e.getType())\n\n# self.assertEqual(app, self.app_id)\n# self.assertEqual(txid, self.txid)\n# self.assertEqual(key, self.rootkey)\n# self.assertTrue(self.keylist.index(\"a\") >= 0)\n# self.assertTrue(self.keylist.index(\"b\") >= 0)\n\n # revert settings\n# self.zk.stopGC()\n zkappscale.zktransaction.TX_TIMEOUT = 30\n zkappscale.zktransaction.GC_INTERVAL = 30\n# self.zk.setRollbackFunction(None)\n self.zk.startGC()", "metadata": "root.TestZKTransaction.test_gcwithkeylist", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 349 }, { "content": " def test_rollback(self):\n app = \"testapp\"\n key = \"root\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n ret = self.zk.notify_failed_transaction(app, txid)\n self.assertTrue(ret)\n self.assertTrue(self.zk.is_blacklisted(app, txid))\n try:\n ret = self.zk.release_lock(app, txid)\n self.fail\n except zkappscale.zktransaction.ZKTransactionException as e:\n print e\n self.assertEqual(zkappscale.zktransaction.ZKTransactionException.TYPE_EXPIRED, e.getType())", "metadata": "root.TestZKTransaction.test_rollback", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 435 }, { "content": " def test_updateafterrollback(self):\n app = \"testapp\"\n key = \"root\"\n txid = self.zk.get_transaction_id(app)\n self.assertTrue(txid > 0)\n ret = self.zk.acquire_lock(app, txid, key)\n self.assertTrue(ret)\n vid = 0L\n self.zk.register_updated_key(app, txid, vid, key + \"/a\")\n ret = self.zk.notify_failed_transaction(app, txid)\n self.assertTrue(ret)\n self.assertTrue(self.zk.is_blacklisted(app, txid))\n\n # update value after rollback\n txid2 = self.zk.get_transaction_id(app)\n self.assertTrue(txid2 > 0)\n ret = self.zk.acquire_lock(app, txid2, key)\n self.assertTrue(ret)\n # get previous valid id\n ret = self.zk.get_valid_transaction_id(app, txid, key + \"/a\")\n self.assertEqual(vid, ret)\n # update previous valid id\n vid = 100L\n self.zk.register_updated_key(app, txid2, vid, key + \"/a\")\n # try to get updated previous valid id\n ret = self.zk.get_valid_transaction_id(app, txid, key + \"/a\")\n self.assertEqual(vid, ret)\n self.assertTrue(self.zk.release_lock(app, txid2))", "metadata": "root.TestZKTransaction.test_updateafterrollback", "header": "['class', 'TestZKTransaction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 452 } ]
[ { "span": "self.assertTrue(id > 0)", "start_line": 15, "start_column": 4, "end_line": 15, "end_column": 27 }, { "span": "self.assertTrue(txid > 0)", "start_line": 21, "start_column": 4, "end_line": 21, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 41, "start_column": 4, "end_line": 41, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 51, "start_column": 4, "end_line": 51, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 61, "start_column": 4, "end_line": 61, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 74, "start_column": 4, "end_line": 74, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 90, "start_column": 4, "end_line": 90, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 118, "start_column": 6, "end_line": 118, "end_column": 31 }, { "span": "self.assertTrue(txid > 0)", "start_line": 138, "start_column": 4, "end_line": 138, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 147, "start_column": 4, "end_line": 147, "end_column": 29 }, { "span": "self.assertTrue(id >= 0)", "start_line": 164, "start_column": 4, "end_line": 164, "end_column": 28 }, { "span": "self.assertTrue(block > 0)", "start_line": 165, "start_column": 4, "end_line": 165, "end_column": 30 }, { "span": "self.assertTrue(id >= 0)", "start_line": 172, "start_column": 4, "end_line": 172, "end_column": 28 }, { "span": "self.assertTrue(block > 0)", "start_line": 173, "start_column": 4, "end_line": 173, "end_column": 30 }, { "span": "self.assertTrue(id >= 0)", "start_line": 180, "start_column": 4, "end_line": 180, "end_column": 28 }, { "span": "self.assertTrue(block > 0)", "start_line": 181, "start_column": 4, "end_line": 181, "end_column": 30 }, { "span": "self.assertTrue(id >= 0)", "start_line": 188, "start_column": 4, "end_line": 188, "end_column": 28 }, { "span": "self.assertTrue(block > 0)", "start_line": 189, "start_column": 4, "end_line": 189, "end_column": 30 }, { "span": "self.assertTrue(nextid >= 0)", "start_line": 192, "start_column": 4, "end_line": 192, "end_column": 32 }, { "span": "self.assertTrue(nextid > id)", "start_line": 193, "start_column": 4, "end_line": 193, "end_column": 32 }, { "span": "self.assertTrue(block > 0)", "start_line": 194, "start_column": 4, "end_line": 194, "end_column": 30 }, { "span": "self.assertTrue(txid > 0)", "start_line": 242, "start_column": 4, "end_line": 242, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 257, "start_column": 4, "end_line": 257, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 272, "start_column": 4, "end_line": 272, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 287, "start_column": 4, "end_line": 287, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 302, "start_column": 4, "end_line": 302, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 319, "start_column": 4, "end_line": 319, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 362, "start_column": 4, "end_line": 362, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 439, "start_column": 4, "end_line": 439, "end_column": 29 }, { "span": "self.assertTrue(txid > 0)", "start_line": 456, "start_column": 4, "end_line": 456, "end_column": 29 }, { "span": "self.assertTrue(txid2 > 0)", "start_line": 467, "start_column": 4, "end_line": 467, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "get", "Transa", "ction", "Id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "id_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock", "simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock", "path", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"/", "root", "/", "child", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock", "special", "chara", "pp_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"!", "@#", "$%", "^", "&*", "()", "-=", "\\u", "+[", "]{", "}\\\\", "\\\\|", "~", "`", ";", ":\\\\", "\"',", ".", "<>", "/?", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"!", "@#", "$%", "^", "&*", "()", "-=", "\\u", "+[", "]{", "}\\\\", "\\\\|", "~", "`", ";", ":\\\\", "\"',", ".", "<>", "/?", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock", "long", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"/", "root", "/", "child", "/", "loo", "oooo", "oooo", "oooo", "oooo", "oooo", "oooo", "oooo", "oooo", "oooo", "ong", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock", "twi", "ce_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock", "different", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "\"", "root", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "DIFF", "ERE", "NT", "\\u", "ROO", "TK", "EY", "_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lock", "after", "release_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "INVALID", "_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "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", "lock", "1000_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ii_", "in_", "range_", "(_", "1_", ",_", "1000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "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", "release", "with", "outl", "ock_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "released", "iff", "eren", "tk", "ey_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "\"", "root", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "DIFF", "ERE", "NT", "\\u", "ROO", "TK", "EY", "_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "generat", "eid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "id_", ",_", "block_", ")_", "=_", "self_", "._", "zk_", "._", "generat", "e", "ID", "Block_", "(_", "app_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "id", "=", "%", "d", ",", " ", "block", "=", "%", "d", "\"_", "%_", "(_", "id_", ",_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "id_", ">=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "block_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "generat", "eid", "\\u", "path", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"/", "root", "/", "child", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "id_", ",_", "block_", ")_", "=_", "self_", "._", "zk_", "._", "generat", "e", "ID", "Block_", "(_", "app_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "id", "=", "%", "d", ",", " ", "block", "=", "%", "d", "\"_", "%_", "(_", "id_", ",_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "id_", ">=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "block_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "generat", "eid", "\\u", "special", "character", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"!", "@#", "$%", "^", "&*", "()", "-=", "\\u", "+[", "]{", "}\\\\", "\\\\|", "~", "`", ";", ":\\\\", "\"',", ".", "<>", "/?", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "id_", ",_", "block_", ")_", "=_", "self_", "._", "zk_", "._", "generat", "e", "ID", "Block_", "(_", "app_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "id", "=", "%", "d", ",", " ", "block", "=", "%", "d", "\"_", "%_", "(_", "id_", ",_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "id_", ">=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "block_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "generat", "eid", "\\u", "two", "blocks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "id_", ",_", "block_", ")_", "=_", "self_", "._", "zk_", "._", "generat", "e", "ID", "Block_", "(_", "app_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "id", "=", "%", "d", ",", " ", "block", "=", "%", "d", "\"_", "%_", "(_", "id_", ",_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "id_", ">=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "block_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "next", "id_", ",_", "block_", ")_", "=_", "self_", "._", "zk_", "._", "generat", "e", "ID", "Block_", "(_", "app_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "id", "=", "%", "d", ",", " ", "block", "=", "%", "d", "\"_", "%_", "(_", "next", "id_", ",_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "next", "id_", ">=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "next", "id_", ">_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "block_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "increase", "A_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "a", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "start", " ", "increase", "A", " ", "%", "s", "\"_", "%_", "threading_", "._", "current", "Thread_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "self_", "._", "value", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "confl", "ict", " ", "bet", "ween", " ", "thread", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value", "A_", "=_", "tmp_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "increase", "B_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "b", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "start", " ", "increase", "B", " ", "%", "s", "\"_", "%_", "threading_", "._", "current", "Thread_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "self_", "._", "value", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "confl", "ict", " ", "bet", "ween", " ", "thread", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "time", ".", "sleep", "(", "0.", "5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "value", "B_", "=_", "tmp_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "decrease", "A_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "a", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "start", " ", "decrease", "A", " ", "%", "s", "\"_", "%_", "threading_", "._", "current", "Thread_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "self_", "._", "value", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "confl", "ict", " ", "bet", "ween", " ", "thread", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value", "A_", "=_", "tmp_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "decrease", "B_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "b", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "start", " ", "decrease", "B", " ", "%", "s", "\"_", "%_", "threading_", "._", "current", "Thread_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "self_", "._", "value", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "confl", "ict", " ", "bet", "ween", " ", "thread", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "time", ".", "sleep", "(", "0.", "5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "value", "B_", "=_", "tmp_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lock", "only", "B_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "b", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "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", "gc", "simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "timeo", "ut", " ", "very", " ", "fast_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "zk", ".", "stop", "GC", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "TX", "\\u", "TIMEOUT_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "GC", "\\u", "INTERVAL_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "zk", ".", "set", "Roll", "back", "Function", "(", "self", ".\\u", "\\u", "rollback", "Receive", "r", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "restart", " ", "gc", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "keyli", "st_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zk_", "._", "start", "GC", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "gc", "test", "key", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wait", " ", "for", " ", "gc_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "zk_", "._", "is", "\\u", "blacklisted", "_", "(_", "app_", ",_", "txid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "EXPIRE", "D_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\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 ", " _", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "EXPIRE", "D_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "txi", "d", ",", " ", "self", ".", "txi", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "key", ",", " ", "self", ".", "root", "key", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "([", "],", " ", "self", ".", "keyli", "st", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "revert", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "zk", ".", "stop", "GC", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "TX", "\\u", "TIMEOUT_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "GC", "\\u", "INTERVAL_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "zk", ".", "set", "Roll", "back", "Function", "(", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "zk_", "._", "start", "GC", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "gc", "with", "keyli", "st_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "timeo", "ut", " ", "very", " ", "fast_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "zk", ".", "stop", "GC", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "TX", "\\u", "TIMEOUT_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "GC", "\\u", "INTERVAL_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "zk", ".", "set", "Roll", "back", "Function", "(", "self", ".\\u", "\\u", "rollback", "Receive", "r", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "restart", " ", "gc", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "keyli", "st_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zk_", "._", "start", "GC", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "gc", "test", "key", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vid_", "=_", "100_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zk_", "._", "register", "\\u", "update", "d\\u", "key_", "(_", "app_", ",_", "txid_", ",_", "vid_", ",_", "key_", "+_", "\"/", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wait", " ", "for", " ", "gc_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "zk_", "._", "is", "\\u", "blacklisted", "_", "(_", "app_", ",_", "txid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "EXPIRE", "D_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\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 ", " _", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "EXPIRE", "D_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "app", ",", " ", "self", ".", "app", "\\u", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "txi", "d", ",", " ", "self", ".", "txi", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Equal", "(", "key", ",", " ", "self", ".", "root", "key", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Tru", "e", "(", "self", ".", "keyli", "st", ".", "index", "(\"", "a", "\")", " ", ">=", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Tru", "e", "(", "self", ".", "keyli", "st", ".", "index", "(\"", "b", "\")", " ", ">=", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "revert", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "zk", ".", "stop", "GC", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "TX", "\\u", "TIMEOUT_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "GC", "\\u", "INTERVAL_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "zk", ".", "set", "Roll", "back", "Function", "(", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "zk_", "._", "start", "GC", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rollback_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "notif", "y", "\\u", "fail", "ed", "\\u", "transaction_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "zk_", "._", "is", "\\u", "blacklisted", "_", "(_", "app_", ",_", "txid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "zk_", "._", "release", "\\u", "lock_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zk", "apps", "cale_", "._", "zk", "transaction_", "._", "ZK", "Transa", "ction", "Exception_", "._", "TYPE", "\\u", "EXPIRE", "D_", ",_", "e_", "._", "get", "Type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ZK", "Transaction_", "(_", "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", "update", "after", "rollback_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "\"", "testa", "pp", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "root", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "txid_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txid_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txid_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vid_", "=_", "0_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zk_", "._", "register", "\\u", "update", "d\\u", "key_", "(_", "app_", ",_", "txid_", ",_", "vid_", ",_", "key_", "+_", "\"/", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "notif", "y", "\\u", "fail", "ed", "\\u", "transaction_", "(_", "app_", ",_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "zk_", "._", "is", "\\u", "blacklisted", "_", "(_", "app_", ",_", "txid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "value", " ", "after", " ", "rollback_", "\\u\\u\\uNL\\u\\u\\u_", "txi", "d2_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "transaction", "\\u", "id_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "txi", "d2_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "acquir", "e\\u", "lock_", "(_", "app_", ",_", "txi", "d2_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "previ", "ous", " ", "valid", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "valid", "\\u", "transaction", "\\u", "id_", "(_", "app_", ",_", "txid_", ",_", "key_", "+_", "\"/", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "vid_", ",_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "previ", "ous", " ", "valid", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "vid_", "=_", "100_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zk_", "._", "register", "\\u", "update", "d\\u", "key_", "(_", "app_", ",_", "txi", "d2_", ",_", "vid_", ",_", "key_", "+_", "\"/", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "get", " ", "update", "d", " ", "previ", "ous", " ", "valid", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "self_", "._", "zk_", "._", "get", "\\u", "valid", "\\u", "transaction", "\\u", "id_", "(_", "app_", ",_", "txid_", ",_", "key_", "+_", "\"/", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "vid_", ",_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_",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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 ]
Except block handles 'BaseException'
pycollada/pycollada/examples/check_collada.py
[ { "content": "import collada\nimport sys\nimport traceback\n\nprint 'Attempting to load file %s' % sys.argv[1]\n\ntry:\n col = collada.Collada(sys.argv[1], \\\n ignore=[collada.DaeUnsupportedError, collada.DaeBrokenRefError])\nexcept:\n traceback.print_exc()\n print\n print \"Failed to load collada file.\"\n sys.exit(1)\n\nprint\nprint 'Successfully loaded collada file.'\nprint 'There were %d errors' % len(col.errors)\n\nfor e in col.errors:\n print e\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "colla", "da_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Atte", "mpt", "ing", " ", "to", " ", "load", " ", "file", " ", "%", "s", "'_", "%_", "sys_", "._", "argv_", "[_", "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 ", " _", "col_", "=_", "colla", "da_", "._", "Colla", "da_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ",_", "ignore_", "=_", "[_", "colla", "da_", "._", "Da", "e", "Unsu", "ppo", "rted", "Error_", ",_", "colla", "da_", "._", "Da", "e", "Bro", "ken", "Ref", "Error_", "]_", ")_", "\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Fail", "ed", " ", "to", " ", "load", " ", "colla", "da", " ", "file", ".\"_", "\\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_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Success", "full", "y", " ", "load", "ed", " ", "colla", "da", " ", "file", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "There", " ", "wer", "e", " ", "%", "d", " ", "error", "s", "'_", "%_", "len_", "(_", "col_", "._", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "e_", "in_", "col_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\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, 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 ]
Testing equality to None
uwdata/termite-data-server/web2py/gluon/contrib/pg8000/interface.py
[ { "content": " def next(self):\n retval = self.func(self.obj)\n if retval == None:\n raise StopIteration()\n return retval", "metadata": "root.DataIterator.next", "header": "['class', 'DataIterator', '(', 'object', ')', ':', '___EOS___']", "index": 74 }, { "content": " def __init__(self, connection, statement, *types, **kwargs):\n global statement_number\n if connection == None or connection.c == None:\n raise InterfaceError(\"connection not provided\")\n try:\n statement_number_lock.acquire()\n self._statement_number = statement_number\n statement_number += 1\n finally:\n statement_number_lock.release()\n self.c = connection.c\n self._portal_name = None\n self._statement_name = kwargs.get(\"statement_name\", \"pg8000_statement_%s\" % self._statement_number)\n self._row_desc = None\n self._cached_rows = []\n self._ongoing_row_count = 0\n self._command_complete = True\n self._parse_row_desc = self.c.parse(self._statement_name, statement, types)\n self._lock = threading.RLock()", "metadata": "root.PreparedStatement.__init__", "header": "['class', 'PreparedStatement', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '##', '___NL___', '# Determines the number of rows to read from the database server at once.', '___NL___', '# Reading more rows increases performance at the cost of memory. The', '___NL___', '# default value is 100 rows. The affect of this parameter is transparent.', '___NL___', '# That is, the library reads more rows when the cache is empty', '___NL___', '# automatically.', '___NL___', '# <p>', '___NL___', '# Stability: Added in v1.00, stability guaranteed for v1.xx. It is', '___NL___', '# possible that implementation changes in the future could cause this', '___NL___', '# parameter to be ignored.', '___NL___', '___EOS___']", "index": 120 }, { "content": " def _getRowDescription(self):\n if self._row_desc == None:\n return None\n return self._row_desc.fields", "metadata": "root.PreparedStatement._getRowDescription", "header": "['class', 'PreparedStatement', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '##', '___NL___', '# Determines the number of rows to read from the database server at once.', '___NL___', '# Reading more rows increases performance at the cost of memory. The', '___NL___', '# default value is 100 rows. The affect of this parameter is transparent.', '___NL___', '# That is, the library reads more rows when the cache is empty', '___NL___', '# automatically.', '___NL___', '# <p>', '___NL___', '# Stability: Added in v1.00, stability guaranteed for v1.xx. It is', '___NL___', '# possible that implementation changes in the future could cause this', '___NL___', '# parameter to be ignored.', '___NL___', '___EOS___']", "index": 148 }, { "content": " def read_dict(self):\n row = self._fetch()\n if row == None:\n return row\n retval = {}\n for i in range(len(self._row_desc.fields)):\n col_name = self._row_desc.fields[i]['name']\n if retval.has_key(col_name):\n raise InterfaceError(\"cannot return dict of row when two columns have the same name (%r)\" % (col_name,))\n retval[col_name] = row[i]\n return retval", "metadata": "root.PreparedStatement.read_dict", "header": "['class', 'PreparedStatement', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '##', '___NL___', '# Determines the number of rows to read from the database server at once.', '___NL___', '# Reading more rows increases performance at the cost of memory. The', '___NL___', '# default value is 100 rows. The affect of this parameter is transparent.', '___NL___', '# That is, the library reads more rows when the cache is empty', '___NL___', '# automatically.', '___NL___', '# <p>', '___NL___', '# Stability: Added in v1.00, stability guaranteed for v1.xx. It is', '___NL___', '# possible that implementation changes in the future could cause this', '___NL___', '# parameter to be ignored.', '___NL___', '___EOS___']", "index": 251 }, { "content": " def __init__(self, connection, statement):\n if connection == None or connection.c == None:\n raise InterfaceError(\"connection not provided\")\n self.c = connection.c\n self._row_desc = None\n self._cached_rows = []\n self._ongoing_row_count = -1\n self._command_complete = True\n self.statement = statement\n self._lock = threading.RLock()", "metadata": "root.SimpleStatement.__init__", "header": "['class', 'SimpleStatement', '(', 'PreparedStatement', ')', ':', '___EOS___']", "index": 299 }, { "content": " def require_stmt(func):\n def retval(self, *args, **kwargs):\n if self._stmt == None:\n raise ProgrammingError(\"attempting to use unexecuted cursor\")\n return func(self, *args, **kwargs)\n return retval", "metadata": "root.Cursor.require_stmt", "header": "['class', 'Cursor', '(', 'object', ')', ':', '___EOS___']", "index": 365 }, { "content": " def _getRowDescription(self):\n if self._stmt == None:\n return None\n return self._stmt.row_description", "metadata": "root.Cursor._getRowDescription", "header": "['class', 'Cursor', '(', 'object', ')', ':', '___EOS___']", "index": 373 }, { "content": "class Connection(Cursor):\n\n ##\n # An event handler that is fired when NOTIFY occurs for a notification that\n # has been LISTEN'd for. The value of this property is a\n # util.MulticastDelegate. A callback can be added by using\n # connection.NotificationReceived += SomeMethod. The method will be called\n # with a single argument, an object that has properties: backend_pid,\n # condition, and additional_info. Callbacks can be removed with the -=\n # operator.\n # <p>\n # Stability: Added in v1.03, stability guaranteed for v1.xx.\n NotificationReceived = property(\n lambda self: getattr(self.c, \"NotificationReceived\"),\n lambda self, value: setattr(self.c, \"NotificationReceived\", value)\n )\n\n ##\n # An event handler that is fired when the database server issues a notice.\n # The value of this property is a util.MulticastDelegate. A callback can\n # be added by using connection.NotificationReceived += SomeMethod. The\n # method will be called with a single argument, an object that has\n # properties: severity, code, msg, and possibly others (detail, hint,\n # position, where, file, line, and routine). Callbacks can be removed with\n # the -= operator.\n # <p>\n # Stability: Added in v1.03, stability guaranteed for v1.xx.\n NoticeReceived = property(\n lambda self: getattr(self.c, \"NoticeReceived\"),\n lambda self, value: setattr(self.c, \"NoticeReceived\", value)\n )\n\n ##\n # An event handler that is fired when a runtime configuration option is\n # changed on the server. The value of this property is a\n # util.MulticastDelegate. A callback can be added by using\n # connection.NotificationReceived += SomeMethod. Callbacks can be removed\n # with the -= operator. The method will be called with a single argument,\n # an object that has properties \"key\" and \"value\".\n # <p>\n # Stability: Added in v1.03, stability guaranteed for v1.xx.\n ParameterStatusReceived = property(\n lambda self: getattr(self.c, \"ParameterStatusReceived\"),\n lambda self, value: setattr(self.c, \"ParameterStatusReceived\", value)\n )\n\n ##\n # Begins a new transaction.\n # <p>\n # Stability: Added in v1.00, stability guaranteed for v1.xx.\n\n\n ##\n # Commits the running transaction.\n # <p>\n # Stability: Added in v1.00, stability guaranteed for v1.xx.\n\n ##\n # Rolls back the running transaction.\n # <p>\n # Stability: Added in v1.00, stability guaranteed for v1.xx.\n\n ##\n # Closes an open connection.\n\n is_closed = property(lambda self: self.c == None)\n\n ##\n # Return the fileno of the underlying socket for this connection.\n # <p>\n # Stability: Added in v1.07, stability guaranteed for v1.xx.\n\n ##\n # Poll the underlying socket for this connection and sync if there is data\n # waiting to be read. This has the effect of flushing asynchronous\n # messages from the backend. Returns True if messages were read, False\n # otherwise.\n # <p>\n # Stability: Added in v1.07, stability guaranteed for v1.xx.\n\n ##\n # Return the server_version as reported from the connected server.\n # Raises InterfaceError if no version has been reported from the server.\n", "metadata": "root.Connection", "header": "['module', '___EOS___']", "index": 522 } ]
[ { "span": "retval == None:", "start_line": 76, "start_column": 11, "end_line": 76, "end_column": 25 }, { "span": "connection == None ", "start_line": 122, "start_column": 11, "end_line": 122, "end_column": 29 }, { "span": "connection.c == None:", "start_line": 122, "start_column": 33, "end_line": 122, "end_column": 53 }, { "span": "self._row_desc == None:", "start_line": 149, "start_column": 11, "end_line": 149, "end_column": 33 }, { "span": "row == None:", "start_line": 253, "start_column": 11, "end_line": 253, "end_column": 22 }, { "span": "connection == None ", "start_line": 300, "start_column": 11, "end_line": 300, "end_column": 29 }, { "span": "connection.c == None:", "start_line": 300, "start_column": 33, "end_line": 300, "end_column": 53 }, { "span": "self._stmt == None:", "start_line": 367, "start_column": 15, "end_line": 367, "end_column": 33 }, { "span": "self._stmt == None:", "start_line": 374, "start_column": 11, "end_line": 374, "end_column": 29 }, { "span": "self.c == None)", "start_line": 632, "start_column": 38, "end_line": 632, "end_column": 52 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Data", "Iterator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "self_", "._", "func_", "(_", "self_", "._", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "retval_", "==_", "None_", ":_", "\\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_", "return_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prepare", "d", "Statement_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", "s", " ", "the", " ", "number", " ", "of", " ", "rows", " ", "to", " ", "read", " ", "from", " ", "the", " ", "databa", "se", " ", "server", " ", "at", " ", "onc", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reading", " ", "more", " ", "rows", " ", "increase", "s", " ", "perform", "anc", "e", " ", "at", " ", "the", " ", "cost", " ", "of", " ", "memory", ".", " ", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "value", " ", "is", " ", "100", " ", "rows", ".", " ", " ", "The", " ", "affect", " ", "of", " ", "this", " ", "parameter", " ", "is", " ", "transp", "arent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tha", "t", " ", "is", ",", " ", "the", " ", "librar", "y", " ", "reads", " ", "more", " ", "rows", " ", "whe", "n", " ", "the", " ", "cache", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".00", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", ".", " ", " ", "It", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "possib", "le", " ", "tha", "t", " ", "implementation", " ", "change", "s", " ", "in", " ", "the", " ", "future", " ", "coul", "d", " ", "caus", "e", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parameter", " ", "to", " ", "be", " ", "ignore", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "connection_", ",_", "statement_", ",_", "*_", "types_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "statem", "ent", "\\u", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "connection_", "==_", "None_", "or_", "connection_", "._", "c_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Interface", "Error_", "(_", "\"", "connecti", "on", " ", "not", " ", "provided", "\"_", ")_", "\\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 ", " _", "statem", "ent", "\\u", "number", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "statem", "ent", "\\u", "number_", "=_", "statem", "ent", "\\u", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statem", "ent", "\\u", "number_", "+=_", "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 ", " _", "statem", "ent", "\\u", "number", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "c_", "=_", "connection_", "._", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "portal", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "statem", "ent", "\\u", "name_", "=_", "kwargs_", "._", "get_", "(_", "\"", "statem", "ent", "\\u", "name", "\"_", ",_", "\"", "pg", "800", "0", "\\u", "statem", "ent", "\\u", "%", "s", "\"_", "%_", "self_", "._", "\\u", "statem", "ent", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "row", "\\u", "desc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cache", "d\\u", "rows_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ong", "oin", "g", "\\u", "row", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "command", "\\u", "complete_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parse", "\\u", "row", "\\u", "desc_", "=_", "self_", "._", "c_", "._", "parse_", "(_", "self_", "._", "\\u", "statem", "ent", "\\u", "name_", ",_", "statement_", ",_", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lock_", "=_", "threading_", "._", "RL", "ock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prepare", "d", "Statement_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", "s", " ", "the", " ", "number", " ", "of", " ", "rows", " ", "to", " ", "read", " ", "from", " ", "the", " ", "databa", "se", " ", "server", " ", "at", " ", "onc", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reading", " ", "more", " ", "rows", " ", "increase", "s", " ", "perform", "anc", "e", " ", "at", " ", "the", " ", "cost", " ", "of", " ", "memory", ".", " ", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "value", " ", "is", " ", "100", " ", "rows", ".", " ", " ", "The", " ", "affect", " ", "of", " ", "this", " ", "parameter", " ", "is", " ", "transp", "arent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tha", "t", " ", "is", ",", " ", "the", " ", "librar", "y", " ", "reads", " ", "more", " ", "rows", " ", "whe", "n", " ", "the", " ", "cache", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".00", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", ".", " ", " ", "It", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "possib", "le", " ", "tha", "t", " ", "implementation", " ", "change", "s", " ", "in", " ", "the", " ", "future", " ", "coul", "d", " ", "caus", "e", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parameter", " ", "to", " ", "be", " ", "ignore", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "get", "Row", "Description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "row", "\\u", "desc_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "row", "\\u", "desc_", "._", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prepare", "d", "Statement_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", "s", " ", "the", " ", "number", " ", "of", " ", "rows", " ", "to", " ", "read", " ", "from", " ", "the", " ", "databa", "se", " ", "server", " ", "at", " ", "onc", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reading", " ", "more", " ", "rows", " ", "increase", "s", " ", "perform", "anc", "e", " ", "at", " ", "the", " ", "cost", " ", "of", " ", "memory", ".", " ", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "value", " ", "is", " ", "100", " ", "rows", ".", " ", " ", "The", " ", "affect", " ", "of", " ", "this", " ", "parameter", " ", "is", " ", "transp", "arent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tha", "t", " ", "is", ",", " ", "the", " ", "librar", "y", " ", "reads", " ", "more", " ", "rows", " ", "whe", "n", " ", "the", " ", "cache", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".00", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", ".", " ", " ", "It", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "possib", "le", " ", "tha", "t", " ", "implementation", " ", "change", "s", " ", "in", " ", "the", " ", "future", " ", "coul", "d", " ", "caus", "e", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parameter", " ", "to", " ", "be", " ", "ignore", "d", "._", "\\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_", "def_", "read", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "=_", "self_", "._", "\\u", "fetch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "retval_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "self_", "._", "\\u", "row", "\\u", "desc_", "._", "fields_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "\\u", "name_", "=_", "self_", "._", "\\u", "row", "\\u", "desc_", "._", "fields_", "[_", "i_", "]_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "retval_", "._", "has", "\\u", "key_", "(_", "col", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Interface", "Error_", "(_", "\"", "cann", "ot", " ", "return", " ", "dict", " ", "of", " ", "row", " ", "whe", "n", " ", "two", " ", "column", "s", " ", "have", " ", "the", " ", "same", " ", "name", " ", "(%", "r", ")\"_", "%_", "(_", "col", "\\u", "name_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "retval_", "[_", "col", "\\u", "name_", "]_", "=_", "row_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Statement_", "(_", "Prepare", "d", "Statement_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "connection_", ",_", "statement_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "connection_", "==_", "None_", "or_", "connection_", "._", "c_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Interface", "Error_", "(_", "\"", "connecti", "on", " ", "not", " ", "provided", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "c_", "=_", "connection_", "._", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "row", "\\u", "desc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cache", "d\\u", "rows_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ong", "oin", "g", "\\u", "row", "\\u", "count_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "command", "\\u", "complete_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "statement_", "=_", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lock_", "=_", "threading_", "._", "RL", "ock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cursor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "require", "\\u", "stmt_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "retval_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "stmt_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Programm", "ing", "Error_", "(_", "\"", "atte", "mpt", "ing", " ", "to", " ", "use", " ", "une", "xec", "ute", "d", " ", "cursor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cursor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "get", "Row", "Description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "stmt_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "stmt_", "._", "row", "\\u", "description_", "\\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_", "Connection_", "(_", "Cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "An", " ", "event", " ", "handler", " ", "tha", "t", " ", "is", " ", "fired", " ", "whe", "n", " ", "NOTIF", "Y", " ", "occur", "s", " ", "for", " ", "a", " ", "notification", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", " ", "bee", "n", " ", "LISTEN", "'", "d", " ", "for", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "property", " ", "is", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", ".", "Multi", "cast", "Delegate", ".", " ", " ", "A", " ", "callback", " ", "can", " ", "be", " ", "adde", "d", " ", "by", " ", "using_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connecti", "on", ".", "Notifi", "cation", "Receive", "d", " ", "+=", " ", "Some", "Meth", "od", ".", " ", " ", "The", " ", "method", " ", "will", " ", "be", " ", "called_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "a", " ", "single", " ", "argu", "ment", ",", " ", "an", " ", "object", " ", "tha", "t", " ", "has", " ", "proper", "ties", ":", " ", "back", "end", "\\u", "pid", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "condition", ",", " ", "and", " ", "addition", "al", "\\u", "info", ".", " ", " ", "Call", "backs", " ", "can", " ", "be", " ", "remove", "d", " ", "with", " ", "the", " ", "-=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "opera", "tor", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".03", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Notifi", "cation", "Received_", "=_", "property_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "self_", ":_", "getattr_", "(_", "self_", "._", "c_", ",_", "\"", "Notifi", "cation", "Receive", "d", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "self_", ",_", "value_", ":_", "setattr_", "(_", "self_", "._", "c_", ",_", "\"", "Notifi", "cation", "Receive", "d", "\"_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "An", " ", "event", " ", "handler", " ", "tha", "t", " ", "is", " ", "fired", " ", "whe", "n", " ", "the", " ", "databa", "se", " ", "server", " ", "issue", "s", " ", "a", " ", "notice", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "value", " ", "of", " ", "this", " ", "property", " ", "is", " ", "a", " ", "util", ".", "Multi", "cast", "Delegate", ".", " ", " ", "A", " ", "callback", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "adde", "d", " ", "by", " ", "usi", "ng", " ", "connecti", "on", ".", "Notifi", "cation", "Receive", "d", " ", "+=", " ", "Some", "Meth", "od", ".", " ", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "method", " ", "will", " ", "be", " ", "call", "ed", " ", "with", " ", "a", " ", "single", " ", "argu", "ment", ",", " ", "an", " ", "object", " ", "tha", "t", " ", "has_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "proper", "ties", ":", " ", "sever", "it", "y", ",", " ", "code", ",", " ", "msg", ",", " ", "and", " ", "possib", "ly", " ", "other", "s", " ", "(", "deta", "il", ",", " ", "hin", "t", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "position", ",", " ", "where", ",", " ", "file", ",", " ", "line", ",", " ", "and", " ", "routin", "e", ").", " ", " ", "Call", "backs", " ", "can", " ", "be", " ", "remove", "d", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "-=", " ", "opera", "tor", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".03", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", "._", "\\u\\u\\uNL\\u\\u\\u_", "Noti", "ce", "Received_", "=_", "property_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "self_", ":_", "getattr_", "(_", "self_", "._", "c_", ",_", "\"", "Noti", "ce", "Receive", "d", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "self_", ",_", "value_", ":_", "setattr_", "(_", "self_", "._", "c_", ",_", "\"", "Noti", "ce", "Receive", "d", "\"_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "An", " ", "event", " ", "handler", " ", "tha", "t", " ", "is", " ", "fired", " ", "whe", "n", " ", "a", " ", "runt", "ime", " ", "configura", "tion", " ", "option", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", "d", " ", "on", " ", "the", " ", "server", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "property", " ", "is", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", ".", "Multi", "cast", "Delegate", ".", " ", " ", "A", " ", "callback", " ", "can", " ", "be", " ", "adde", "d", " ", "by", " ", "using_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connecti", "on", ".", "Notifi", "cation", "Receive", "d", " ", "+=", " ", "Some", "Meth", "od", ".", " ", " ", "Call", "backs", " ", "can", " ", "be", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "the", " ", "-=", " ", "opera", "tor", ".", " ", " ", "The", " ", "method", " ", "will", " ", "be", " ", "call", "ed", " ", "with", " ", "a", " ", "single", " ", "argu", "ment", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "an", " ", "object", " ", "tha", "t", " ", "has", " ", "proper", "ties", " ", "\"", "key", "\"", " ", "and", " ", "\"", "value", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".03", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", "._", "\\u\\u\\uNL\\u\\u\\u_", "Parameter", "Status", "Received_", "=_", "property_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "self_", ":_", "getattr_", "(_", "self_", "._", "c_", ",_", "\"", "Parameter", "Status", "Receive", "d", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "self_", ",_", "value_", ":_", "setattr_", "(_", "self_", "._", "c_", ",_", "\"", "Parameter", "Status", "Receive", "d", "\"_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Begin", "s", " ", "a", " ", "new", " ", "transaction", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".00", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", "._", "\\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_", "#", " ", "Commi", "ts", " ", "the", " ", "runn", "ing", " ", "transaction", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".00", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Roll", "s", " ", "back", " ", "the", " ", "runn", "ing", " ", "transaction", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".00", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Closes", " ", "an", " ", "open", " ", "connecti", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "\\u", "closed_", "=_", "property_", "(_", "lambda_", "self_", ":_", "self_", "._", "c_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "the", " ", "filen", "o", " ", "of", " ", "the", " ", "underl", "ying", " ", "socket", " ", "for", " ", "this", " ", "connecti", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".0", "7", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Poll", " ", "the", " ", "underl", "ying", " ", "socket", " ", "for", " ", "this", " ", "connecti", "on", " ", "and", " ", "sync", " ", "if", " ", "there", " ", "is", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "ing", " ", "to", " ", "be", " ", "read", ".", " ", "Thi", "s", " ", "has", " ", "the", " ", "effect", " ", "of", " ", "flush", "ing", " ", "async", "hronous", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", "s", " ", "from", " ", "the", " ", "back", "end", ".", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "message", "s", " ", "wer", "e", " ", "read", ",", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", "wis", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "p", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sta", "bilit", "y", ":", " ", "Added", " ", "in", " ", "v1", ".0", "7", ",", " ", "stability", " ", "guaran", "tee", "d", " ", "for", " ", "v1", ".", "xx", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "the", " ", "server", "\\u", "version", " ", "as", " ", "reporte", "d", " ", "from", " ", "the", " ", "connect", "ed", " ", "server", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rai", "ses", " ", "Interface", "Error", " ", "if", " ", "no", " ", "version", " ", "has", " ", "bee", "n", " ", "reporte", "d", " ", "from", " ", "the", " ", "server", "._", "\\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, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Incomplete URL substring sanitization
kootenpv/sky/sky/handle_dbpedia.py
[ { "content": "# import re\nimport os\nimport json\n\nresources = {}\n# Explanation: http://wiki.dbpedia.org/Downloads2015-04\n# Link to this set: http://downloads.dbpedia.org/2015-04/core-i18n/en/instance-types_en.nt.bz2\nwith open('/Users/pascal/Downloads/instance_types_en.nt') as f: \n for line in f:\n try:\n parts = line.split()\n first_part = parts[0]\n if first_part.count('/') == 4:\n name = first_part.split('/')[-1].replace('_', ' ').lower()[:-1]\n if len(name.split()) > 3:\n continue\n pos = name.find(' ')\n if pos > -1:\n name = name[:pos] \n if 'ontologydesignpatterns' in parts[2]: \n continue\n if 'w3.org' in parts[2]: \n continue\n if name not in resources: \n resources[name] = set() \n resources[name].add(parts[2].split('/')[-1][:-1]) \n except IndexError:\n pass \n\n# resources start with 'http://dbpedia.org/resource/'\n\n# types = set()\n# for name in resources:\n# m = re.search(r'(\\(.+\\))', name)\n# if m:\n# types.add(m.groups()[0].lower()) \n\nstripped_resources = {}\nfor x in resources:\n if any([y in x for y in '0123456789']): \n if '%' not in x: \n continue\n pos = x.find('(') \n if pos > -1:\n stripped_resources[x[:pos].strip()] = list(resources[x])\n else: \n stripped_resources[x.strip()] = list(resources[x])\n\n####################################################################################################################### \n\nfname = os.path.join(os.path.dirname(__file__), 'dbpedia.json')\nwith open(fname, 'w') as f: \n json.dump(stripped_resources, f)\n\n# from ZODB.FileStorage import FileStorage\n# from ZODB.DB import DB\n\n# import transaction\n# from BTrees.OOBTree import OOBTree\n \n# storage = FileStorage('/Users/pascal/GDrive/appear/Data.fs')\n# db = DB(storage)\n# connection = db.open()\n# root = connection.root()\n\n# root['dbpedia'] = OOBTree(stripped_resources)\n# transaction.commit()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "'w3.org' in parts[2]:", "start_line": 21, "start_column": 19, "end_line": 21, "end_column": 39 } ]
[]
1
true
[ "[CLS]_", "Incomp", "lete", "_", "URL_", "substring", "_", "sani", "ti", "zation_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "import", " ", "re_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resources_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Expla", "nati", "on", ":", " ", "http", "://", "wiki", ".", "dbp", "edia", ".", "org", "/", "Down", "load", "s2", "015", "-0", "4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Link", " ", "to", " ", "this", " ", "set", ":", " ", "http", "://", "download", "s", ".", "dbp", "edia", ".", "org", "/", "201", "5", "-0", "4", "/", "core", "-", "i18n", "/", "en", "/", "instance", "-", "types", "\\u", "en", ".", "nt", ".", "bz2", "_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "'/", "User", "s", "/", "pasc", "al", "/", "Down", "load", "s", "/", "instance", "\\u", "types", "\\u", "en", ".", "nt", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "f_", ":_", "\\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 ", " _", "parts_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "part_", "=_", "parts_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "first", "\\u", "part_", "._", "count_", "(_", "'/'_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "first", "\\u", "part_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "._", "replace_", "(_", "'\\u'_", ",_", "'", " ", "'_", ")_", "._", "lower_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "name_", "._", "split_", "(_", ")_", ")_", ">_", "3_", ":_", "\\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_", "pos_", "=_", "name_", "._", "find_", "(_", "'", " ", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "name_", "[_", ":_", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "ontology", "design", "pattern", "s", "'_", "in_", "parts_", "[_", "2_", "]_", ":_", "\\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_", "'", "w3", ".", "org", "'_", "in_", "parts_", "[_", "2_", "]_", ":_", "\\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_", "name_", "not_", "in_", "resources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "resources_", "[_", "name_", "]_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resources_", "[_", "name_", "]_", "._", "add_", "(_", "parts_", "[_", "2_", "]_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "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_", "#", " ", "resource", "s", " ", "start", " ", "with", " ", "'", "http", "://", "dbp", "edia", ".", "org", "/", "resource", "/'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "types", " ", "=", " ", "set", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "name", " ", "in", " ", "resource", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "m", " ", "=", " ", "re", ".", "search", "(", "r", "'(\\\\", "(.+", "\\\\)", ")'", ",", " ", "name", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "m", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "types", ".", "add", "(", "m", ".", "group", "s", "()[", "0", "].", "lower", "())", " _", "\\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_", "strip", "ped", "\\u", "resources_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "resources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "any_", "(_", "[_", "y_", "in_", "x_", "for_", "y_", "in_", "'", "0123456", "789", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'%'_", "not_", "in_", "x_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pos_", "=_", "x_", "._", "find_", "(_", "'('_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strip", "ped", "\\u", "resources_", "[_", "x_", "[_", ":_", "pos_", "]_", "._", "strip_", "(_", ")_", "]_", "=_", "list_", "(_", "resources_", "[_", "x_", "]_", ")_", "\\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 ", " _", "strip", "ped", "\\u", "resources_", "[_", "x_", "._", "strip_", "(_", ")_", "]_", "=_", "list_", "(_", "resources_", "[_", "x_", "]_", ")_", "\\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_", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "dbp", "edia", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "fname_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "strip", "ped", "\\u", "resources_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "ZO", "DB", ".", "File", "Stor", "age", " ", "import", " ", "File", "Storage_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "ZO", "DB", ".", "DB", " ", "import", " ", "DB_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "transaction_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "BT", "ree", "s", ".", "OO", "BT", "ree", " ", "import", " ", "OO", "BT", "ree_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "storage", " ", "=", " ", "File", "Stor", "age", "('", "/", "User", "s", "/", "pasc", "al", "/", "GD", "rive", "/", "appear", "/", "Data", ".", "fs", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "db", " ", "=", " ", "DB", "(", "storage", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connecti", "on", " ", "=", " ", "db", ".", "open", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "root", " ", "=", " ", "connecti", "on", ".", "root", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "root", "['", "dbp", "edia", "']", " ", "=", " ", "OO", "BT", "ree", "(", "strip", "ped", "\\u", "resource", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transaction", ".", "commit", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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_time = time.time()\n app = sync.app\n remote_change = sync.get('changes/%s?o=DETAILED_LABELS&o=ALL_REVISIONS&o=ALL_COMMITS&o=MESSAGES&o=DETAILED_ACCOUNTS&o=CURRENT_ACTIONS&o=ALL_FILES' % self.change_id)\n # Perform subqueries this task will need outside of the db session\n for remote_commit, remote_revision in remote_change.get('revisions', {}).items():\n remote_comments_data = sync.get('changes/%s/revisions/%s/comments' % (self.change_id, remote_commit))\n remote_revision['_gertty_remote_comments_data'] = remote_comments_data\n remote_conflicts = sync.query(['q=status:open+is:mergeable+conflicts:%s' %\n remote_change['_number']])\n fetches = collections.defaultdict(list)\n parent_commits = set()\n with app.db.getSession() as session:\n change = session.getChangeByID(self.change_id)\n account = session.getAccountByID(remote_change['owner']['_account_id'],\n name=remote_change['owner'].get('name'),\n username=remote_change['owner'].get('username'),\n email=remote_change['owner'].get('email'))\n if not change:\n project = session.getProjectByName(remote_change['project'])\n created = dateutil.parser.parse(remote_change['created'])\n updated = dateutil.parser.parse(remote_change['updated'])\n change = project.createChange(remote_change['id'], account, remote_change['_number'],\n remote_change['branch'], remote_change['change_id'],\n remote_change['subject'], created,\n updated, remote_change['status'],\n topic=remote_change.get('topic'))\n self.log.info(\"Created new change %s in local DB.\", change.id)\n result = ChangeAddedEvent(change)\n else:\n result = ChangeUpdatedEvent(change)\n app.project_cache.clear(change.project)\n self.results.append(result)\n change.owner = account\n if change.status != remote_change['status']:\n change.status = remote_change['status']\n result.status_changed = True\n if remote_change.get('starred'):\n change.starred = True\n else:\n change.starred = False\n change.subject = remote_change['subject']\n change.updated = dateutil.parser.parse(remote_change['updated'])\n change.topic = remote_change.get('topic')\n unseen_conflicts = [x.id for x in change.conflicts]\n for remote_conflict in remote_conflicts:\n conflict_id = remote_conflict['id']\n conflict = session.getChangeByID(conflict_id)\n if not conflict:\n self.log.info(\"Need to sync conflicting change %s for change %s.\",\n conflict_id, change.number)\n sync.submitTask(SyncChangeTask(conflict_id, priority=self.priority))\n else:\n if conflict not in change.conflicts:\n self.log.info(\"Added conflict %s for change %s in local DB.\",\n conflict.number, change.number)\n change.addConflict(conflict)\n self.results.append(ChangeUpdatedEvent(conflict))\n if conflict_id in unseen_conflicts:\n unseen_conflicts.remove(conflict_id)\n for conflict_id in unseen_conflicts:\n conflict = session.getChangeByID(conflict_id)\n self.log.info(\"Deleted conflict %s for change %s in local DB.\",\n conflict.number, change.number)\n change.delConflict(conflict)\n self.results.append(ChangeUpdatedEvent(conflict))\n repo = gitrepo.get_repo(change.project.name, app.config)\n new_revision = False\n for remote_commit, remote_revision in remote_change.get('revisions', {}).items():\n revision = session.getRevisionByCommit(remote_commit)\n # TODO: handle multiple parents\n url = sync.app.config.git_url + change.project.name\n if 'anonymous http' in remote_revision['fetch']:\n ref = remote_revision['fetch']['anonymous http']['ref']\n url = remote_revision['fetch']['anonymous http']['url']\n auth = False\n elif 'http' in remote_revision['fetch']:\n auth = True\n ref = remote_revision['fetch']['http']['ref']\n url = list(urlparse.urlsplit(sync.app.config.url + change.project.name))\n url[1] = '%s:%s@%s' % (\n urlparse.quote_plus(sync.app.config.username),\n urlparse.quote_plus(sync.app.config.password), url[1])\n url = urlparse.urlunsplit(url)\n elif 'ssh' in remote_revision['fetch']:\n ref = remote_revision['fetch']['ssh']['ref']\n url = remote_revision['fetch']['ssh']['url']\n auth = False\n elif 'git' in remote_revision['fetch']:\n ref = remote_revision['fetch']['git']['ref']\n url = remote_revision['fetch']['git']['url']\n auth = False\n else:\n if len(remote_revision['fetch']):\n errMessage = \"No supported fetch method found. Server offers: %s\" % (\n ', '.join(remote_revision['fetch'].keys()))\n else:\n errMessage = \"The server is missing the download-commands plugin.\"\n raise Exception(errMessage)\n if (not revision) or self.force_fetch:\n fetches[url].append('+%(ref)s:%(ref)s' % dict(ref=ref))\n if not revision:\n revision = change.createRevision(remote_revision['_number'],\n remote_revision['commit']['message'], remote_commit,\n remote_revision['commit']['parents'][0]['commit'],\n auth, ref)\n self.log.info(\"Created new revision %s for change %s revision %s in local DB.\",\n revision.key, self.change_id, remote_revision['_number'])\n new_revision = True\n revision.message = remote_revision['commit']['message']\n actions = remote_revision.get('actions', {})\n revision.can_submit = 'submit' in actions\n # TODO: handle multiple parents\n if revision.parent not in parent_commits:\n parent_revision = session.getRevisionByCommit(revision.parent)\n if not parent_revision and change.status not in CLOSED_STATUSES:\n sync._syncChangeByCommit(revision.parent, self.priority)\n self.log.debug(\"Change %s revision %s needs parent commit %s synced\" %\n (change.id, remote_revision['_number'], revision.parent))\n parent_commits.add(revision.parent)\n result.updateRelatedChanges(session, change)\n\n f = revision.getFile('/COMMIT_MSG')\n if f is None:\n f = revision.createFile('/COMMIT_MSG', None,\n None, None, None)\n for remote_path, remote_file in remote_revision['files'].items():\n f = revision.getFile(remote_path)\n if f is None:\n if remote_file.get('binary'):\n inserted = deleted = None\n else:\n inserted = remote_file.get('lines_inserted', 0)\n deleted = remote_file.get('lines_deleted', 0)\n f = revision.createFile(remote_path, remote_file.get('status', 'M'),\n remote_file.get('old_path'),\n inserted, deleted)\n\n remote_comments_data = remote_revision['_gertty_remote_comments_data']\n for remote_file, remote_comments in remote_comments_data.items():\n for remote_comment in remote_comments:\n account = session.getAccountByID(remote_comment['author']['_account_id'],\n name=remote_comment['author'].get('name'),\n username=remote_comment['author'].get('username'),\n email=remote_comment['author'].get('email'))\n comment = session.getCommentByID(remote_comment['id'])\n if not comment:\n # Normalize updated -> created\n created = dateutil.parser.parse(remote_comment['updated'])\n parent = False\n if remote_comment.get('side', '') == 'PARENT':\n parent = True\n fileobj = revision.getFile(remote_file)\n if fileobj is None:\n fileobj = revision.createFile(remote_file, 'M')\n comment = fileobj.createComment(remote_comment['id'], account,\n remote_comment.get('in_reply_to'),\n created,\n parent, remote_comment.get('line'),\n remote_comment['message'])\n self.log.info(\"Created new comment %s for revision %s in local DB.\",\n comment.key, revision.key)\n else:\n if comment.author != account:\n comment.author = account\n new_message = False\n for remote_message in remote_change.get('messages', []):\n if 'author' in remote_message:\n account = session.getAccountByID(remote_message['author']['_account_id'],\n name=remote_message['author'].get('name'),\n username=remote_message['author'].get('username'),\n email=remote_message['author'].get('email'))\n if account.username != app.config.username:\n new_message = True\n else:\n account = session.getSystemAccount()\n message = session.getMessageByID(remote_message['id'])\n if not message:\n revision = session.getRevisionByNumber(change, remote_message.get('_revision_number', 1))\n if revision:\n # Normalize date -> created\n created = dateutil.parser.parse(remote_message['date'])\n message = revision.createMessage(remote_message['id'], account, created,\n remote_message['message'])\n self.log.info(\"Created new review message %s for revision %s in local DB.\", message.key, revision.key)\n else:\n self.log.info(\"Unable to create new review message for revision %s because it is not in local DB (draft?).\", remote_message.get('_revision_number'))\n else:\n if message.author != account:\n message.author = account\n remote_approval_entries = {}\n remote_label_entries = {}\n user_voted = False\n for remote_label_name, remote_label_dict in remote_change.get('labels', {}).items():\n for remote_approval in remote_label_dict.get('all', []):\n if remote_approval.get('value') is None:\n continue\n remote_approval['category'] = remote_label_name\n key = '%s~%s' % (remote_approval['category'], remote_approval['_account_id'])\n remote_approval_entries[key] = remote_approval\n if remote_approval['_account_id'] == sync.account_id and int(remote_approval['value']) != 0:\n user_voted = True\n for key, value in remote_label_dict.get('values', {}).items():\n # +1: \"LGTM\"\n label = dict(value=key,\n description=value,\n category=remote_label_name)\n key = '%s~%s~%s' % (label['category'], label['value'], label['description'])\n remote_label_entries[key] = label\n remote_approval_keys = set(remote_approval_entries.keys())\n remote_label_keys = set(remote_label_entries.keys())\n local_approvals = {}\n local_labels = {}\n user_votes = {}\n for approval in change.approvals:\n if approval.draft and not new_revision:\n # If we have a new revision, we need to delete\n # draft local approvals because they can no longer\n # be uploaded. Otherwise, keep them because we\n # may be about to upload a review. Ignoring an\n # approval here means it will not be deleted.\n # Also keep track of these approvals so we can\n # determine whether we should hold the change\n # later.\n user_votes[approval.category] = approval.value\n # Count draft votes as having voted for the\n # purposes of deciding whether to clear the\n # reviewed flag later.\n user_voted = True\n continue\n key = '%s~%s' % (approval.category, approval.reviewer.id)\n if key in local_approvals:\n # Delete duplicate approvals.\n session.delete(approval)\n else:\n local_approvals[key] = approval\n local_approval_keys = set(local_approvals.keys())\n for label in change.labels:\n key = '%s~%s~%s' % (label.category, label.value, label.description)\n local_labels[key] = label\n local_label_keys = set(local_labels.keys())\n\n for key in local_approval_keys-remote_approval_keys:\n session.delete(local_approvals[key])\n\n for key in local_label_keys-remote_label_keys:\n session.delete(local_labels[key])\n\n for key in remote_approval_keys-local_approval_keys:\n remote_approval = remote_approval_entries[key]\n account = session.getAccountByID(remote_approval['_account_id'],\n name=remote_approval.get('name'),\n username=remote_approval.get('username'),\n email=remote_approval.get('email'))\n change.createApproval(account,\n remote_approval['category'],\n remote_approval['value'])\n self.log.info(\"Created approval for change %s in local DB.\", change.id)\n user_value = user_votes.get(remote_approval['category'], 0)\n if user_value > 0 and remote_approval['value'] < 0:\n # Someone left a negative vote after the local\n # user created a draft positive vote. Hold the\n # change so that it doesn't look like the local\n # user is ignoring negative feedback.\n if not change.held:\n change.held = True\n result.held_changed = True\n self.log.info(\"Setting change %s to held due to negative review after positive\", change.id)\n\n for key in remote_label_keys-local_label_keys:\n remote_label = remote_label_entries[key]\n change.createLabel(remote_label['category'],\n remote_label['value'],\n remote_label['description'])\n\n for key in remote_approval_keys.intersection(local_approval_keys):\n local_approval = local_approvals[key]\n remote_approval = remote_approval_entries[key]\n local_approval.value = remote_approval['value']\n # For the side effect of updating account info:\n account = session.getAccountByID(remote_approval['_account_id'],\n name=remote_approval.get('name'),\n username=remote_approval.get('username'),\n email=remote_approval.get('email'))\n\n remote_permitted_entries = {}\n for remote_label_name, remote_label_values in remote_change.get('permitted_labels', {}).items():\n for remote_label_value in remote_label_values:\n remote_label = dict(category=remote_label_name,\n value=remote_label_value)\n key = '%s~%s' % (remote_label['category'], remote_label['value'])\n remote_permitted_entries[key] = remote_label\n remote_permitted_keys = set(remote_permitted_entries.keys())\n local_permitted = {}\n for permitted in change.permitted_labels:\n key = '%s~%s' % (permitted.category, permitted.value)\n local_permitted[key] = permitted\n local_permitted_keys = set(local_permitted.keys())\n\n for key in local_permitted_keys-remote_permitted_keys:\n session.delete(local_permitted[key])\n\n for key in remote_permitted_keys-local_permitted_keys:\n remote_permitted = remote_permitted_entries[key]\n change.createPermittedLabel(remote_permitted['category'],\n remote_permitted['value'])\n\n if not user_voted:\n # Only consider changing the reviewed state if we don't have a vote\n if new_revision or new_message:\n if change.reviewed:\n change.reviewed = False\n result.review_flag_changed = True\n app.project_cache.clear(change.project)\n for url, refs in fetches.items():\n self.log.debug(\"Fetching from %s with refs %s\", url, refs)\n try:\n repo.fetch(url, refs)\n except Exception:\n # Backwards compat with GitPython before the multi-ref fetch\n # patch.\n # (https://github.com/gitpython-developers/GitPython/pull/170)\n for ref in refs:\n self.log.debug(\"git fetch %s %s\" % (url, ref))\n repo.fetch(url, ref)\n end_time = time.time()\n total_time = end_time - start_time\n self.log.info(\"Synced change %s in %0.5f seconds.\", self.change_id, total_time)", "metadata": "root.SyncChangeTask.run", "header": "['class', 'SyncChangeTask', '(', 'Task', ')', ':', '___EOS___']", "index": 538 }, { "content": " def run(self, sync):\n app = sync.app\n with app.db.getSession() as session:\n projects = session.getProjects(subscribed=True)\n for project in projects:\n try:\n missing = False\n try:\n repo = gitrepo.get_repo(project.name, app.config)\n except gitrepo.GitCloneError:\n missing = True\n if missing or app.fetch_missing_refs:\n sync.submitTask(CheckRevisionsTask(project.key,\n priority=LOW_PRIORITY))\n except Exception:\n self.log.exception(\"Exception checking repo %s\" %\n (project.name,))", "metadata": "root.CheckReposTask.run", "header": "['class', 'CheckReposTask', '(', 'Task', ')', ':', '___NEWLINE___', '# on startup, check all projects', '___NL___', '# for any subscribed project withot a local repo or if', '___NL___', '# --fetch-missing-refs is supplied, check all local changes for', '___NL___', '# missing refs, and sync the associated changes', '___NL___', '___EOS___']", "index": 880 } ]
[ { "span": "account ", "start_line": 818, "start_column": 16, "end_line": 818, "end_column": 23 }, { "span": "repo ", "start_line": 888, "start_column": 20, "end_line": 888, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sync", "Change", "Task_", "(_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "sync_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "sync_", "._", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "change_", "=_", "sync_", "._", "get_", "(_", "'", "change", "s", "/", "%", "s", "?", "o", "=", "DETAIL", "ED", "\\u", "LAB", "ELS", "&", "o", "=", "ALL", "\\u", "REVISION", "S", "&", "o", "=", "ALL", "\\u", "COMMIT", "S", "&", "o", "=", "MESSAGE", "S", "&", "o", "=", "DETAIL", "ED", "\\u", "ACCOUNT", "S", "&", "o", "=", "CURREN", "T", "\\u", "ACTI", "ONS", "&", "o", "=", "ALL", "\\u", "FILE", "S", "'_", "%_", "self_", "._", "change", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Perform", " ", "sub", "querie", "s", " ", "this", " ", "task", " ", "will", " ", "need", " ", "outsi", "de", " ", "of", " ", "the", " ", "db", " ", "session_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "remote", "\\u", "commit_", ",_", "remote", "\\u", "revision_", "in_", "remote", "\\u", "change_", "._", "get_", "(_", "'", "revis", "ion", "s", "'_", ",_", "{_", "}_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "comment", "s", "\\u", "data_", "=_", "sync_", "._", "get_", "(_", "'", "change", "s", "/", "%", "s", "/", "revis", "ion", "s", "/", "%", "s", "/", "comment", "s", "'_", "%_", "(_", "self_", "._", "change", "\\u", "id_", ",_", "remote", "\\u", "commit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "revision_", "[_", "'\\u", "ger", "tt", "y", "\\u", "remote", "\\u", "comment", "s", "\\u", "data", "'_", "]_", "=_", "remote", "\\u", "comment", "s", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "\\u", "conflicts_", "=_", "sync_", "._", "query_", "(_", "[_", "'", "q", "=", "status", ":", "open", "+", "is", ":", "merge", "able", "+", "confl", "icts", ":", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "change_", "[_", "'\\u", "number", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetches", "_", "=_", "collections_", "._", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "commits_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "app_", "._", "db_", "._", "get", "Session_", "(_", ")_", "as_", "session_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change_", "=_", "session_", "._", "get", "Change", "By", "ID_", "(_", "self_", "._", "change", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "account_", "=_", "session_", "._", "get", "Account", "By", "ID_", "(_", "remote", "\\u", "change_", "[_", "'", "owner", "'_", "]_", "[_", "'\\u", "account", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "remote", "\\u", "change_", "[_", "'", "owner", "'_", "]_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "remote", "\\u", "change_", "[_", "'", "owner", "'_", "]_", "._", "get_", "(_", "'", "user", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "email_", "=_", "remote", "\\u", "change_", "[_", "'", "owner", "'_", "]_", "._", "get_", "(_", "'", "email", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "change_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "session_", "._", "get", "Project", "By", "Name_", "(_", "remote", "\\u", "change_", "[_", "'", "project", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "remote", "\\u", "change_", "[_", "'", "created", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updated_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "remote", "\\u", "change_", "[_", "'", "update", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "=_", "project_", "._", "create", "Change_", "(_", "remote", "\\u", "change_", "[_", "'", "id", "'_", "]_", ",_", "account_", ",_", "remote", "\\u", "change_", "[_", "'\\u", "number", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "change_", "[_", "'", "branch", "'_", "]_", ",_", "remote", "\\u", "change_", "[_", "'", "change", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "change_", "[_", "'", "subject", "'_", "]_", ",_", "created_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updated_", ",_", "remote", "\\u", "change_", "[_", "'", "status", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "topic_", "=_", "remote", "\\u", "change_", "._", "get_", "(_", "'", "topic", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Creat", "ed", " ", "new", " ", "change", " ", "%", "s", " ", "in", " ", "local", " ", "DB", ".\"_", ",_", "change_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "Change", "Added", "Event_", "(_", "change_", ")_", "\\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 ", " _", "result_", "=_", "Change", "Update", "d", "Event_", "(_", "change_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app_", "._", "project", "\\u", "cache_", "._", "clear_", "(_", "change_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "results_", "._", "append_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "._", "owner_", "=_", "account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "change_", "._", "status_", "!=_", "remote", "\\u", "change_", "[_", "'", "status", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change_", "._", "status_", "=_", "remote", "\\u", "change_", "[_", "'", "status", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "status", "\\u", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "remote", "\\u", "change_", "._", "get_", "(_", "'", "starred", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change_", "._", "starred", "_", "=_", "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 ", " _", "change_", "._", "starred", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "change_", "._", "subject_", "=_", "remote", "\\u", "change_", "[_", "'", "subject", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "._", "updated_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "remote", "\\u", "change_", "[_", "'", "update", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "._", "topic_", "=_", "remote", "\\u", "change_", "._", "get_", "(_", "'", "topic", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unse", "en", "\\u", "conflicts_", "=_", "[_", "x_", "._", "id_", "for_", "x_", "in_", "change_", "._", "conflicts_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "remote", "\\u", "conflict_", "in_", "remote", "\\u", "conflicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "confl", "ict", "\\u", "id_", "=_", "remote", "\\u", "conflict_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conflict_", "=_", "session_", "._", "get", "Change", "By", "ID_", "(_", "confl", "ict", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "conflict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Ne", "ed", " ", "to", " ", "sync", " ", "conflicting", " ", "change", " ", "%", "s", " ", "for", " ", "change", " ", "%", "s", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "confl", "ict", "\\u", "id_", ",_", "change_", "._", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sync_", "._", "submit", "Task_", "(_", "Sync", "Change", "Task_", "(_", "confl", "ict", "\\u", "id_", ",_", "priority_", "=_", "self_", "._", "priority_", ")_", ")_", "\\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_", "conflict_", "not_", "in_", "change_", "._", "conflicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "log_", "._", "info_", "(_", "\"", "Added", " ", "confl", "ict", " ", "%", "s", " ", "for", " ", "change", " ", "%", "s", " ", "in", " ", "local", " ", "DB", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conflict_", "._", "number_", ",_", "change_", "._", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "._", "add", "Conflict_", "(_", "conflict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "results_", "._", "append_", "(_", "Change", "Update", "d", "Event_", "(_", "conflict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "confl", "ict", "\\u", "id_", "in_", "unse", "en", "\\u", "conflicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "unse", "en", "\\u", "conflicts_", "._", "remove_", "(_", "confl", "ict", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "confl", "ict", "\\u", "id_", "in_", "unse", "en", "\\u", "conflicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conflict_", "=_", "session_", "._", "get", "Change", "By", "ID_", "(_", "confl", "ict", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Delete", "d", " ", "confl", "ict", " ", "%", "s", " ", "for", " ", "change", " ", "%", "s", " ", "in", " ", "local", " ", "DB", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conflict_", "._", "number_", ",_", "change_", "._", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "._", "del", "Conflict_", "(_", "conflict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "results_", "._", "append_", "(_", "Change", "Update", "d", "Event_", "(_", "conflict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo_", "=_", "git", "repo_", "._", "get", "\\u", "repo_", "(_", "change_", "._", "project_", "._", "name_", ",_", "app_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "revision_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "remote", "\\u", "commit_", ",_", "remote", "\\u", "revision_", "in_", "remote", "\\u", "change_", "._", "get_", "(_", "'", "revis", "ion", "s", "'_", ",_", "{_", "}_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "revision_", "=_", "session_", "._", "get", "Revi", "sion", "By", "Commit_", "(_", "remote", "\\u", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "handle", " ", "multiple", " ", "parents_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "sync_", "._", "app_", "._", "config_", "._", "git", "\\u", "url_", "+_", "change_", "._", "project_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "anonym", "ous", " ", "http", "'_", "in_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ref_", "=_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", "[_", "'", "anonym", "ous", " ", "http", "'_", "]_", "[_", "'", "ref", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", "[_", "'", "anonym", "ous", " ", "http", "'_", "]_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "http", "'_", "in_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "auth_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref_", "=_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", "[_", "'", "http", "'_", "]_", "[_", "'", "ref", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "list_", "(_", "urlparse_", "._", "urlsplit_", "(_", "sync_", "._", "app_", "._", "config_", "._", "url_", "+_", "change_", "._", "project_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "[_", "1_", "]_", "=_", "'%", "s", ":", "%", "s", "@", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "urlparse_", "._", "quote", "\\u", "plus_", "(_", "sync_", "._", "app_", "._", "config_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "urlparse_", "._", "quote", "\\u", "plus_", "(_", "sync_", "._", "app_", "._", "config_", "._", "password_", ")_", ",_", "url_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "urlparse_", "._", "urlu", "nsp", "lit_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "ssh", "'_", "in_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ref_", "=_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", "[_", "'", "ssh", "'_", "]_", "[_", "'", "ref", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", "[_", "'", "ssh", "'_", "]_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "git", "'_", "in_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ref_", "=_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", "[_", "'", "git", "'_", "]_", "[_", "'", "ref", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", "[_", "'", "git", "'_", "]_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "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 ", " ", "_", "if_", "len_", "(_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err", "Message_", "=_", "\"", "No", " ", "support", "ed", " ", "fetch", " ", "method", " ", "found", ".", " ", " ", "Server", " ", "offers", ":", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "',", " ", "'_", "._", "join_", "(_", "remote", "\\u", "revision_", "[_", "'", "fetch", "'_", "]_", "._", "keys_", "(_", ")_", ")_", ")_", "\\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 ", " ", " _", "err", "Message_", "=_", "\"", "The", " ", "server", " ", "is", " ", "missi", "ng", " ", "the", " ", "download", "-", "command", "s", " ", "plugin", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Exception_", "(_", "err", "Message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "revision_", ")_", "or_", "self_", "._", "force", "\\u", "fetch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fetches", "_", "[_", "url_", "]_", "._", "append_", "(_", "'+", "%", "(", "ref", ")", "s", ":", "%", "(", "ref", ")", "s", "'_", "%_", "dict_", "(_", "ref_", "=_", "ref_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "revision_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "revision_", "=_", "change_", "._", "create", "Revision_", "(_", "remote", "\\u", "revision_", "[_", "'\\u", "number", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "revision_", "[_", "'", "commit", "'_", "]_", "[_", "'", "message", "'_", "]_", ",_", "remote", "\\u", "commit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "revision_", "[_", "'", "commit", "'_", "]_", "[_", "'", "parents", "'_", "]_", "[_", "0_", "]_", "[_", "'", "commit", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth_", ",_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Creat", "ed", " ", "new", " ", "revis", "ion", " ", "%", "s", " ", "for", " ", "change", " ", "%", "s", " ", "revis", "ion", " ", "%", "s", " ", "in", " ", "local", " ", "DB", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "._", "key_", ",_", "self_", "._", "change", "\\u", "id_", ",_", "remote", "\\u", "revision_", "[_", "'\\u", "number", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "revision_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "revision_", "._", "message_", "=_", "remote", "\\u", "revision_", "[_", "'", "commit", "'_", "]_", "[_", "'", "message", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "remote", "\\u", "revision_", "._", "get_", "(_", "'", "action", "s", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revision_", "._", "can", "\\u", "submit_", "=_", "'", "submit", "'_", "in_", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "handle", " ", "multiple", " ", "parents_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "revision_", "._", "parent_", "not_", "in_", "parent", "\\u", "commits_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "parent", "\\u", "revision_", "=_", "session_", "._", "get", "Revi", "sion", "By", "Commit_", "(_", "revision_", "._", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "parent", "\\u", "revision_", "and_", "change_", "._", "status_", "not_", "in_", "CLOSED", "\\u", "STATUS", "ES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sync_", "._", "\\u", "sync", "Change", "By", "Commit_", "(_", "revision_", "._", "parent_", ",_", "self_", "._", "priority_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Change", " ", "%", "s", " ", "revis", "ion", " ", "%", "s", " ", "need", "s", " ", "parent", " ", "commit", " ", "%", "s", " ", "synced", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "change_", "._", "id_", ",_", "remote", "\\u", "revision_", "[_", "'\\u", "number", "'_", "]_", ",_", "revision_", "._", "parent_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parent", "\\u", "commits_", "._", "add_", "(_", "revision_", "._", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "update", "Rela", "ted", "Changes_", "(_", "session_", ",_", "change_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "revision_", "._", "get", "File_", "(_", "'/", "COMMIT", "\\u", "MS", "G", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "=_", "revision_", "._", "create", "File_", "(_", "'/", "COMMIT", "\\u", "MS", "G", "'_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "remote", "\\u", "path_", ",_", "remote", "\\u", "file_", "in_", "remote", "\\u", "revision_", "[_", "'", "files", "'_", "]_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "=_", "revision_", "._", "get", "File_", "(_", "remote", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "remote", "\\u", "file_", "._", "get_", "(_", "'", "binar", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inserted", "_", "=_", "deleted_", "=_", "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 ", " ", " _", "inserted", "_", "=_", "remote", "\\u", "file_", "._", "get_", "(_", "'", "lines", "\\u", "inserted", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deleted_", "=_", "remote", "\\u", "file_", "._", "get_", "(_", "'", "lines", "\\u", "delete", "d", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "revision_", "._", "create", "File_", "(_", "remote", "\\u", "path_", ",_", "remote", "\\u", "file_", "._", "get_", "(_", "'", "status", "'_", ",_", "'", "M", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "file_", "._", "get_", "(_", "'", "old", "\\u", "path", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inserted", "_", ",_", "deleted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "\\u", "comment", "s", "\\u", "data_", "=_", "remote", "\\u", "revision_", "[_", "'\\u", "ger", "tt", "y", "\\u", "remote", "\\u", "comment", "s", "\\u", "data", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "remote", "\\u", "file_", ",_", "remote", "\\u", "comments_", "in_", "remote", "\\u", "comment", "s", "\\u", "data_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "remote", "\\u", "comment_", "in_", "remote", "\\u", "comments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "account_", "=_", "session_", "._", "get", "Account", "By", "ID_", "(_", "remote", "\\u", "comment_", "[_", "'", "author", "'_", "]_", "[_", "'\\u", "account", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "remote", "\\u", "comment_", "[_", "'", "author", "'_", "]_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "remote", "\\u", "comment_", "[_", "'", "author", "'_", "]_", "._", "get_", "(_", "'", "user", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "email_", "=_", "remote", "\\u", "comment_", "[_", "'", "author", "'_", "]_", "._", "get_", "(_", "'", "email", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "session_", "._", "get", "Comme", "nt", "By", "ID_", "(_", "remote", "\\u", "comment_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "comment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Normalize", " ", "update", "d", " ", "->", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "created_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "remote", "\\u", "comment_", "[_", "'", "update", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remote", "\\u", "comment_", "._", "get_", "(_", "'", "side", "'_", ",_", "''_", ")_", "==_", "'", "PARENT", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "parent_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fileobj_", "=_", "revision_", "._", "get", "File_", "(_", "remote", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fileobj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fileobj_", "=_", "revision_", "._", "create", "File_", "(_", "remote", "\\u", "file_", ",_", "'", "M", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "comment_", "=_", "fileobj_", "._", "create", "Comment_", "(_", "remote", "\\u", "comment_", "[_", "'", "id", "'_", "]_", ",_", "account_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "comment_", "._", "get_", "(_", "'", "in", "\\u", "repl", "y", "\\u", "to", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "created_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", ",_", "remote", "\\u", "comment_", "._", "get_", "(_", "'", "line", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "comment_", "[_", "'", "message", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Creat", "ed", " ", "new", " ", "comment", " ", "%", "s", " ", "for", " ", "revis", "ion", " ", "%", "s", " ", "in", " ", "local", " ", "DB", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comment_", "._", "key_", ",_", "revision_", "._", "key_", ")_", "\\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_", "comment_", "._", "author_", "!=_", "account_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "comment_", "._", "author_", "=_", "account_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "message_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "remote", "\\u", "message_", "in_", "remote", "\\u", "change_", "._", "get_", "(_", "'", "message", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "author", "'_", "in_", "remote", "\\u", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "account_", "=_", "session_", "._", "get", "Account", "By", "ID_", "(_", "remote", "\\u", "message_", "[_", "'", "author", "'_", "]_", "[_", "'\\u", "account", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "remote", "\\u", "message_", "[_", "'", "author", "'_", "]_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "remote", "\\u", "message_", "[_", "'", "author", "'_", "]_", "._", "get_", "(_", "'", "user", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "email_", "=_", "remote", "\\u", "message_", "[_", "'", "author", "'_", "]_", "._", "get_", "(_", "'", "email", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "account_", "._", "username_", "!=_", "app_", "._", "config_", "._", "username_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "new", "\\u", "message_", "=_", "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 ", " ", "_", "account_", "=_", "session_", "._", "get", "System", "Account_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "session_", "._", "get", "Messag", "e", "By", "ID_", "(_", "remote", "\\u", "message_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "revision_", "=_", "session_", "._", "get", "Revi", "sion", "By", "Number_", "(_", "change_", ",_", "remote", "\\u", "message_", "._", "get_", "(_", "'\\u", "revis", "ion", "\\u", "number", "'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "revision_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Normalize", " ", "date", " ", "->", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "created_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "remote", "\\u", "message_", "[_", "'", "date", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "revision_", "._", "create", "Message_", "(_", "remote", "\\u", "message_", "[_", "'", "id", "'_", "]_", ",_", "account_", ",_", "created_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "message_", "[_", "'", "message", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Creat", "ed", " ", "new", " ", "review", " ", "message", " ", "%", "s", " ", "for", " ", "revis", "ion", " ", "%", "s", " ", "in", " ", "local", " ", "DB", ".\"_", ",_", "message_", "._", "key_", ",_", "revision_", "._", "key_", ")_", "\\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_", "._", "log_", "._", "info_", "(_", "\"", "Una", "ble", " ", "to", " ", "create", " ", "new", " ", "review", " ", "message", " ", "for", " ", "revis", "ion", " ", "%", "s", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "not", " ", "in", " ", "local", " ", "DB", " ", "(", "draft", "?)", ".\"_", ",_", "remote", "\\u", "message_", "._", "get_", "(_", "'\\u", "revis", "ion", "\\u", "number", "'_", ")_", ")_", "\\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_", "message_", "._", "author_", "!=_", "account_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "message_", "._", "author_", "=_", "account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "\\u", "approval", "\\u", "entries_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "label", "\\u", "entries_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "vote", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "remote", "\\u", "label", "\\u", "name_", ",_", "remote", "\\u", "label", "\\u", "dict_", "in_", "remote", "\\u", "change_", "._", "get_", "(_", "'", "labels", "'_", ",_", "{_", "}_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "remote", "\\u", "approval", "_", "in_", "remote", "\\u", "label", "\\u", "dict_", "._", "get_", "(_", "'", "all", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "remote", "\\u", "approval", "_", "._", "get_", "(_", "'", "value", "'_", ")_", "is_", "None_", ":_", "\\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_", "remote", "\\u", "approval", "_", "[_", "'", "category", "'_", "]_", "=_", "remote", "\\u", "label", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "'%", "s", "~", "%", "s", "'_", "%_", "(_", "remote", "\\u", "approval", "_", "[_", "'", "category", "'_", "]_", ",_", "remote", "\\u", "approval", "_", "[_", "'\\u", "account", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "approval", "\\u", "entries_", "[_", "key_", "]_", "=_", "remote", "\\u", "approval", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remote", "\\u", "approval", "_", "[_", "'\\u", "account", "\\u", "id", "'_", "]_", "==_", "sync_", "._", "account", "\\u", "id_", "and_", "int_", "(_", "remote", "\\u", "approval", "_", "[_", "'", "value", "'_", "]_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user", "\\u", "vote", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "remote", "\\u", "label", "\\u", "dict_", "._", "get_", "(_", "'", "values", "'_", ",_", "{_", "}_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "+", "1", ":", " ", "\"", "LG", "TM", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "label_", "=_", "dict_", "(_", "value_", "=_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "category_", "=_", "remote", "\\u", "label", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "'%", "s", "~", "%", "s", "~", "%", "s", "'_", "%_", "(_", "label_", "[_", "'", "category", "'_", "]_", ",_", "label_", "[_", "'", "value", "'_", "]_", ",_", "label_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "label", "\\u", "entries_", "[_", "key_", "]_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "\\u", "approval", "\\u", "keys_", "=_", "set_", "(_", "remote", "\\u", "approval", "\\u", "entries_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "label", "\\u", "keys_", "=_", "set_", "(_", "remote", "\\u", "label", "\\u", "entries_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "approval", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "labels_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "votes_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "approval", "_", "in_", "change_", "._", "approval", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "approval", "_", "._", "draft_", "and_", "not_", "new", "\\u", "revision_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "a", " ", "new", " ", "revis", "ion", ",", " ", "we", " ", "need", " ", "to", " ", "delete_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "draft", " ", "local", " ", "approval", "s", " ", "bec", "aus", "e", " ", "the", "y", " ", "can", " ", "no", " ", "long", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "uploade", "d", ".", " ", " ", "Ot", "her", "wis", "e", ",", " ", "keep", " ", "them", " ", "bec", "aus", "e", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "be", " ", "abo", "ut", " ", "to", " ", "upload", " ", "a", " ", "review", ".", " ", " ", "Ignor", "ing", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "approval", " ", "here", " ", "means", " ", "it", " ", "will", " ", "not", " ", "be", " ", "delete", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "so", " ", "keep", " ", "track", " ", "of", " ", "these", " ", "approval", "s", " ", "so", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "whe", "ther", " ", "we", " ", "shou", "ld", " ", "hold", " ", "the", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "user", "\\u", "votes_", "[_", "approval", "_", "._", "category_", "]_", "=_", "approval", "_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Count", " ", "draft", " ", "vote", "s", " ", "as", " ", "hav", "ing", " ", "vote", "d", " ", "for", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "purpose", "s", " ", "of", " ", "deci", "ding", " ", "whe", "ther", " ", "to", " ", "clear", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reviewe", "d", " ", "flag", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "vote", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "'%", "s", "~", "%", "s", "'_", "%_", "(_", "approval", "_", "._", "category_", ",_", "approval", "_", "._", "reviewer", "_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "in_", "local", "\\u", "approval", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Delete", " ", "duplicat", "e", " ", "approval", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "session_", "._", "delete_", "(_", "approval", "_", ")_", "\\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 ", " ", "_", "local", "\\u", "approval", "s_", "[_", "key_", "]_", "=_", "approval", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "local", "\\u", "approval", "\\u", "keys_", "=_", "set_", "(_", "local", "\\u", "approval", "s_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "label_", "in_", "change_", "._", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "'%", "s", "~", "%", "s", "~", "%", "s", "'_", "%_", "(_", "label_", "._", "category_", ",_", "label_", "._", "value_", ",_", "label_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "labels_", "[_", "key_", "]_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "local", "\\u", "label", "\\u", "keys_", "=_", "set_", "(_", "local", "\\u", "labels_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "local", "\\u", "approval", "\\u", "keys_", "-_", "remote", "\\u", "approval", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "._", "delete_", "(_", "local", "\\u", "approval", "s_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "local", "\\u", "label", "\\u", "keys_", "-_", "remote", "\\u", "label", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "._", "delete_", "(_", "local", "\\u", "labels_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "remote", "\\u", "approval", "\\u", "keys_", "-_", "local", "\\u", "approval", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "approval", "_", "=_", "remote", "\\u", "approval", "\\u", "entries_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "account_", "=_", "session_", "._", "get", "Account", "By", "ID_", "(_", "remote", "\\u", "approval", "_", "[_", "'\\u", "account", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "remote", "\\u", "approval", "_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "remote", "\\u", "approval", "_", "._", "get_", "(_", "'", "user", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "email_", "=_", "remote", "\\u", "approval", "_", "._", "get_", "(_", "'", "email", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "._", "create", "Approval", "_", "(_", "account_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "approval", "_", "[_", "'", "category", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "approval", "_", "[_", "'", "value", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Creat", "ed", " ", "approval", " ", "for", " ", "change", " ", "%", "s", " ", "in", " ", "local", " ", "DB", ".\"_", ",_", "change_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "value_", "=_", "user", "\\u", "votes_", "._", "get_", "(_", "remote", "\\u", "approval", "_", "[_", "'", "category", "'_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user", "\\u", "value_", ">_", "0_", "and_", "remote", "\\u", "approval", "_", "[_", "'", "value", "'_", "]_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", "one", " ", "left", " ", "a", " ", "negati", "ve", " ", "vote", " ", "after", " ", "the", " ", "local_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "created", " ", "a", " ", "draft", " ", "posit", "ive", " ", "vote", ".", " ", " ", "Hold", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", " ", "so", " ", "tha", "t", " ", "it", " ", "doe", "sn", "'", "t", " ", "look", " ", "like", " ", "the", " ", "local_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "is", " ", "ign", "orin", "g", " ", "negati", "ve", " ", "feed", "back", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "change_", "._", "hel", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "change_", "._", "hel", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "hel", "d\\u", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Sett", "ing", " ", "change", " ", "%", "s", " ", "to", " ", "hel", "d", " ", "due", " ", "to", " ", "negati", "ve", " ", "review", " ", "after", " ", "posit", "ive", "\"_", ",_", "change_", "._", "id_", ")_", "\\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_", "key_", "in_", "remote", "\\u", "label", "\\u", "keys_", "-_", "local", "\\u", "label", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "label_", "=_", "remote", "\\u", "label", "\\u", "entries_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "._", "create", "Label_", "(_", "remote", "\\u", "label_", "[_", "'", "category", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "label_", "[_", "'", "value", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "label_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "remote", "\\u", "approval", "\\u", "keys_", "._", "intersection_", "(_", "local", "\\u", "approval", "\\u", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "\\u", "approval", "_", "=_", "local", "\\u", "approval", "s_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "approval", "_", "=_", "remote", "\\u", "approval", "\\u", "entries_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "approval", "_", "._", "value_", "=_", "remote", "\\u", "approval", "_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "the", " ", "side", " ", "effect", " ", "of", " ", "updat", "ing", " ", "account", " ", "info", ":_", "\\u\\u\\uNL\\u\\u\\u_", "account_", "=_", "session_", "._", "get", "Account", "By", "ID_", "(_", "remote", "\\u", "approval", "_", "[_", "'\\u", "account", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "remote", "\\u", "approval", "_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "remote", "\\u", "approval", "_", "._", "get_", "(_", "'", "user", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "email_", "=_", "remote", "\\u", "approval", "_", "._", "get_", "(_", "'", "email", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "\\u", "permit", "ted", "\\u", "entries_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "remote", "\\u", "label", "\\u", "name_", ",_", "remote", "\\u", "label", "\\u", "values_", "in_", "remote", "\\u", "change_", "._", "get_", "(_", "'", "permit", "ted", "\\u", "labels", "'_", ",_", "{_", "}_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "remote", "\\u", "label", "\\u", "value_", "in_", "remote", "\\u", "label", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "remote", "\\u", "label_", "=_", "dict_", "(_", "category_", "=_", "remote", "\\u", "label", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "remote", "\\u", "label", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "'%", "s", "~", "%", "s", "'_", "%_", "(_", "remote", "\\u", "label_", "[_", "'", "category", "'_", "]_", ",_", "remote", "\\u", "label_", "[_", "'", "value", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "permit", "ted", "\\u", "entries_", "[_", "key_", "]_", "=_", "remote", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "\\u", "permit", "ted", "\\u", "keys_", "=_", "set_", "(_", "remote", "\\u", "permit", "ted", "\\u", "entries_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "permit", "ted_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "permit", "ted_", "in_", "change_", "._", "permit", "ted", "\\u", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "'%", "s", "~", "%", "s", "'_", "%_", "(_", "permit", "ted_", "._", "category_", ",_", "permit", "ted_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "permit", "ted_", "[_", "key_", "]_", "=_", "permit", "ted_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "local", "\\u", "permit", "ted", "\\u", "keys_", "=_", "set_", "(_", "local", "\\u", "permit", "ted_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "local", "\\u", "permit", "ted", "\\u", "keys_", "-_", "remote", "\\u", "permit", "ted", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "._", "delete_", "(_", "local", "\\u", "permit", "ted_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "remote", "\\u", "permit", "ted", "\\u", "keys_", "-_", "local", "\\u", "permit", "ted", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "permit", "ted_", "=_", "remote", "\\u", "permit", "ted", "\\u", "entries_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change_", "._", "create", "Permi", "tted", "Label_", "(_", "remote", "\\u", "permit", "ted_", "[_", "'", "category", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "permit", "ted_", "[_", "'", "value", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "user", "\\u", "vote", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "consider", " ", "chang", "ing", " ", "the", " ", "reviewe", "d", " ", "state", " ", "if", " ", "we", " ", "don", "'", "t", " ", "have", " ", "a", " ", "vote_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "new", "\\u", "revision_", "or_", "new", "\\u", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "change_", "._", "reviewe", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "change_", "._", "reviewe", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "review", "\\u", "flag", "\\u", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "project", "\\u", "cache_", "._", "clear_", "(_", "change_", "._", "project_", ")_", "\\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_", "for_", "url_", ",_", "refs_", "in_", "fetches", "_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Fe", "tch", "ing", " ", "from", " ", "%", "s", " ", "with", " ", "refs", " ", "%", "s", "\"_", ",_", "url_", ",_", "refs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo_", "._", "fetch_", "(_", "url_", ",_", "refs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Backward", "s", " ", "compa", "t", " ", "with", " ", "Git", "Pyth", "on", " ", "bef", "ore", " ", "the", " ", "multi", "-", "ref", " ", "fetch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "patch", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "https", "://", "git", "hub", ".", "com", "/", "git", "python", "-", "developer", "s", "/", "Git", "Pyth", "on", "/", "pull", "/", "170", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ref_", "in_", "refs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "git", " ", "fetch", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "url_", ",_", "ref_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "fetch_", "(_", "url_", ",_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "time_", "=_", "end", "\\u", "time_", "-_", "start", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "\"", "Sync", "ed", " ", "change", " ", "%", "s", " ", "in", " ", "%", "0.", "5f", " ", "second", "s", ".\"_", ",_", "self_", "._", "change", "\\u", "id_", ",_", "total", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Check", "Repos", "Task_", "(_", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "on", " ", "start", "up", ",", " ", "check", " ", "all", " ", "projects_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "for", " ", "any", " ", "subscribed", " ", "project", " ", "with", "ot", " ", "a", " ", "local", " ", "repo", " ", "or", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "--", "fetch", "-", "missi", "ng", "-", "refs", " ", "is", " ", "supplie", "d", ",", " ", "check", " ", "all", " ", "local", " ", "change", "s", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "missi", "ng", " ", "refs", ",", " ", "and", " ", "sync", " ", "the", " ", "associate", "d", " ", "changes_", "\\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_", "run_", "(_", "self_", ",_", "sync_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "sync_", "._", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "app_", "._", "db_", "._", "get", "Session_", "(_", ")_", "as_", "session_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "projects_", "=_", "session_", "._", "get", "Project", "s_", "(_", "subscribed", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "project_", "in_", "projects_", ":_", "\\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 ", " _", "missing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "repo_", "=_", "git", "repo_", "._", "get", "\\u", "repo_", "(_", "project_", "._", "name_", ",_", "app_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "git", "repo_", "._", "Git", "Clone", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "missing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "missing_", "or_", "app_", "._", "fetch", "\\u", "missi", "ng", "\\u", "refs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sync_", "._", "submit", "Task_", "(_", "Check", "Revi", "sion", "s", "Task_", "(_", "project_", "._", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "priority_", "=_", "LOW", "\\u", "PRIORITY", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "exception_", "(_", "\"", "Except", "ion", " ", "checking", " ", "repo", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "project_", "._", "name_", ",_", ")_", ")_", "\\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 ]
Unused import
pyGrowler/Growler/growler/middleware/logger.py
[ { "content": "#\n# growler/middleware/logger.py\n#\n# flake8: noqa\n#\n\nimport logging\nimport asyncio\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Logger:\n\n # Not pep8 but much better!\n DEFAULT = '/033[30m'\n RED = '/033[31m'\n GREEN = '/033[32m'\n YELLOW = '/033[33m'\n BLUE = '/033[34m'\n MAGENTA = '/033[35m'\n CYAN = '/033[36m'\n WHITE = '/033[37m'\n\n\n\n\n\n\n", "metadata": "root.Logger", "header": "['module', '___EOS___']", "index": 10 }, { "content": " @classmethod\n def c(cls, color, msg):\n return \"%s%s%s\" % (color, msg, cls.DEFAULT)", "metadata": "root.Logger.c", "header": "['class', 'Logger', ':', '___NEWLINE___', '___NL___', '# Not pep8 but much better!', '___NL___', '___EOS___']", "index": 22 }, { "content": " def __init__(self):\n pass", "metadata": "root.Logger.__init__", "header": "['class', 'Logger', ':', '___NEWLINE___', '___NL___', '# Not pep8 but much better!', '___NL___', '___EOS___']", "index": 26 }, { "content": " def info(self, message):\n logging.info(c(self.CYAN, \" info \", message))", "metadata": "root.Logger.info", "header": "['class', 'Logger', ':', '___NEWLINE___', '___NL___', '# Not pep8 but much better!', '___NL___', '___EOS___']", "index": 29 }, { "content": " def warn(self, message):\n logging.warn(c(self.YELLOW, \" WARNING \", message))", "metadata": "root.Logger.warn", "header": "['class', 'Logger', ':', '___NEWLINE___', '___NL___', '# Not pep8 but much better!', '___NL___', '___EOS___']", "index": 32 }, { "content": " def error(self, message):\n logging.error(\" ERROR \", message)", "metadata": "root.Logger.error", "header": "['class', 'Logger', ':', '___NEWLINE___', '___NL___', '# Not pep8 but much better!', '___NL___', '___EOS___']", "index": 35 }, { "content": " def critical_error(self, message):\n logging.error(\" ERROR \", message)", "metadata": "root.Logger.critical_error", "header": "['class', 'Logger', ':', '___NEWLINE___', '___NL___', '# Not pep8 but much better!', '___NL___', '___EOS___']", "index": 38 }, { "content": " def __call__(self, req, res):\n logging.info(\"Connection from {}\".format(req.ip))\n req.log = self", "metadata": "root.Logger.__call__", "header": "['class', 'Logger', ':', '___NEWLINE___', '___NL___', '# Not pep8 but much better!', '___NL___', '___EOS___']", "index": 41 } ]
[ { "span": "import asyncio", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "grow", "ler", "/", "middle", "ware", "/", "logg", "er", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flake", "8", ":", " ", "no", "qa_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "asyncio_", "\\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_", "Logger_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "pep", "8", " ", "but", " ", "muc", "h", " ", "bett", "er", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DEFAULT_", "=_", "'/", "033", "[", "30", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RED_", "=_", "'/", "033", "[", "3", "1", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GREEN_", "=_", "'/", "033", "[", "32", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "YELLOW_", "=_", "'/", "033", "[", "3", "3", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BLUE_", "=_", "'/", "033", "[", "3", "4", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAGE", "NTA", "_", "=_", "'/", "033", "[", "3", "5", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CYAN_", "=_", "'/", "033", "[", "3", "6", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WHITE_", "=_", "'/", "033", "[", "3", "7", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Logger_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "pep", "8", " ", "but", " ", "muc", "h", " ", "bett", "er", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "c_", "(_", "cls_", ",_", "color_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "s", "%", "s", "%", "s", "\"_", "%_", "(_", "color_", ",_", "msg_", ",_", "cls_", "._", "DEFAULT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logger_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "pep", "8", " ", "but", " ", "muc", "h", " ", "bett", "er", "!", "_", "\\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_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logger_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "pep", "8", " ", "but", " ", "muc", "h", " ", "bett", "er", "!", "_", "\\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_", "info_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "c_", "(_", "self_", "._", "CYAN_", ",_", "\"", " ", " ", "info", " ", " ", "\"_", ",_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logger_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "pep", "8", " ", "but", " ", "muc", "h", " ", "bett", "er", "!", "_", "\\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_", "warn_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "c_", "(_", "self_", "._", "YELLOW_", ",_", "\"", " ", " ", "WARN", "ING", " ", " ", "\"_", ",_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logger_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "pep", "8", " ", "but", " ", "muc", "h", " ", "bett", "er", "!", "_", "\\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_", "error_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", " ", " ", "ERROR", " ", " ", "\"_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logger_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "pep", "8", " ", "but", " ", "muc", "h", " ", "bett", "er", "!", "_", "\\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_", "critic", "al", "\\u", "error_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", " ", " ", "ERROR", " ", " ", "\"_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logger_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "pep", "8", " ", "but", " ", "muc", "h", " ", "bett", "er", "!", "_", "\\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_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "req_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Connect", "ion", " ", "from", " ", "{}\"_", "._", "format_", "(_", "req_", "._", "ip_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "log_", "=_", "self_" ]
[ 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, 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, 4, 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 ]
Variable defined multiple times
an0/Letterpress/code/markdown2/lib/markdown2.py
[ { "content": " def _do_links(self, text):\n \"\"\"Turn Markdown link shortcuts into XHTML <a> and <img> tags.\n\n This is a combination of Markdown.pl's _DoAnchors() and\n _DoImages(). They are done together because that simplified the\n approach. It was necessary to use a different approach than\n Markdown.pl because of the lack of atomic matching support in\n Python's regex engine used in $g_nested_brackets.\n \"\"\"\n MAX_LINK_TEXT_SENTINEL = 3000 # markdown2 issue 24\n\n # `anchor_allowed_pos` is used to support img links inside\n # anchors, but not anchors inside anchors. An anchor's start\n # pos must be `>= anchor_allowed_pos`.\n anchor_allowed_pos = 0\n\n curr_pos = 0\n while True: # Handle the next link.\n # The next '[' is the start of:\n # - an inline anchor: [text](url \"title\")\n # - a reference anchor: [text][id]\n # - an inline img: ![text](url \"title\")\n # - a reference img: ![text][id]\n # - a footnote ref: [^id]\n # (Only if 'footnotes' extra enabled)\n # - a footnote defn: [^id]: ...\n # (Only if 'footnotes' extra enabled) These have already\n # been stripped in _strip_footnote_definitions() so no\n # need to watch for them.\n # - a link definition: [id]: url \"title\"\n # These have already been stripped in\n # _strip_link_definitions() so no need to watch for them.\n # - not markup: [...anything else...\n try:\n start_idx = text.index('[', curr_pos)\n except ValueError:\n break\n text_length = len(text)\n\n # Find the matching closing ']'.\n # Markdown.pl allows *matching* brackets in link text so we\n # will here too. Markdown.pl *doesn't* currently allow\n # matching brackets in img alt text -- we'll differ in that\n # regard.\n bracket_depth = 0\n for p in range(start_idx+1, min(start_idx+MAX_LINK_TEXT_SENTINEL,\n text_length)):\n ch = text[p]\n if ch == ']':\n bracket_depth -= 1\n if bracket_depth < 0:\n break\n elif ch == '[':\n bracket_depth += 1\n else:\n # Closing bracket not found within sentinel length.\n # This isn't markup.\n curr_pos = start_idx + 1\n continue\n link_text = text[start_idx+1:p]\n\n # Possibly a footnote ref?\n if \"footnotes\" in self.extras and link_text.startswith(\"^\"):\n normed_id = re.sub(r'\\W', '-', link_text[1:])\n if normed_id in self.footnotes:\n self.footnote_ids.append(normed_id)\n result = '<sup class=\"footnote-ref\" id=\"fnref-%s\">' \\\n '<a href=\"#fn-%s\">%s</a></sup>' \\\n % (normed_id, normed_id, len(self.footnote_ids))\n text = text[:start_idx] + result + text[p+1:]\n else:\n # This id isn't defined, leave the markup alone.\n curr_pos = p+1\n continue\n\n # Now determine what this is by the remainder.\n p += 1\n if p == text_length:\n return text\n\n # Inline anchor or img?\n if text[p] == '(': # attempt at perf improvement\n url, title, url_end_idx = self._extract_url_and_title(text, p)\n if url is not None:\n # Handle an inline anchor or img.\n is_img = start_idx > 0 and text[start_idx-1] == \"!\"\n if is_img:\n start_idx -= 1\n\n # We've got to encode these to avoid conflicting\n # with italics/bold.\n url = url.replace('*', self._escape_table['*']) \\\n .replace('_', self._escape_table['_'])\n if title:\n title_str = ' title=\"%s\"' % (\n _xml_escape_attr(title)\n .replace('*', self._escape_table['*'])\n .replace('_', self._escape_table['_']))\n else:\n title_str = ''\n if is_img:\n img_class_str = self._html_class_str_from_tag(\"img\")\n result = '<img src=\"%s\" alt=\"%s\"%s%s%s' \\\n % (url.replace('\"', '&quot;'),\n _xml_escape_attr(link_text),\n title_str, img_class_str, self.empty_element_suffix)\n if \"smarty-pants\" in self.extras:\n result = result.replace('\"', self._escape_table['\"'])\n curr_pos = start_idx + len(result)\n text = text[:start_idx] + result + text[url_end_idx:]\n elif start_idx >= anchor_allowed_pos:\n result_head = '<a href=\"%s\"%s>' % (url, title_str)\n result = '%s%s</a>' % (result_head, link_text)\n if \"smarty-pants\" in self.extras:\n result = result.replace('\"', self._escape_table['\"'])\n # <img> allowed from curr_pos on, <a> from\n # anchor_allowed_pos on.\n curr_pos = start_idx + len(result_head)\n anchor_allowed_pos = start_idx + len(result)\n text = text[:start_idx] + result + text[url_end_idx:]\n else:\n # Anchor not allowed here.\n curr_pos = start_idx + 1\n continue\n\n # Reference anchor or img?\n else:\n match = self._tail_of_reference_link_re.match(text, p)\n if match:\n # Handle a reference-style anchor or img.\n is_img = start_idx > 0 and text[start_idx-1] == \"!\"\n if is_img:\n start_idx -= 1\n link_id = match.group(\"id\").lower()\n if not link_id:\n link_id = link_text.lower() # for links like [this][]\n if link_id in self.urls:\n url = self.urls[link_id]\n # We've got to encode these to avoid conflicting\n # with italics/bold.\n url = url.replace('*', self._escape_table['*']) \\\n .replace('_', self._escape_table['_'])\n title = self.titles.get(link_id)\n if title:\n before = title\n title = _xml_escape_attr(title) \\\n .replace('*', self._escape_table['*']) \\\n .replace('_', self._escape_table['_'])\n title_str = ' title=\"%s\"' % title\n else:\n title_str = ''\n if is_img:\n img_class_str = self._html_class_str_from_tag(\"img\")\n result = '<img src=\"%s\" alt=\"%s\"%s%s%s' \\\n % (url.replace('\"', '&quot;'),\n link_text.replace('\"', '&quot;'),\n title_str, img_class_str, self.empty_element_suffix)\n if \"smarty-pants\" in self.extras:\n result = result.replace('\"', self._escape_table['\"'])\n curr_pos = start_idx + len(result)\n text = text[:start_idx] + result + text[match.end():]\n elif start_idx >= anchor_allowed_pos:\n result = '<a href=\"%s\"%s>%s</a>' \\\n % (url, title_str, link_text)\n result_head = '<a href=\"%s\"%s>' % (url, title_str)\n result = '%s%s</a>' % (result_head, link_text)\n if \"smarty-pants\" in self.extras:\n result = result.replace('\"', self._escape_table['\"'])\n # <img> allowed from curr_pos on, <a> from\n # anchor_allowed_pos on.\n curr_pos = start_idx + len(result_head)\n anchor_allowed_pos = start_idx + len(result)\n text = text[:start_idx] + result + text[match.end():]\n else:\n # Anchor not allowed here.\n curr_pos = start_idx + 1\n else:\n # This id isn't defined, leave the markup alone.\n curr_pos = match.end()\n continue\n\n # Otherwise, it isn't markup.\n curr_pos = start_idx + 1\n\n return text", "metadata": "root.Markdown._do_links", "header": "['class', 'Markdown', '(', 'object', ')', ':', '___NEWLINE___', '# The dict of \"extras\" to enable in processing -- a mapping of', '___NL___', '# extra name to argument for the extra. Most extras do not have an', '___NL___', '# argument, in which case the value is None.', '___NL___', '#', '___NL___', '# This can be set via (a) subclassing and (b) the constructor', '___NL___', '# \"extras\" argument.', '___NL___', '___EOS___']", "index": 1191 } ]
[ { "span": "result ", "start_line": 1353, "start_column": 28, "end_line": 1353, "end_column": 34 } ]
[ { "span": "result ", "start_line": 1356, "start_column": 28, "end_line": 1356, "end_column": 34 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Markdown", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "dict", " ", "of", " ", "\"", "extra", "s", "\"", " ", "to", " ", "enable", " ", "in", " ", "process", "ing", " ", "--", " ", "a", " ", "mapping", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extra", " ", "name", " ", "to", " ", "argu", "ment", " ", "for", " ", "the", " ", "extra", ".", " ", "Mos", "t", " ", "extra", "s", " ", "do", " ", "not", " ", "have", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", ",", " ", "in", " ", "whi", "ch", " ", "case", " ", "the", " ", "value", " ", "is", " ", "Non", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "can", " ", "be", " ", "set", " ", "via", " ", "(", "a", ")", " ", "subclassing", " ", "and", " ", "(", "b", ")", " ", "the", " ", "constructor_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "extra", "s", "\"", " ", "argu", "ment", "._", "\\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_", "\\u", "do", "\\u", "links_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Turn", " ", "Markdown", " ", "link", " ", "shortcut", "s", " ", "int", "o", " ", "XH", "TML", " ", "<", "a", ">", " ", "and", " ", "<", "img", ">", " ", "tags", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "combinat", "ion", " ", "of", " ", "Markdown", ".", "pl", "'", "s", " ", "\\u", "Do", "Anc", "hor", "s", "()", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "\\u", "Do", "Image", "s", "()", ".", " ", "The", "y", " ", "are", " ", "don", "e", " ", "tog", "ether", " ", "bec", "aus", "e", " ", "tha", "t", " ", "simplified", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "appro", "ach", ".", " ", "It", " ", "was", " ", "necessar", "y", " ", "to", " ", "use", " ", "a", " ", "different", " ", "appro", "ach", " ", "than", "\\", "10", ";", " ", " ", " ", " ", "Markdown", ".", "pl", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "lack", " ", "of", " ", "atomi", "c", " ", "matchi", "ng", " ", "support", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "Pyth", "on", "'", "s", " ", "regex", " ", "eng", "ine", " ", "used", " ", "in", " ", "$", "g", "\\u", "nest", "ed", "\\u", "brackets", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "LINK", "\\u", "TEXT", "\\u", "SENT", "INE", "L_", "=_", "3000_", "#", " ", "mark", "down", "2", " ", "issue", " ", "24_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`", "anchor", "\\u", "allow", "ed", "\\u", "pos", "`", " ", "is", " ", "used", " ", "to", " ", "support", " ", "img", " ", "link", "s", " ", "inside_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anchors", ",", " ", "but", " ", "not", " ", "anchors", " ", "insi", "de", " ", "anchors", ".", " ", "An", " ", "anchor", "'", "s", " ", "start_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pos", " ", "must", " ", "be", " ", "`", ">=", " ", "anchor", "\\u", "allow", "ed", "\\u", "pos", "`.", "_", "\\u\\u\\uNL\\u\\u\\u_", "anchor", "\\u", "allow", "ed", "\\u", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "curr", "\\u", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "#", " ", "Handle", " ", "the", " ", "next", " ", "link", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "next", " ", "'[", "'", " ", "is", " ", "the", " ", "start", " ", "of", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "an", " ", "inline", " ", "anchor", ":", " ", " ", " ", "[", "text", "](", "url", " ", "\"", "title", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "a", " ", "reference", " ", "anchor", ":", " ", "[", "text", "][", "id", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "an", " ", "inline", " ", "img", ":", " ", " ", "![", "text", "](", "url", " ", "\"", "title", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "a", " ", "reference", " ", "img", ":", " ", " ", " ", " ", "![", "text", "][", "id", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "a", " ", "footnote", " ", "ref", ":", " ", "[", "^", "id", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "(", "On", "ly", " ", "if", " ", "'", "footnote", "s", "'", " ", "extra", " ", "enable", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "a", " ", "footnote", " ", "def", "n", ":", " ", " ", " ", " ", "[", "^", "id", "]:", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "(", "On", "ly", " ", "if", " ", "'", "footnote", "s", "'", " ", "extra", " ", "enable", "d", ")", " ", "The", "se", " ", "have", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "bee", "n", " ", "strip", "ped", " ", "in", " ", "\\u", "strip", "\\u", "footnote", "\\u", "definit", "ion", "s", "()", " ", "so", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "need", " ", "to", " ", "watch", " ", "for", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "a", " ", "link", " ", "definit", "ion", ":", " ", " ", "[", "id", "]:", " ", "url", " ", "\"", "title", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "The", "se", " ", "have", " ", "alr", "ead", "y", " ", "bee", "n", " ", "strip", "ped", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\\u", "strip", "\\u", "link", "\\u", "definit", "ion", "s", "()", " ", "so", " ", "no", " ", "need", " ", "to", " ", "watch", " ", "for", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "not", " ", "markup", ":", " ", " ", " ", " ", " ", "[...", "anyt", "hing", " ", "else", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "idx_", "=_", "text_", "._", "index_", "(_", "'['_", ",_", "curr", "\\u", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\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_", "text", "\\u", "length_", "=_", "len_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "matchi", "ng", " ", "clos", "ing", " ", "']", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Markdown", ".", "pl", " ", "allow", "s", " ", "*", "matchi", "ng", "*", " ", "brackets", " ", "in", " ", "link", " ", "text", " ", "so", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "here", " ", "too", ".", " ", "Markdown", ".", "pl", " ", "*", "doe", "sn", "'", "t", "*", " ", "currentl", "y", " ", "allow_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "matchi", "ng", " ", "brackets", " ", "in", " ", "img", " ", "alt", " ", "text", " ", "--", " ", "we", "'", "ll", " ", "differ", " ", "in", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rega", "rd", "._", "\\u\\u\\uNL\\u\\u\\u_", "bracket", "\\u", "depth_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "range_", "(_", "start", "\\u", "idx_", "+_", "1_", ",_", "min_", "(_", "start", "\\u", "idx_", "+_", "MAX", "\\u", "LINK", "\\u", "TEXT", "\\u", "SENT", "INE", "L_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text", "\\u", "length_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ch_", "=_", "text_", "[_", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ch_", "==_", "']'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bracket", "\\u", "depth_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bracket", "\\u", "depth_", "<_", "0_", ":_", "\\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_", "elif_", "ch_", "==_", "'['_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bracket", "\\u", "depth_", "+=_", "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_", "#", " ", "Clos", "ing", " ", "bracket", " ", "not", " ", "found", " ", "within", " ", "sentinel", " ", "length", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "isn", "'", "t", " ", "markup", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curr", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "\\u", "text_", "=_", "text_", "[_", "start", "\\u", "idx_", "+_", "1_", ":_", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Poss", "ibl", "y", " ", "a", " ", "footnote", " ", "ref", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "footnote", "s", "\"_", "in_", "self_", "._", "extras_", "and_", "link", "\\u", "text_", "._", "startswith_", "(_", "\"", "^", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "norm", "ed", "\\u", "id_", "=_", "re_", "._", "sub_", "(_", "r", "'\\\\", "W", "'_", ",_", "'-'_", ",_", "link", "\\u", "text_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "norm", "ed", "\\u", "id_", "in_", "self_", "._", "footnote", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "footnote", "\\u", "ids_", "._", "append_", "(_", "norm", "ed", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "'<", "sup", " ", "class", "=\"", "footnote", "-", "ref", "\"", " ", "id", "=\"", "fn", "ref", "-%", "s", "\">'_", "'<", "a", " ", "href", "=\"", "#", "fn", "-%", "s", "\">", "%", "s", "</", "a", "><", "/", "sup", ">'_", "%_", "(_", "norm", "ed", "\\u", "id_", ",_", "norm", "ed", "\\u", "id_", ",_", "len_", "(_", "self_", "._", "footnote", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "text_", "[_", ":_", "start", "\\u", "idx_", "]_", "+_", "result_", "+_", "text_", "[_", "p_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "id", " ", "isn", "'", "t", " ", "defin", "ed", ",", " ", "lea", "ve", " ", "the", " ", "markup", " ", "alo", "ne", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "curr", "\\u", "pos_", "=_", "p_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "dete", "rmin", "e", " ", "what", " ", "this", " ", "is", " ", "by", " ", "the", " ", "remainder", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "==_", "text", "\\u", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", "line", " ", "anchor", " ", "or", " ", "img", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "text_", "[_", "p_", "]_", "==_", "'('_", ":_", "#", " ", "atte", "mpt", " ", "at", " ", "perf", " ", "improvement", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", ",_", "title_", ",_", "url", "\\u", "end", "\\u", "idx_", "=_", "self_", "._", "\\u", "extract", "\\u", "url", "\\u", "and", "\\u", "title_", "(_", "text_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "url_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "an", " ", "inline", " ", "anchor", " ", "or", " ", "img", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "\\u", "img_", "=_", "start", "\\u", "idx_", ">_", "0_", "and_", "text_", "[_", "start", "\\u", "idx_", "-_", "1_", "]_", "==_", "\"!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "img_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "start", "\\u", "idx_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", "'", "ve", " ", "got", " ", "to", " ", "encode", " ", "these", " ", "to", " ", "avoid", " ", "conflicting", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "italic", "s", "/", "bold", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "url_", "._", "replace_", "(_", "'*'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'*'_", "]_", ")_", "._", "replace_", "(_", "'\\u'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'\\u'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "title", "\\u", "str_", "=_", "'", " ", "title", "=\"", "%", "s", "\"'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "xml", "\\u", "escape", "\\u", "attr_", "(_", "title_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "replace_", "(_", "'*'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'*'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "replace_", "(_", "'\\u'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'\\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 ", " ", " _", "title", "\\u", "str_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "img_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "img", "\\u", "class", "\\u", "str_", "=_", "self_", "._", "\\u", "html", "\\u", "class", "\\u", "str", "\\u", "from", "\\u", "tag_", "(_", "\"", "img", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "'<", "img", " ", "src", "=\"", "%", "s", "\"", " ", "alt", "=\"", "%", "s", "\"%", "s", "%", "s", "%", "s", "'_", "%_", "(_", "url_", "._", "replace_", "(_", "'\"'_", ",_", "'&", "quot", ";'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "xml", "\\u", "escape", "\\u", "attr_", "(_", "link", "\\u", "text_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "\\u", "str_", ",_", "img", "\\u", "class", "\\u", "str_", ",_", "self_", "._", "empty", "\\u", "element", "\\u", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "smart", "y", "-", "pant", "s", "\"_", "in_", "self_", "._", "extras_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "=_", "result_", "._", "replace_", "(_", "'\"'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'\"'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curr", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "len_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "text_", "[_", ":_", "start", "\\u", "idx_", "]_", "+_", "result_", "+_", "text_", "[_", "url", "\\u", "end", "\\u", "idx_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "start", "\\u", "idx_", ">=_", "anchor", "\\u", "allow", "ed", "\\u", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result", "\\u", "head_", "=_", "'<", "a", " ", "href", "=\"", "%", "s", "\"%", "s", ">'_", "%_", "(_", "url_", ",_", "title", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "'%", "s", "%", "s", "</", "a", ">'_", "%_", "(_", "result", "\\u", "head_", ",_", "link", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "smart", "y", "-", "pant", "s", "\"_", "in_", "self_", "._", "extras_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "=_", "result_", "._", "replace_", "(_", "'\"'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'\"'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "<", "img", ">", " ", "allow", "ed", " ", "from", " ", "curr", "\\u", "pos", " ", "on", ",", " ", "<", "a", ">", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anchor", "\\u", "allow", "ed", "\\u", "pos", " ", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curr", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "len_", "(_", "result", "\\u", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anchor", "\\u", "allow", "ed", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "len_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "text_", "[_", ":_", "start", "\\u", "idx_", "]_", "+_", "result_", "+_", "text_", "[_", "url", "\\u", "end", "\\u", "idx_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Anc", "hor", " ", "not", " ", "allow", "ed", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "curr", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reference", " ", "anchor", " ", "or", " ", "img", "?", "_", "\\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 ", " _", "match_", "=_", "self_", "._", "\\u", "tail", "\\u", "of", "\\u", "reference", "\\u", "link", "\\u", "re_", "._", "match_", "(_", "text_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "a", " ", "reference", "-", "style", " ", "anchor", " ", "or", " ", "img", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "\\u", "img_", "=_", "start", "\\u", "idx_", ">_", "0_", "and_", "text_", "[_", "start", "\\u", "idx_", "-_", "1_", "]_", "==_", "\"!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "img_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "start", "\\u", "idx_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "\\u", "id_", "=_", "match_", "._", "group_", "(_", "\"", "id", "\"_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "link", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "link", "\\u", "id_", "=_", "link", "\\u", "text_", "._", "lower_", "(_", ")_", "#", " ", "for", " ", "link", "s", " ", "like", " ", "[", "this", "][", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "link", "\\u", "id_", "in_", "self_", "._", "urls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "url_", "=_", "self_", "._", "urls_", "[_", "link", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "ve", " ", "got", " ", "to", " ", "encode", " ", "these", " ", "to", " ", "avoid", " ", "conflicting", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "italic", "s", "/", "bold", "._", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "url_", "._", "replace_", "(_", "'*'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'*'_", "]_", ")_", "._", "replace_", "(_", "'\\u'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'\\u'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "self_", "._", "titles_", "._", "get_", "(_", "link", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "before_", "=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "\\u", "xml", "\\u", "escape", "\\u", "attr_", "(_", "title_", ")_", "._", "replace_", "(_", "'*'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'*'_", "]_", ")_", "._", "replace_", "(_", "'\\u'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'\\u'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title", "\\u", "str_", "=_", "'", " ", "title", "=\"", "%", "s", "\"'_", "%_", "title_", "\\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 ", " ", " _", "title", "\\u", "str_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "img_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "img", "\\u", "class", "\\u", "str_", "=_", "self_", "._", "\\u", "html", "\\u", "class", "\\u", "str", "\\u", "from", "\\u", "tag_", "(_", "\"", "img", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "'<", "img", " ", "src", "=\"", "%", "s", "\"", " ", "alt", "=\"", "%", "s", "\"%", "s", "%", "s", "%", "s", "'_", "%_", "(_", "url_", "._", "replace_", "(_", "'\"'_", ",_", "'&", "quot", ";'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "link", "\\u", "text_", "._", "replace_", "(_", "'\"'_", ",_", "'&", "quot", ";'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "\\u", "str_", ",_", "img", "\\u", "class", "\\u", "str_", ",_", "self_", "._", "empty", "\\u", "element", "\\u", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "smart", "y", "-", "pant", "s", "\"_", "in_", "self_", "._", "extras_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "=_", "result_", "._", "replace_", "(_", "'\"'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'\"'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curr", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "len_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "text_", "[_", ":_", "start", "\\u", "idx_", "]_", "+_", "result_", "+_", "text_", "[_", "match_", "._", "end_", "(_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "start", "\\u", "idx_", ">=_", "anchor", "\\u", "allow", "ed", "\\u", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "=_", "'<", "a", " ", "href", "=\"", "%", "s", "\"%", "s", ">", "%", "s", "</", "a", ">'_", "%_", "(_", "url_", ",_", "title", "\\u", "str_", ",_", "link", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "head_", "=_", "'<", "a", " ", "href", "=\"", "%", "s", "\"%", "s", ">'_", "%_", "(_", "url_", ",_", "title", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "'%", "s", "%", "s", "</", "a", ">'_", "%_", "(_", "result", "\\u", "head_", ",_", "link", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "smart", "y", "-", "pant", "s", "\"_", "in_", "self_", "._", "extras_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "=_", "result_", "._", "replace_", "(_", "'\"'_", ",_", "self_", "._", "\\u", "escape", "\\u", "table_", "[_", "'\"'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "<", "img", ">", " ", "allow", "ed", " ", "from", " ", "curr", "\\u", "pos", " ", "on", ",", " ", "<", "a", ">", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anchor", "\\u", "allow", "ed", "\\u", "pos", " ", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curr", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "len_", "(_", "result", "\\u", "head_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anchor", "\\u", "allow", "ed", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "len_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "text_", "[_", ":_", "start", "\\u", "idx_", "]_", "+_", "result_", "+_", "text_", "[_", "match_", "._", "end_", "(_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Anc", "hor", " ", "not", " ", "allow", "ed", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "curr", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "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_", "#", " ", "Thi", "s", " ", "id", " ", "isn", "'", "t", " ", "defin", "ed", ",", " ", "lea", "ve", " ", "the", " ", "markup", " ", "alo", "ne", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "curr", "\\u", "pos_", "=_", "match_", "._", "end_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "it", " ", "isn", "'", "t", " ", "markup", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curr", "\\u", "pos_", "=_", "start", "\\u", "idx_", "+_", "1_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kdart/pycopia/process/test.py
[ { "content": "#!/usr/bin/python2.7\n# -*- coding: utf-8 -*-\n# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab\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\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import division\n\nimport unittest\n\nfrom pycopia import proctools\nfrom pycopia import crontab\nfrom pycopia import expect\nfrom pycopia import netcat\nfrom pycopia import proctools\n#from pycopia import redir\nfrom pycopia import rsynclib\nfrom pycopia import sshlib\nfrom pycopia import sudo\n#from pycopia import xselection\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _sub_function():\n from pycopia import scheduler\n scheduler.sleep(5)\n return None", "metadata": "root._sub_function", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def _co_function():\n import sys\n from pycopia import scheduler\n sys.stdout.write(\"hello from co_function\\n\")\n scheduler.sleep(5)\n return None", "metadata": "root._co_function", "header": "['module', '___EOS___']", "index": 38 }, { "content": "class ProcessTests(unittest.TestCase):\n\n\n\n\n# def test_pipeline(self):\n# ptest = proctools.spawnpipe(\"cat /etc/hosts | sort\")\n# hosts = ptest.read()\n# self.assertTrue(bool(hosts))\n# self.assertFalse(bool(ptest.readerr()))\n# ptest.close()\n# es = ptest.stat()\n# self.assertTrue(es)\n\n\n", "metadata": "root.ProcessTests", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def setUp(self):\n pass", "metadata": "root.ProcessTests.setUp", "header": "['class', 'ProcessTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_spawnpipe(self):\n ls = proctools.spawnpipe(\"ls /usr/bin\")\n files = ls.read()\n self.assertTrue(files)\n self.assertFalse(ls.readerr())\n ls.close()\n es = ls.wait()\n self.assertTrue(es)", "metadata": "root.ProcessTests.test_spawnpipe", "header": "['class', 'ProcessTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_lserror(self):\n ls = proctools.spawnpipe(\"ls /usr/binxx\", merge=0)\n print(ls.read())\n print(\"errors:\")\n print(ls.readerr())\n ls.close()\n ls.wait()\n es = ls.stat()\n self.assertFalse(es)", "metadata": "root.ProcessTests.test_lserror", "header": "['class', 'ProcessTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 58 }, { "content": " def test_readaline(self):\n lspm = proctools.spawnpipe(\"ls /bin\")\n lines = lspm.readlines()\n self.assertTrue(lines)\n lspm.close()\n es = lspm.stat()\n self.assertTrue(es)", "metadata": "root.ProcessTests.test_readaline", "header": "['class', 'ProcessTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_subprocess(self):\n sub = proctools.subprocess(_sub_function)\n es = sub.wait()\n self.assertTrue(es)", "metadata": "root.ProcessTests.test_subprocess", "header": "['class', 'ProcessTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 85 }, { "content": " def test_coprocess(self):\n sub = proctools.coprocess(_co_function)\n line = sub.readline()\n es = sub.wait()\n self.assertTrue(es)", "metadata": "root.ProcessTests.test_coprocess", "header": "['class', 'ProcessTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 90 }, { "content": " def XXXtest_sudo(self):\n pw = sudo.getpw()\n proc = sudo.sudo(\"/bin/ifconfig -a\", password=pw)\n print(proc.read())\n print(repr(proc.readerr()))\n proc.wait()\n sudo.sudo_reset()", "metadata": "root.ProcessTests.XXXtest_sudo", "header": "['class', 'ProcessTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 96 } ]
[ { "span": "from pycopia import crontab", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 27 }, { "span": "from pycopia import expect", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 26 }, { "span": "from pycopia import netcat", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 26 }, { "span": "from pycopia import rsynclib", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 28 }, { "span": "from pycopia import sshlib", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 26 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python", "2.7", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "ts", "=", "4", ":", "sw", "=", "4", ":", "soft", "tabs", "top", "=", "4", ":", "smart", "tab", ":", "expand", "tab_", "\\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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pycopia_", "import_", "proc", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pycopia_", "import_", "crontab", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pycopia_", "import_", "expect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pycopia_", "import_", "netc", "at_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pycopia_", "import_", "proc", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "pyco", "pia", " ", "import", " ", "redir", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pycopia_", "import_", "rsync", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pycopia_", "import_", "ssh", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pycopia_", "import_", "sudo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "pyco", "pia", " ", "import", " ", "xse", "lection", "_", "\\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\\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 ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "sub\\u", "function_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pycopia_", "import_", "scheduler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\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", "co", "\\u", "function_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pycopia_", "import_", "scheduler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "\"", "hell", "o", " ", "from", " ", "co", "\\u", "function", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\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_", "Process", "Tests_", "(_", "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_", "#", " ", " ", " ", " ", "def", " ", "test\\u", "pipeline", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pte", "st", " ", "=", " ", "proc", "tool", "s", ".", "spawn", "pipe", "(\"", "cat", " ", "/", "etc", "/", "host", "s", " ", "|", " ", "sort", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "host", "s", " ", "=", " ", "pte", "st", ".", "read", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Tru", "e", "(", "bool", "(", "host", "s", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Fal", "se", "(", "bool", "(", "pte", "st", ".", "reader", "r", "())", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pte", "st", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "es", " ", "=", " ", "pte", "st", ".", "stat", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "assert", "Tru", "e", "(", "es", ")_", "\\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_", "[SEP]_", "class_", "Process", "Tests_", "(_", "unittest_", "._", "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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "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", "spawn", "pipe_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "proc", "tools_", "._", "spawn", "pipe_", "(_", "\"", "ls", " ", "/", "usr", "/", "bin", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "ls_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ls_", "._", "reader", "r_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ls_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "ls_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "es_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "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", "lse", "rror_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "proc", "tools_", "._", "spawn", "pipe_", "(_", "\"", "ls", " ", "/", "usr", "/", "bin", "xx", "\"_", ",_", "merge_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ls_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "error", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "ls_", "._", "reader", "r_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ls_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ls_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "ls_", "._", "stat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "es_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "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", "reada", "line_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lsp", "m_", "=_", "proc", "tools_", "._", "spawn", "pipe_", "(_", "\"", "ls", " ", "/", "bin", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "lsp", "m_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lsp", "m_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "lsp", "m_", "._", "stat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "es_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "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", "subprocess_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "=_", "proc", "tools_", "._", "subprocess_", "(_", "\\u", "sub\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "sub_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "es_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "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", "cop", "rocess", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "=_", "proc", "tools_", "._", "cop", "rocess", "_", "(_", "\\u", "co", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "sub_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "sub_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "es_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Process", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "XX", "Xt", "est", "\\u", "sudo_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pw_", "=_", "sudo_", "._", "getpw", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "sudo_", "._", "sudo_", "(_", "\"/", "bin", "/", "ifconfig", " ", "-", "a", "\"_", ",_", "password_", "=_", "pw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "proc_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "repr_", "(_", "proc_", "._", "reader", "r_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sudo_", "._", "sudo", "\\u", "reset_", "(_", ")_", "\\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,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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 ]
Variable defined multiple times
VisTrails/VisTrails/vistrails/packages/RemoteQ/hdfs.py
[ { "content": " def compute(self):\n machine = self.get_machine()\n jm = self.job_monitor()\n id = self.signature\n job = jm.getCache(id)\n if not job:\n remote = self.get_input('Remote Location')\n local = self.get_input('Local File')\n override = self.force_get_input('Override', False)\n if '://' not in remote:\n remote = self.add_prefix(remote, machine)\n if not int(self.call_hdfs('dfs -test -e ' + remote +\n '; echo $?', machine)):\n if override:\n self.call_hdfs('dfs -rm -r ' + remote, machine)\n else:\n raise ModuleError(self, 'Remote entry already exists')\n tempfile = machine.remote.send_command('mktemp -u').strip()\n result = machine.sendfile(local.name, tempfile)\n self.call_hdfs('dfs -put %s %s' % (tempfile, remote), machine)\n result = machine.remote.rm(tempfile,force=True,recursively=True)\n d = {'remote':remote,'local':local.name}\n self.set_job_machine(d, machine)\n jm.setCache(id, d, self.job_name())\n job = jm.getJob(id)\n self.set_output('Remote Location', job.parameters['remote'])\n self.set_output('Machine', machine)", "metadata": "root.HDFSPut.compute", "header": "['class', 'HDFSPut', '(', 'HadoopBaseModule', ')', ':', '___EOS___']", "index": 67 }, { "content": " def compute(self):\n machine = self.get_machine()\n jm = self.job_monitor()\n id = self.signature\n job = jm.getCache(id)\n if not job:\n remote = self.get_input('Remote Location')\n local = self.get_input('Local File')\n override = self.force_get_input('Override', False)\n if '://' not in remote:\n remote = self.add_prefix(remote, machine)\n if os.path.exists(local.name):\n if override==False:\n raise ModuleError(self, 'Output already exists')\n else:\n if os.path.isdir(local.name):\n shutil.rmtree(local.name)\n else:\n os.unlink(local.name)\n\n tempfile = machine.remote.send_command('mktemp -d -u').strip()\n result = self.call_hdfs('dfs -get %s %s' % (remote, tempfile), machine)\n # too slow with many files\n #res = machine.send_command(\"get -r %s %s\" % (tempfile, local.name) )\n # tar files to increase speed\n result = machine.local.send_command('mkdir %s'%local.name)\n result = machine.sync(local.name,\n tempfile,\n mode=machine.MODE_REMOTE_LOCAL,\n use_tar=True)\n result = machine.remote.rm(tempfile,force=True,recursively=True)\n d = {'remote':remote,'local':local.name}\n self.set_job_machine(d, machine)\n jm.setCache(id, d, self.job_name())\n job = jm.getCache(id)\n self.set_output('Local File', PathObject(job.parameters['local']))\n self.set_output('Machine', machine)", "metadata": "root.HDFSGet.compute", "header": "['class', 'HDFSGet', '(', 'HadoopBaseModule', ')', ':', '___EOS___']", "index": 115 } ]
[ { "span": "result ", "start_line": 85, "start_column": 12, "end_line": 85, "end_column": 18 }, { "span": "result ", "start_line": 136, "start_column": 12, "end_line": 136, "end_column": 18 }, { "span": "result ", "start_line": 140, "start_column": 12, "end_line": 140, "end_column": 18 }, { "span": "result ", "start_line": 141, "start_column": 12, "end_line": 141, "end_column": 18 } ]
[ { "span": "result ", "start_line": 87, "start_column": 12, "end_line": 87, "end_column": 18 }, { "span": "result ", "start_line": 145, "start_column": 12, "end_line": 145, "end_column": 18 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "HDF", "SP", "ut_", "(_", "Had", "oop", "Base", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "machine_", "=_", "self_", "._", "get", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jm", "_", "=_", "self_", "._", "job", "\\u", "monitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "self_", "._", "signature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "jm", "_", "._", "get", "Cache_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "Remo", "te", " ", "Locat", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "Local", " ", "File", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "override_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "Override", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "':/", "/'_", "not_", "in_", "remote_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote_", "=_", "self_", "._", "add", "\\u", "prefix_", "(_", "remote_", ",_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "int_", "(_", "self_", "._", "call", "\\u", "hdfs", "_", "(_", "'", "dfs", " ", "-", "test", " ", "-", "e", " ", "'_", "+_", "remote_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "';", " ", "echo", " ", "$", "?'_", ",_", "machine_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "override_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "call", "\\u", "hdfs", "_", "(_", "'", "dfs", " ", "-", "rm", " ", "-", "r", " ", "'_", "+_", "remote_", ",_", "machine_", ")_", "\\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_", "Modul", "e", "Error_", "(_", "self_", ",_", "'", "Remo", "te", " ", "entry", " ", "alr", "ead", "y", " ", "exist", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tempfile_", "=_", "machine_", "._", "remote_", "._", "send", "\\u", "command_", "(_", "'", "mkt", "emp", " ", "-", "u", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "machine_", "._", "send", "file_", "(_", "local_", "._", "name_", ",_", "tempfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "call", "\\u", "hdfs", "_", "(_", "'", "dfs", " ", "-", "put", " ", "%", "s", " ", "%", "s", "'_", "%_", "(_", "tempfile_", ",_", "remote_", ")_", ",_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "machine_", "._", "remote_", "._", "rm_", "(_", "tempfile_", ",_", "force_", "=_", "True_", ",_", "recurs", "ively", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "{_", "'", "remote", "'_", ":_", "remote_", ",_", "'", "local", "'_", ":_", "local_", "._", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "job", "\\u", "machine_", "(_", "d_", ",_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jm", "_", "._", "set", "Cache_", "(_", "id_", ",_", "d_", ",_", "self_", "._", "job", "\\u", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "jm", "_", "._", "get", "Job_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Remo", "te", " ", "Locat", "ion", "'_", ",_", "job_", "._", "parameters_", "[_", "'", "remote", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Machine", "'_", ",_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HDF", "SG", "et_", "(_", "Had", "oop", "Base", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "machine_", "=_", "self_", "._", "get", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jm", "_", "=_", "self_", "._", "job", "\\u", "monitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "self_", "._", "signature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "jm", "_", "._", "get", "Cache_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "Remo", "te", " ", "Locat", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "Local", " ", "File", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "override_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "Override", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "':/", "/'_", "not_", "in_", "remote_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote_", "=_", "self_", "._", "add", "\\u", "prefix_", "(_", "remote_", ",_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "local_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "override_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "'", "Output", " ", "alr", "ead", "y", " ", "exist", "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 ", " ", "_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "local_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "shutil_", "._", "rmtree_", "(_", "local_", "._", "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 ", " ", " _", "os_", "._", "unlink_", "(_", "local_", "._", "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_", "tempfile_", "=_", "machine_", "._", "remote_", "._", "send", "\\u", "command_", "(_", "'", "mkt", "emp", " ", "-", "d", " ", "-", "u", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "call", "\\u", "hdfs", "_", "(_", "'", "dfs", " ", "-", "get", " ", "%", "s", " ", "%", "s", "'_", "%_", "(_", "remote_", ",_", "tempfile_", ")_", ",_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "too", " ", "slow", " ", "with", " ", "many", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", "res", " ", "=", " ", "machine", ".", "send", "\\u", "command", "(\"", "get", " ", "-", "r", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "tempfile", ",", " ", "local", ".", "name", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tar", " ", "files", " ", "to", " ", "increase", " ", "speed_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "machine_", "._", "local_", "._", "send", "\\u", "command_", "(_", "'", "mkd", "ir", " ", "%", "s", "'_", "%_", "local_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "machine_", "._", "sync_", "(_", "local_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tempfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "machine_", "._", "MODE", "\\u", "REMO", "TE", "\\u", "LOCAL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "tar_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "machine_", "._", "remote_", "._", "rm_", "(_", "tempfile_", ",_", "force_", "=_", "True_", ",_", "recurs", "ively", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "{_", "'", "remote", "'_", ":_", "remote_", ",_", "'", "local", "'_", ":_", "local_", "._", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "job", "\\u", "machine_", "(_", "d_", ",_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jm", "_", "._", "set", "Cache_", "(_", "id_", ",_", "d_", ",_", "self_", "._", "job", "\\u", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "jm", "_", "._", "get", "Cache_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Local", " ", "File", "'_", ",_", "Path", "Object_", "(_", "job_", "._", "parameters_", "[_", "'", "local", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Machine", "'_", ",_", "machine_", ")_", "\\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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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 ]
Unused import
VisTrails/VisTrails/contrib/NumSciPy/Matrix.py
[ { "content": "import core.modules\nimport core.modules.module_registry\nfrom core.modules.vistrails_module import Module, ModuleError\n\nimport scipy\nimport numpy\nfrom scipy import sparse\n\nfrom Array import *\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MatrixModule(object):\n my_namespace = 'scipy|matrix'", "metadata": "root.MatrixModule", "header": "['module', '___EOS___']", "index": 10 }, { "content": "class MatrixOp(object):\n my_namespace = 'scipy|matrix|operation'", "metadata": "root.MatrixOp", "header": "['module', '___EOS___']", "index": 13 }, { "content": "class Matrix(MatrixModule, Module):\n \"\"\" Container class for the scipy.sparse.csc_matrix class \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Matrix", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def __init__(self):\n Module.__init__(self)\n self.matrix = None", "metadata": "root.Matrix.__init__", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 18 }, { "content": " def get_shape(self):\n return self.matrix.shape", "metadata": "root.Matrix.get_shape", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 22 }, { "content": " def get_conjugate(self):\n return self.matrix.conjugate()", "metadata": "root.Matrix.get_conjugate", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 25 }, { "content": " def get_column(self, colId):\n return self.matrix.getcol(colId)", "metadata": "root.Matrix.get_column", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 28 }, { "content": " def get_row(self, rowId):\n return self.matrix.getrow(rowId)", "metadata": "root.Matrix.get_row", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 31 }, { "content": " def set_diagonal(self, vals):\n self.matrix.setdiag(vals)", "metadata": "root.Matrix.set_diagonal", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 34 }, { "content": " def toarray(self):\n return self.matrix.toarray()", "metadata": "root.Matrix.toarray", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 37 }, { "content": " def transpose(self):\n return self.matrix.transpose()", "metadata": "root.Matrix.transpose", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 40 }, { "content": " def get_num_elements(self):\n return self.matrix.getnnz()", "metadata": "root.Matrix.get_num_elements", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 43 }, { "content": " def get_max_elements(self):\n return self.matrix.nzmax", "metadata": "root.Matrix.get_max_elements", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 46 }, { "content": " def get_reals(self):\n return self.matrix._real()", "metadata": "root.Matrix.get_reals", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 49 }, { "content": " def get_imaginaries(self):\n return self.matrix._imag()", "metadata": "root.Matrix.get_imaginaries", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 52 }, { "content": " def get_matrix(self):\n return self.matrix", "metadata": "root.Matrix.get_matrix", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 55 }, { "content": " def set_matrix(self, mat):\n self.matrix = mat", "metadata": "root.Matrix.set_matrix", "header": "['class', 'Matrix', '(', 'MatrixModule', ',', 'Module', ')', ':', '___EOS___']", "index": 58 }, { "content": "class MatrixMultiply(MatrixOp, Module):\n \"\"\" Multiply two matrices together \"\"\"\n", "metadata": "root.MatrixMultiply", "header": "['module', '___EOS___']", "index": 61 }, { "content": " def compute(self):\n a = self.get_input(\"Matrix1\")\n b = self.get_input(\"Matrix2\")\n out = Matrix()\n out.set_matrix(a.get_matrix() * b.get_matrix())\n\n self.set_output(\"Matrix Output\", out)", "metadata": "root.MatrixMultiply.compute", "header": "['class', 'MatrixMultiply', '(', 'MatrixOp', ',', 'Module', ')', ':', '___EOS___']", "index": 63 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, namespace=cls.my_namespace)\n reg.add_input_port(cls, \"Matrix1\", (Matrix, 'Input Matrix 1'))\n reg.add_input_port(cls, \"Matrix2\", (Matrix, 'Input Matrix 2'))\n reg.add_output_port(cls, \"Matrix Output\", (Matrix, 'Output Matrix'))", "metadata": "root.MatrixMultiply.register", "header": "['class', 'MatrixMultiply', '(', 'MatrixOp', ',', 'Module', ')', ':', '___EOS___']", "index": 71 }, { "content": "class MatrixConjugate(MatrixOp, Module):\n \"\"\" Get the complex conjugate of the input matrix. \"\"\"\n", "metadata": "root.MatrixConjugate", "header": "['module', '___EOS___']", "index": 78 }, { "content": " def compute(self):\n a = self.get_input(\"Matrix\")\n b = a.get_conjugate().copy()\n out = Matrix()\n out.set_matrix(b)\n self.set_output(\"Output\", out)", "metadata": "root.MatrixConjugate.compute", "header": "['class', 'MatrixConjugate', '(', 'MatrixOp', ',', 'Module', ')', ':', '___EOS___']", "index": 80 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, namespace=cls.my_namespace)\n reg.add_input_port(cls, \"Matrix\", (Matrix, 'Input Matrix'))\n reg.add_output_port(cls, \"Output\", (Matrix, 'Output Matrix'))", "metadata": "root.MatrixConjugate.register", "header": "['class', 'MatrixConjugate', '(', 'MatrixOp', ',', 'Module', ')', ':', '___EOS___']", "index": 87 }, { "content": "class MatrixToArray(MatrixOp, Module):\n \"\"\" Convert a SciPy matrix to a Numpy Array \"\"\"\n", "metadata": "root.MatrixToArray", "header": "['module', '___EOS___']", "index": 93 }, { "content": " def compute(self):\n m = self.get_input(\"Matrix\")\n a = m.toarray()\n out = NDArray()\n out.set_array(a)\n self.set_output(\"Output Array\", out)", "metadata": "root.MatrixToArray.compute", "header": "['class', 'MatrixToArray', '(', 'MatrixOp', ',', 'Module', ')', ':', '___EOS___']", "index": 95 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, namespace=cls.my_namespace)\n reg.add_input_port(cls, \"Matrix\", (Matrix, 'Input Matrix'))\n reg.add_output_port(cls, \"Output Array\", (NDArray, 'Output Array'))", "metadata": "root.MatrixToArray.register", "header": "['class', 'MatrixToArray', '(', 'MatrixOp', ',', 'Module', ')', ':', '___EOS___']", "index": 102 } ]
[ { "span": "import core.modules", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 19 }, { "span": "import core.modules.module_registry", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 35 }, { "span": "from core.modules.vistrails_module import Module, ModuleError", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 61 }, { "span": "import scipy", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 12 }, { "span": "import numpy", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 12 }, { "span": "from scipy import sparse", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 24 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "core_", "._", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "core_", "._", "modules_", "._", "module", "\\u", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "vist", "rail", "s", "\\u", "module_", "import_", "Module_", ",_", "Modul", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "scipy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "import_", "sparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Array_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "class_", "Matrix", "Module_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "'", "sci", "py", "|", "matrix", "'_", "\\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_", "Matrix", "Op_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "'", "sci", "py", "|", "matrix", "|", "operati", "on", "'_", "\\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_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Containe", "r", " ", "class", " ", "for", " ", "the", " ", "sci", "py", ".", "spars", "e", ".", "csc", "\\u", "matrix", " ", "class", " ", "\"\"\"_", "\\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_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Module_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "matrix_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "shape_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "conjugate", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "conjugate", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "column_", "(_", "self_", ",_", "col", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "getco", "l_", "(_", "col", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "row_", "(_", "self_", ",_", "row", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "getr", "ow_", "(_", "row", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "diagonal_", "(_", "self_", ",_", "vals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "matrix_", "._", "setd", "iag", "_", "(_", "vals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "toa", "rray_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "toa", "rray_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "transpose_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "transpose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "num", "\\u", "elements_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "getn", "nz_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "max", "\\u", "elements_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "nz", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "real", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "\\u", "real_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "imagin", "aries", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "._", "\\u", "imag_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "matrix_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix_", "(_", "Matrix", "Module_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "matrix_", "(_", "self_", ",_", "mat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "matrix_", "=_", "mat_", "\\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_", "Matrix", "Multiply", "_", "(_", "Matrix", "Op_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Multiply", " ", "two", " ", "matric", "es", " ", "tog", "ether", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Multiply", "_", "(_", "Matrix", "Op_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Matrix", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Matrix", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "set\\u", "matrix_", "(_", "a_", "._", "get", "\\u", "matrix_", "(_", ")_", "*_", "b_", "._", "get", "\\u", "matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Matrix", " ", "Output", "\"_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Multiply", "_", "(_", "Matrix", "Op_", ",_", "Module_", ")_", ":_", "\\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_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Matrix", "1", "\"_", ",_", "(_", "Matrix_", ",_", "'", "Inp", "ut", " ", "Matrix", " ", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Matrix", "2", "\"_", ",_", "(_", "Matrix_", ",_", "'", "Inp", "ut", " ", "Matrix", " ", "2", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Matrix", " ", "Output", "\"_", ",_", "(_", "Matrix_", ",_", "'", "Output", " ", "Matrix", "'_", ")_", ")_", "\\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_", "Matrix", "Con", "jug", "ate_", "(_", "Matrix", "Op_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "complex", " ", "conjugate", " ", "of", " ", "the", " ", "input", " ", "matrix", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Con", "jug", "ate_", "(_", "Matrix", "Op_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Matrix", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "a_", "._", "get", "\\u", "conjugate", "_", "(_", ")_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "set\\u", "matrix_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", "\"_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Con", "jug", "ate_", "(_", "Matrix", "Op_", ",_", "Module_", ")_", ":_", "\\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_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Matrix", "\"_", ",_", "(_", "Matrix_", ",_", "'", "Inp", "ut", " ", "Matrix", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", "\"_", ",_", "(_", "Matrix_", ",_", "'", "Output", " ", "Matrix", "'_", ")_", ")_", "\\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_", "Matrix", "To", "Array_", "(_", "Matrix", "Op_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Convert", " ", "a", " ", "Sci", "Py", " ", "matrix", " ", "to", " ", "a", " ", "Num", "py", " ", "Array", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "To", "Array_", "(_", "Matrix", "Op_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Matrix", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "m_", "._", "toa", "rray_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "ND", "Array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "set\\u", "array_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Array", "\"_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "To", "Array_", "(_", "Matrix", "Op_", ",_", "Module_", ")_", ":_", "\\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_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Matrix", "\"_", ",_", "(_", "Matrix_", ",_", "'", "Inp", "ut", " ", "Matrix", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Array", "\"_", ",_", "(_", "ND", "Array_", ",_", "'", "Output", " ", "Array", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 2, 0, 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, 0, 1, 2, 0, 1, 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, 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, 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, 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, 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,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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, 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 ]
'import *' may pollute namespace
columbia/libtrack/libtrack/elfmod/Elf/__init__.py
[ { "content": "\"\"\"\nKenshoto's Elf parser\n\nThis package will let you use programatic ninja-fu\nwhen trying to parse Elf binaries. The API is based\naround several objects representing constructs in the\nElf binary format. The Elf object itself contains\nparsed metadata and lists of things like section headers\nand relocation entries. Additionally, most of the\nobjects implement repr() in some form or another which\nallows you a bunch of readelf-like functionality.\n\n*Eventually* this API will allow you to modify Elf binaries\nand spit them back out in working order (not complete, you\nmay notice some of the initial code).\n\nSend bug reports to Invisigoth or Metr0.\n\n\"\"\"\n# Copyright (C) 2007 Invisigoth - See LICENSE file for details\nimport os\nimport sys\nimport struct\nimport traceback\nimport zlib\n\nfrom stat import *\nfrom Elf.elf_lookup import *\nimport vstruct\nimport vstruct.defs.elf as vs_elf\n\nverbose = False\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 } ]
[ { "span": "from stat import *", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Ken", "sho", "to", "'", "s", " ", "El", "f", " ", "parser", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "package", " ", "will", " ", "let", " ", "you", " ", "use", " ", "programa", "tic", " ", "ninja", "-", "fu", "\\", "10", ";", "whe", "n", " ", "try", "ing", " ", "to", " ", "parse", " ", "El", "f", " ", "binaries", ".", " ", " ", "The", " ", "API", " ", "is", " ", "based", "\\", "10", ";", "aro", "und", " ", "sever", "al", " ", "object", "s", " ", "represent", "ing", " ", "construct", "s", " ", "in", " ", "the", "\\", "10", ";", "El", "f", " ", "binar", "y", " ", "format", ".", " ", " ", "The", " ", "El", "f", " ", "object", " ", "its", "elf", " ", "contain", "s", "\\", "10", ";", "parsed", " ", "metadata", " ", "and", " ", "lists", " ", "of", " ", "thing", "s", " ", "like", " ", "section", " ", "header", "s", "\\", "10", ";", "and", " ", "relocat", "ion", " ", "entri", "es", ".", " ", " ", "Addition", "ally", ",", " ", "most", " ", "of", " ", "the", "\\", "10", ";", "object", "s", " ", "implement", " ", "repr", "()", " ", "in", " ", "some", " ", "form", " ", "or", " ", "anot", "her", " ", "whi", "ch", "\\", "10", ";", "allow", "s", " ", "you", " ", "a", " ", "bunch", " ", "of", " ", "read", "elf", "-", "like", " ", "functional", "it", "y", ".", "\\", "10", ";", "\\", "10", ";", "*", "Event", "ual", "ly", "*", " ", "this", " ", "API", " ", "will", " ", "allow", " ", "you", " ", "to", " ", "modif", "y", " ", "El", "f", " ", "binaries", "\\", "10", ";", "and", " ", "spi", "t", " ", "them", " ", "back", " ", "out", " ", "in", " ", "working", " ", "order", " ", "(", "not", " ", "complete", ",", " ", "you", "\\", "10", ";", "may", " ", "notice", " ", "some", " ", "of", " ", "the", " ", "initial", " ", "code", ").", "\\", "10", ";", "\\", "10", ";", "Sen", "d", " ", "bug", " ", "report", "s", " ", "to", " ", "Inv", "isi", "got", "h", " ", "or", " ", "Met", "r", "0.", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2007", " ", "Inv", "isi", "got", "h", " ", "-", " ", "See", " ", "LICENSE", " ", "file", " ", "for", " ", "details_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stat_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "El", "f_", "._", "elf", "\\u", "lookup_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vstr", "uct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vstr", "uct_", "._", "defs_", "._", "elf_", "as_", "vs", "\\u", "elf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\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('!BBH', 4, 2, 34)\n + socket.inet_aton('1.2.3.4')\n + 'fooBAR'\n + '\\0')\n sent = self.sock.transport.value()\n self.sock.transport.clear()\n\n # connect\n incoming = self.sock.driver_listen.buildProtocol(('1.2.3.4', 5345))\n self.assertNotIdentical(incoming, None)\n incoming.transport = StringTCPTransport()\n incoming.connectionMade()\n\n # now we should have the second reply packet\n sent = self.sock.transport.value()\n self.sock.transport.clear()\n self.assertEqual(sent,\n struct.pack('!BBH', 0, 90, 0)\n + socket.inet_aton('0.0.0.0'))\n self.assert_(not self.sock.transport.stringTCPTransport_closing)\n\n # pass some data through\n self.sock.dataReceived('hello, world')\n self.assertEqual(incoming.transport.value(),\n 'hello, world')\n\n # now close it from the server side\n incoming.transport.loseConnection()\n incoming.connectionLost('fake reason')", "metadata": "root.Bind.test_eofRemote", "header": "['class', 'Bind', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 414 }, { "content": " def test_eofLocal(self):\n self.sock.dataReceived(\n struct.pack('!BBH', 4, 2, 34)\n + socket.inet_aton('1.2.3.4')\n + 'fooBAR'\n + '\\0')\n sent = self.sock.transport.value()\n self.sock.transport.clear()\n\n # connect\n incoming = self.sock.driver_listen.buildProtocol(('1.2.3.4', 5345))\n self.assertNotIdentical(incoming, None)\n incoming.transport = StringTCPTransport()\n incoming.connectionMade()\n\n # now we should have the second reply packet\n sent = self.sock.transport.value()\n self.sock.transport.clear()\n self.assertEqual(sent,\n struct.pack('!BBH', 0, 90, 0)\n + socket.inet_aton('0.0.0.0'))\n self.assert_(not self.sock.transport.stringTCPTransport_closing)\n\n # pass some data through\n self.sock.dataReceived('hello, world')\n self.assertEqual(incoming.transport.value(),\n 'hello, world')\n\n # now close it from the client side\n self.sock.connectionLost('fake reason')", "metadata": "root.Bind.test_eofLocal", "header": "['class', 'Bind', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 446 }, { "content": " def test_badSource(self):\n self.sock.dataReceived(\n struct.pack('!BBH', 4, 2, 34)\n + socket.inet_aton('1.2.3.4')\n + 'fooBAR'\n + '\\0')\n sent = self.sock.transport.value()\n self.sock.transport.clear()\n\n # connect from WRONG address\n incoming = self.sock.driver_listen.buildProtocol(('1.6.6.6', 666))\n self.assertIdentical(incoming, None)\n\n # Now we should have the second reply packet and it should\n # be a failure. The connection should be closing.\n sent = self.sock.transport.value()\n self.sock.transport.clear()\n self.assertEqual(sent,\n struct.pack('!BBH', 0, 91, 0)\n + socket.inet_aton('0.0.0.0'))\n self.assert_(self.sock.transport.stringTCPTransport_closing)", "metadata": "root.Bind.test_badSource", "header": "['class', 'Bind', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 477 } ]
[ { "span": "sent ", "start_line": 420, "start_column": 8, "end_line": 420, "end_column": 12 }, { "span": "sent ", "start_line": 452, "start_column": 8, "end_line": 452, "end_column": 12 }, { "span": "sent ", "start_line": 483, "start_column": 8, "end_line": 483, "end_column": 12 } ]
[ { "span": "sent ", "start_line": 430, "start_column": 8, "end_line": 430, "end_column": 12 }, { "span": "sent ", "start_line": 462, "start_column": 8, "end_line": 462, "end_column": 12 }, { "span": "sent ", "start_line": 492, "start_column": 8, "end_line": 492, "end_column": 12 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Bind_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eof", "Remote_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "data", "Received_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'!", "BB", "H", "'_", ",_", "4_", ",_", "2_", ",_", "34_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "'", "1.2", ".3", ".4", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'", "foo", "BAR", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'\\\\", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "=_", "self_", "._", "sock_", "._", "transport_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "transport_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connect_", "\\u\\u\\uNL\\u\\u\\u_", "incoming_", "=_", "self_", "._", "sock_", "._", "driver", "\\u", "listen_", "._", "build", "Protocol_", "(_", "(_", "'", "1.2", ".3", ".4", "'_", ",_", "534", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Identical", "_", "(_", "incoming_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "incoming_", "._", "transport_", "=_", "String", "TC", "PT", "rans", "port_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "incoming_", "._", "connecti", "on", "Made", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "we", " ", "shou", "ld", " ", "have", " ", "the", " ", "second", " ", "repl", "y", " ", "packet_", "\\u\\u\\uNL\\u\\u\\u_", "sent_", "=_", "self_", "._", "sock_", "._", "transport_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "transport_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'!", "BB", "H", "'_", ",_", "0_", ",_", "90_", ",_", "0_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "'", "0.", "0.", "0.", "0", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "not_", "self_", "._", "sock_", "._", "transport_", "._", "string", "TC", "PT", "rans", "port", "\\u", "closing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass", " ", "some", " ", "data", " ", "through_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sock_", "._", "data", "Received_", "(_", "'", "hell", "o", ",", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "incoming_", "._", "transport_", "._", "value_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hell", "o", ",", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "close", " ", "it", " ", "from", " ", "the", " ", "server", " ", "side_", "\\u\\u\\uNL\\u\\u\\u_", "incoming_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "incoming_", "._", "connecti", "on", "Lost", "_", "(_", "'", "fake", " ", "reason", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bind_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eof", "Local_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "data", "Received_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'!", "BB", "H", "'_", ",_", "4_", ",_", "2_", ",_", "34_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "'", "1.2", ".3", ".4", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'", "foo", "BAR", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'\\\\", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "=_", "self_", "._", "sock_", "._", "transport_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "transport_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connect_", "\\u\\u\\uNL\\u\\u\\u_", "incoming_", "=_", "self_", "._", "sock_", "._", "driver", "\\u", "listen_", "._", "build", "Protocol_", "(_", "(_", "'", "1.2", ".3", ".4", "'_", ",_", "534", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Identical", "_", "(_", "incoming_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "incoming_", "._", "transport_", "=_", "String", "TC", "PT", "rans", "port_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "incoming_", "._", "connecti", "on", "Made", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "we", " ", "shou", "ld", " ", "have", " ", "the", " ", "second", " ", "repl", "y", " ", "packet_", "\\u\\u\\uNL\\u\\u\\u_", "sent_", "=_", "self_", "._", "sock_", "._", "transport_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "transport_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'!", "BB", "H", "'_", ",_", "0_", ",_", "90_", ",_", "0_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "'", "0.", "0.", "0.", "0", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "not_", "self_", "._", "sock_", "._", "transport_", "._", "string", "TC", "PT", "rans", "port", "\\u", "closing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass", " ", "some", " ", "data", " ", "through_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sock_", "._", "data", "Received_", "(_", "'", "hell", "o", ",", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "incoming_", "._", "transport_", "._", "value_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hell", "o", ",", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "close", " ", "it", " ", "from", " ", "the", " ", "client", " ", "side_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sock_", "._", "connecti", "on", "Lost", "_", "(_", "'", "fake", " ", "reason", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bind_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "Source_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "data", "Received_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'!", "BB", "H", "'_", ",_", "4_", ",_", "2_", ",_", "34_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "'", "1.2", ".3", ".4", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'", "foo", "BAR", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'\\\\", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent_", "=_", "self_", "._", "sock_", "._", "transport_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "transport_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connect", " ", "from", " ", "WRON", "G", " ", "address_", "\\u\\u\\uNL\\u\\u\\u_", "incoming_", "=_", "self_", "._", "sock_", "._", "driver", "\\u", "listen_", "._", "build", "Protocol_", "(_", "(_", "'", "1.6", ".6", ".6", "'_", ",_", "666_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Identical", "_", "(_", "incoming_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "we", " ", "shou", "ld", " ", "have", " ", "the", " ", "second", " ", "repl", "y", " ", "packet", " ", "and", " ", "it", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "a", " ", "fail", "ure", ".", " ", "The", " ", "connecti", "on", " ", "shou", "ld", " ", "be", " ", "clos", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "sent_", "=_", "self_", "._", "sock_", "._", "transport_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "transport_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'!", "BB", "H", "'_", ",_", "0_", ",_", "91_", ",_", "0_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "'", "0.", "0.", "0.", "0", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "self_", "._", "sock_", "._", "transport_", "._", "string", "TC", "PT", "rans", "port", "\\u", "closing_", ")_" ]
[ 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, 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, 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, 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 ]
Unused local variable
fp7-ofelia/ocf/expedient/src/python/plugins/vt_plugin/controller/vtAggregateController/forms/forms.py
[ { "content": " def clean(self):\n # Check that both passwords (if present) are the same\n password = self.cleaned_data.get('password', None)\n confirm_password = self.cleaned_data.get('confirm_password', None)\n if password and confirm_password and (password != confirm_password):\n raise forms.ValidationError(\"Passwords don't match\")\n # Remove fields that are not in the Model to avoid any mismatch when synchronizing\n d = dict(self.cleaned_data)\n if \"confirm_password\" in d:\n del d[\"confirm_password\"]\n p = self._meta.model(**d)\n return self.cleaned_data", "metadata": "root.xmlrpcServerProxyForm.clean", "header": "['class', 'xmlrpcServerProxyForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 51 } ]
[ { "span": "p ", "start_line": 61, "start_column": 8, "end_line": 61, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "xmlrpc", "Server", "Pro", "xy", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "bot", "h", " ", "passwords", " ", "(", "if", " ", "presen", "t", ")", " ", "are", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "'", "password", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "confirm", "\\u", "password_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "'", "confirm", "\\u", "password", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "password_", "and_", "confirm", "\\u", "password_", "and_", "(_", "password_", "!=_", "confirm", "\\u", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\"", "Passw", "ords", " ", "don", "'", "t", " ", "match", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "fields", " ", "tha", "t", " ", "are", " ", "not", " ", "in", " ", "the", " ", "Model", " ", "to", " ", "avoid", " ", "any", " ", "mism", "atch", " ", "whe", "n", " ", "synchron", "izi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "dict_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "confirm", "\\u", "password", "\"_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "d_", "[_", "\"", "confirm", "\\u", "password", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "self_", "._", "\\u", "meta_", "._", "model_", "(_", "**_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "clean", "ed", "\\u", "data_" ]
[ 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
sassoftware/conary/conary/dbstore/shell.py
[ { "content": "class DbShell(cmd.Cmd):\n _history_path = os.path.expanduser('~/.dbsh_history')\n yes_args = ('on', 'yes')\n no_args = ('off', 'no')\n # sql commands that are commonly at the start of a sql command\n sqlstarters = ['alter', 'create', 'delete', 'drop', 'insert into',\n 'select', 'update']\n # additional sql keywords\n sqlkeywords = ['database', 'from', 'left', 'limit', 'index',\n 'join', 'null', 'outer', 'table', 'trigger',\n 'using', 'values', 'view']\n\n prompt = 'dbsh> '\n multiline_prompt = ' ...> '\n doc_header = \"Documented commands (type .help <topic>):\"\n intro = \"\"\"dbstore sql shell.\ntype \".quit\" to exit, \".help\" for help\"\"\"\n identchars = cmd.IDENTCHARS + '.'\n default_width = 10\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # funtions defined below\n schemaBits = ('tables', 'triggers', 'functions', 'sequences',\n 'triggers')\n\n\n\n # headers\n\n\n do__head = do__headers\n help__head = help__headers\n complete__headers = complete__yesno\n complete__head = complete__yesno\n\n # pager\n\n\n complete__pager = complete__yesno\n\n # stats\n\n\n complete__stats = complete__yesno\n\n # mode\n\n modes = ('column', 'list')\n\n\n\n do__head = do__headers\n help__head = help__headers\n complete__head = complete__headers\n\n # width\n\n\n complete__width = complete__noop\n\n # quit\n\n\n complete__quit = complete__noop\n\n # reset\n\n\n complete__reset = complete__noop\n\n # help (mostly builtin)\n\n\n complete__help = cmd.Cmd.complete_help", "metadata": "root.DbShell", "header": "['module', '___EOS___']", "index": 32 } ]
[ { "span": "do__head ", "start_line": 380, "start_column": 4, "end_line": 380, "end_column": 12 }, { "span": "help__head ", "start_line": 381, "start_column": 4, "end_line": 381, "end_column": 14 }, { "span": "complete__head ", "start_line": 383, "start_column": 4, "end_line": 383, "end_column": 18 } ]
[ { "span": "do__head ", "start_line": 439, "start_column": 4, "end_line": 439, "end_column": 12 }, { "span": "help__head ", "start_line": 440, "start_column": 4, "end_line": 440, "end_column": 14 }, { "span": "complete__head ", "start_line": 441, "start_column": 4, "end_line": 441, "end_column": 18 } ]
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_", "class_", "Db", "Shell_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "histo", "ry", "\\u", "path_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/.", "dbs", "h", "\\u", "histo", "ry", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ye", "s", "\\u", "args_", "=_", "(_", "'", "on", "'_", ",_", "'", "ye", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "\\u", "args_", "=_", "(_", "'", "off", "'_", ",_", "'", "no", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sql", " ", "command", "s", " ", "tha", "t", " ", "are", " ", "common", "ly", " ", "at", " ", "the", " ", "start", " ", "of", " ", "a", " ", "sql", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "sqls", "tart", "ers_", "=_", "[_", "'", "alter", "'_", ",_", "'", "create", "'_", ",_", "'", "delete", "'_", ",_", "'", "drop", "'_", ",_", "'", "insert", " ", "int", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "select", "'_", ",_", "'", "update", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "addition", "al", " ", "sql", " ", "keywords_", "\\u\\u\\uNL\\u\\u\\u_", "sql", "keywords_", "=_", "[_", "'", "databa", "se", "'_", ",_", "'", "from", "'_", ",_", "'", "left", "'_", ",_", "'", "limit", "'_", ",_", "'", "index", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "join", "'_", ",_", "'", "null", "'_", ",_", "'", "outer", "'_", ",_", "'", "table", "'_", ",_", "'", "trigger", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "usi", "ng", "'_", ",_", "'", "values", "'_", ",_", "'", "view", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prompt_", "=_", "'", "dbs", "h", ">", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multiline", "\\u", "prompt_", "=_", "'", " ", "...", ">", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc", "\\u", "header_", "=_", "\"", "Document", "ed", " ", "command", "s", " ", "(", "type", " ", ".", "help", " ", "<", "topic", ">)", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intro_", "=_", "\"\"\"", "dbs", "tore", " ", "sql", " ", "shell", ".", "\\", "10", ";", "type", " ", "\".", "quit", "\"", " ", "to", " ", "exit", ",", " ", "\".", "help", "\"", " ", "for", " ", "help", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ident", "chars_", "=_", "cmd_", "._", "IDENT", "CHARS_", "+_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "width_", "=_", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fun", "tion", "s", " ", "defin", "ed", " ", "below_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "schema", "Bits_", "=_", "(_", "'", "tables", "'_", ",_", "'", "trigger", "s", "'_", ",_", "'", "function", "s", "'_", ",_", "'", "sequence", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trigger", "s", "'_", ")_", "\\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_", "#", " ", "headers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "do", "\\u\\u", "head_", "=_", "do", "\\u\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help", "\\u\\u", "head_", "=_", "help", "\\u\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete", "\\u\\u", "headers_", "=_", "complete", "\\u\\u", "yesno", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete", "\\u\\u", "head_", "=_", "complete", "\\u\\u", "yesno", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pager_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "complete", "\\u\\u", "pager_", "=_", "complete", "\\u\\u", "yesno", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stats_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "complete", "\\u\\u", "stats_", "=_", "complete", "\\u\\u", "yesno", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modes_", "=_", "(_", "'", "column", "'_", ",_", "'", "list", "'_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "do", "\\u\\u", "head_", "=_", "do", "\\u\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help", "\\u\\u", "head_", "=_", "help", "\\u\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete", "\\u\\u", "head_", "=_", "complete", "\\u\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "width_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "complete", "\\u\\u", "width_", "=_", "complete", "\\u\\u", "noop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "quit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "complete", "\\u\\u", "quit_", "=_", "complete", "\\u\\u", "noop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "complete", "\\u\\u", "reset_", "=_", "complete", "\\u\\u", "noop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "help", " ", "(", "most", "ly", " ", "bui", "lti", "n", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "complete", "\\u\\u", "help_", "=_", "cmd_", "._", "Cmd_", "._", "complete", "\\u", "help_", "\\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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 0, 1, 1, 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, 3, 1, 1, 1, 2, 2, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, 3, 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 ]
Unused import
statsmodels/statsmodels/statsmodels/datasets/randhie/data.py
[ { "content": "\"\"\"RAND Health Insurance Experiment Data\"\"\"\n\n__docformat__ = 'restructuredtext'\n\nCOPYRIGHT = \"\"\"This is in the public domain.\"\"\"\nTITLE = __doc__\nSOURCE = \"\"\"\nThe data was collected by the RAND corporation as part of the Health\nInsurance Experiment (HIE).\n\nhttp://www.rand.org/health/projects/hie.html\n\nThis data was used in::\n\n Cameron, A.C. amd Trivedi, P.K. 2005. `Microeconometrics: Methods\n and Applications,` Cambridge: New York.\n\nAnd was obtained from: <http://cameron.econ.ucdavis.edu/mmabook/mmadata.html>\n\nSee randhie/src for the original data and description. The data included\nhere contains only a subset of the original data. The data varies slightly\ncompared to that reported in Cameron and Trivedi.\n\"\"\"\n\nDESCRSHORT = \"\"\"The RAND Co. Health Insurance Experiment Data\"\"\"\n\nDESCRLONG = \"\"\"\"\"\"\n\nNOTE = \"\"\"::\n\n Number of observations - 20,190\n Number of variables - 10\n Variable name definitions::\n\n mdvis - Number of outpatient visits to an MD\n lncoins - ln(coinsurance + 1), 0 <= coninsurance <= 100\n idp - 1 if individual deductible plan, 0 otherwise\n lpi - ln(max(1, annual participation incentive payment))\n fmde - 0 if idp = 1; ln(max(1, MDE/(0.01 coinsurance))) otherwise\n physlm - 1 if the person has a physical limitation\n disea - number of chronic diseases\n hlthg - 1 if self-rated health is good\n hlthf - 1 if self-rated health is fair\n hlthp - 1 if self-rated health is poor\n (Omitted category is excellent self-rated health)\n\"\"\"\n\nfrom numpy import recfromtxt, column_stack, array\nfrom statsmodels.datasets import utils as du\nfrom os.path import dirname, abspath\n\nPATH = '%s/%s' % (dirname(abspath(__file__)), 'randhie.csv')\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def load():\n \"\"\"\n Loads the RAND HIE data and returns a Dataset class.\n\n ----------\n endog - response variable, mdvis\n exog - design\n\n Returns\n Load instance:\n a class of the data with array attrbutes 'endog' and 'exog'\n \"\"\"\n data = _get_data()\n return du.process_recarray(data, endog_idx=0, dtype=float)", "metadata": "root.load", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def load_pandas():\n \"\"\"\n Loads the RAND HIE data and returns a Dataset class.\n\n ----------\n endog - response variable, mdvis\n exog - design\n\n Returns\n Load instance:\n a class of the data with array attrbutes 'endog' and 'exog'\n \"\"\"\n from pandas import read_csv\n data = read_csv(PATH)\n return du.process_recarray_pandas(data, endog_idx=0)", "metadata": "root.load_pandas", "header": "['module', '___EOS___']", "index": 68 }, { "content": "def _get_data():\n with open(PATH, \"rb\") as f:\n data = recfromtxt(f, delimiter=\",\", names=True, dtype=float)\n return data", "metadata": "root._get_data", "header": "['module', '___EOS___']", "index": 84 } ]
[ { "span": "from numpy import recfromtxt, column_stack, array", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "RAN", "D", " ", "Health", " ", "Ins", "uran", "ce", " ", "Experiment", " ", "Data", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "docformat", "\\u\\u_", "=_", "'", "restructur", "edt", "ext", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COPY", "RIGHT_", "=_", "\"\"\"", "Thi", "s", " ", "is", " ", "in", " ", "the", " ", "public", " ", "domain", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TITLE_", "=_", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SOURCE_", "=_", "\"\"\"", "\\", "10", ";", "The", " ", "data", " ", "was", " ", "collected", " ", "by", " ", "the", " ", "RAN", "D", " ", "corporat", "ion", " ", "as", " ", "part", " ", "of", " ", "the", " ", "Health", "\\", "10", ";", "Ins", "uran", "ce", " ", "Experiment", " ", "(", "HI", "E", ").", "\\", "10", ";", "\\", "10", ";", "http", "://", "www", ".", "rand", ".", "org", "/", "health", "/", "project", "s", "/", "hi", "e", ".", "html", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "data", " ", "was", " ", "used", " ", "in", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Came", "ron", ",", " ", "A", ".", "C", ".", " ", "am", "d", " ", "Tri", "ved", "i", ",", " ", "P", ".", "K", ".", " ", "2005", ".", " ", " ", "`", "Micro", "econom", "etric", "s", ":", " ", "Meth", "ods", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "Applica", "tion", "s", ",", "`", " ", "Cam", "bridge", ":", " ", "New", " ", "Yo", "rk", ".", "\\", "10", ";", "\\", "10", ";", "And", " ", "was", " ", "obtain", "ed", " ", "from", ":", " ", "<", "http", "://", "came", "ron", ".", "eco", "n", ".", "uc", "davi", "s", ".", "edu", "/", "mma", "book", "/", "mma", "data", ".", "html", ">", "\\", "10", ";", "\\", "10", ";", "See", " ", "rand", "hi", "e", "/", "src", " ", "for", " ", "the", " ", "original", " ", "data", " ", "and", " ", "description", ".", " ", " ", "The", " ", "data", " ", "include", "d", "\\", "10", ";", "here", " ", "contain", "s", " ", "only", " ", "a", " ", "subse", "t", " ", "of", " ", "the", " ", "original", " ", "data", ".", " ", " ", "The", " ", "data", " ", "vari", "es", " ", "slight", "ly", "\\", "10", ";", "compare", "d", " ", "to", " ", "tha", "t", " ", "reporte", "d", " ", "in", " ", "Came", "ron", " ", "and", " ", "Tri", "ved", "i", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DESC", "RS", "HOR", "T_", "=_", "\"\"\"", "The", " ", "RAN", "D", " ", "Co", ".", " ", "Health", " ", "Ins", "uran", "ce", " ", "Experiment", " ", "Data", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DESC", "RL", "ONG", "_", "=_", "\"\"\"\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NOTE", "_", "=_", "\"\"\"", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Number", " ", "of", " ", "observa", "tion", "s", " ", "-", " ", "20", ",", "190", "\\", "10", ";", " ", " ", " ", " ", "Number", " ", "of", " ", "variab", "les", " ", "-", " ", "10", "\\", "10", ";", " ", " ", " ", " ", "Varia", "ble", " ", "name", " ", "definit", "ion", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "md", "vis", " ", " ", " ", "-", " ", "Number", " ", "of", " ", "outp", "ati", "ent", " ", "visits", " ", "to", " ", "an", " ", "MD", "\\", "10", ";", " ", " ", " ", " ", "ln", "coins", " ", "-", " ", "ln", "(", "coins", "uran", "ce", " ", "+", " ", "1", "),", " ", "0", " ", "<=", " ", "con", "insu", "rance", " ", "<=", " ", "100", "\\", "10", ";", " ", " ", " ", " ", "idp", " ", "-", " ", "1", " ", "if", " ", "individual", " ", "deduc", "tib", "le", " ", "plan", ",", " ", "0", " ", "other", "wis", "e", "\\", "10", ";", " ", " ", " ", " ", "lp", "i", " ", "-", " ", "ln", "(", "max", "(", "1", ",", " ", "annual", " ", "participati", "on", " ", "inc", "enti", "ve", " ", "pay", "ment", "))\\", "10", ";", " ", " ", " ", " ", "fm", "de", " ", " ", " ", " ", "-", " ", "0", " ", "if", " ", "idp", " ", "=", " ", "1", ";", " ", "ln", "(", "max", "(", "1", ",", " ", "MD", "E", "/(", "0.01", " ", "coins", "uran", "ce", ")))", " ", "other", "wis", "e", "\\", "10", ";", " ", " ", " ", " ", "phys", "lm", " ", " ", "-", " ", "1", " ", "if", " ", "the", " ", "person", " ", "has", " ", "a", " ", "physical", " ", "limit", "ation", "\\", "10", ";", " ", " ", " ", " ", "dis", "ea", " ", " ", " ", "-", " ", "number", " ", "of", " ", "chron", "ic", " ", "disease", "s", "\\", "10", ";", " ", " ", " ", " ", "hl", "th", "g", " ", " ", " ", "-", " ", "1", " ", "if", " ", "self", "-", "rated", " ", "health", " ", "is", " ", "good", "\\", "10", ";", " ", " ", " ", " ", "hl", "th", "f", " ", " ", " ", "-", " ", "1", " ", "if", " ", "self", "-", "rated", " ", "health", " ", "is", " ", "fair", "\\", "10", ";", " ", " ", " ", " ", "hl", "th", "p", " ", " ", " ", "-", " ", "1", " ", "if", " ", "self", "-", "rated", " ", "health", " ", "is", " ", "poo", "r", "\\", "10", ";", " ", " ", " ", " ", "(", "Om", "itte", "d", " ", "category", " ", "is", " ", "exce", "llen", "t", " ", "self", "-", "rated", " ", "health", ")", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "import_", "rec", "from", "txt_", ",_", "column", "\\u", "stack_", ",_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "datasets_", "import_", "utils_", "as_", "du_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "dirname_", ",_", "abspath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PATH_", "=_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "dirname_", "(_", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "'", "rand", "hi", "e", ".", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "def_", "load_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", "s", " ", "the", " ", "RAN", "D", " ", "HI", "E", " ", "data", " ", "and", " ", "return", "s", " ", "a", " ", "Datas", "et", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "endo", "g", " ", "-", " ", "response", " ", "variab", "le", ",", " ", "md", "vis", "\\", "10", ";", " ", " ", " ", " ", "exo", "g", " ", "-", " ", "design", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "instance", ":", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "class", " ", "of", " ", "the", " ", "data", " ", "with", " ", "array", " ", "attr", "but", "es", " ", "'", "endo", "g", "'", " ", "and", " ", "'", "exo", "g", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "\\u", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "du_", "._", "process", "\\u", "reca", "rray_", "(_", "data_", ",_", "endo", "g", "\\u", "idx_", "=_", "0_", ",_", "dtype_", "=_", "float_", ")_", "\\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_", "load", "\\u", "pandas_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", "s", " ", "the", " ", "RAN", "D", " ", "HI", "E", " ", "data", " ", "and", " ", "return", "s", " ", "a", " ", "Datas", "et", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "endo", "g", " ", "-", " ", "response", " ", "variab", "le", ",", " ", "md", "vis", "\\", "10", ";", " ", " ", " ", " ", "exo", "g", " ", "-", " ", "design", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "instance", ":", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "class", " ", "of", " ", "the", " ", "data", " ", "with", " ", "array", " ", "attr", "but", "es", " ", "'", "endo", "g", "'", " ", "and", " ", "'", "exo", "g", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "import_", "read", "\\u", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "read", "\\u", "csv_", "(_", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "du_", "._", "process", "\\u", "reca", "rray", "\\u", "pandas_", "(_", "data_", ",_", "endo", "g", "\\u", "idx_", "=_", "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_", "\\u", "get", "\\u", "data_", "(_", ")_", ":_", "\\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 ", " _", "data_", "=_", "rec", "from", "txt_", "(_", "f_", ",_", "delimiter_", "=_", "\",\"_", ",_", "names_", "=_", "True_", ",_", "dtype_", "=_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_" ]
[ 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,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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, 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 ]
Unused import
lebedov/scikit-cuda/skcuda/cusparse.py
[ { "content": "#!/usr/bin/env python\n\n\"\"\"\nPython interface to CUSPARSE functions.\n\nNote: this module does not explicitly depend on PyCUDA.\n\"\"\"\n\nimport atexit\nimport ctypes.util\nimport platform\nfrom string import Template\nimport sys\nimport warnings\n\nimport numpy as np\n\nimport cuda\n\n# Load library:\n_version_list = [7.5, 7.0, 6.5, 6.0, 5.5, 5.0, 4.0]\nif 'linux' in sys.platform:\n _libcusparse_libname_list = ['libcusparse.so'] + \\\n ['libcusparse.so.%s' % v for v in _version_list]\nelif sys.platform == 'darwin':\n _libcusparse_libname_list = ['libcusparse.dylib']\nelif sys.platform == 'win32':\n if platform.machine().endswith('64'):\n _libcusparse_libname_list = ['cusparse.dll'] + \\\n ['cusparse64_%s.dll' % int(10*v) for v in _version_list]\n else:\n _libcusparse_libname_list = ['cusparse.dll'] + \\\n ['cusparse32_%s.dll' % int(10*v) for v in _version_list]\nelse:\n raise RuntimeError('unsupported platform')\n\n# Print understandable error message when library cannot be found:\n_libcusparse = None\nfor _libcusparse_libname in _libcusparse_libname_list:\n try:\n if sys.platform == 'win32':\n _libcusparse = ctypes.windll.LoadLibrary(_libcusparse_libname)\n else:\n _libcusparse = ctypes.cdll.LoadLibrary(_libcusparse_libname)\n except OSError:\n pass\n else:\n break\nif _libcusparse == None:\n OSError('CUDA sparse library not found')\n\n\n\n\n\n\n\n\n\n\ncusparseExceptions = {\n 1: cusparseStatusNotInitialized,\n 2: cusparseStatusAllocFailed,\n 3: cusparseStatusInvalidValue,\n 4: cusparseStatusArchMismatch,\n 5: cusparseStatusMappingError,\n 6: cusparseStatusExecutionFailed,\n 7: cusparseStatusInternalError,\n 8: cusparseStatusMatrixTypeNotSupported,\n }\n\n# Matrix types:\nCUSPARSE_MATRIX_TYPE_GENERAL = 0\nCUSPARSE_MATRIX_TYPE_SYMMETRIC = 1\nCUSPARSE_MATRIX_TYPE_HERMITIAN = 2\nCUSPARSE_MATRIX_TYPE_TRIANGULAR = 3\n\nCUSPARSE_FILL_MODE_LOWER = 0\nCUSPARSE_FILL_MODE_UPPER = 1\n\n# Whether or not a matrix' diagonal entries are unity:\nCUSPARSE_DIAG_TYPE_NON_UNIT = 0\nCUSPARSE_DIAG_TYPE_UNIT = 1\n\n# Matrix index bases:\nCUSPARSE_INDEX_BASE_ZERO = 0\nCUSPARSE_INDEX_BASE_ONE = 1\n\n# Operation types:\nCUSPARSE_OPERATION_NON_TRANSPOSE = 0\nCUSPARSE_OPERATION_TRANSPOSE = 1\nCUSPARSE_OPERATION_CONJUGATE_TRANSPOSE = 2\n\n# Whether or not to parse elements of a dense matrix row or column-wise.\nCUSPARSE_DIRECTION_ROW = 0\nCUSPARSE_DIRECTION_COLUMN = 1\n\n# Helper functions:\n\n\n_libcusparse.cusparseCreate.restype = int\n_libcusparse.cusparseCreate.argtypes = [ctypes.c_void_p]\n\n_libcusparse.cusparseDestroy.restype = int\n_libcusparse.cusparseDestroy.argtypes = [ctypes.c_int]\n\n_libcusparse.cusparseGetVersion.restype = int\n_libcusparse.cusparseGetVersion.argtypes = [ctypes.c_int,\n ctypes.c_void_p]\n\n_libcusparse.cusparseSetStream.restype = int\n_libcusparse.cusparseSetStream.argtypes = [ctypes.c_int,\n ctypes.c_int]\n\n_libcusparse.cusparseCreateMatDescr.restype = int\n_libcusparse.cusparseCreateMatDescr.argtypes = [cusparseMatDescr]\n\n_libcusparse.cusparseDestroyMatDescr.restype = int\n_libcusparse.cusparseDestroyMatDescr.argtypes = [ctypes.c_int]\n\n_libcusparse.cusparseSetMatType.restype = int\n_libcusparse.cusparseSetMatType.argtypes = [cusparseMatDescr,\n ctypes.c_int]\n\n_libcusparse.cusparseGetMatType.restype = int\n_libcusparse.cusparseGetMatType.argtypes = [cusparseMatDescr] \n\n# Format conversion functions:\n_libcusparse.cusparseSnnz.restype = int\n_libcusparse.cusparseSnnz.argtypes = [ctypes.c_int,\n ctypes.c_int,\n ctypes.c_int,\n ctypes.c_int,\n cusparseMatDescr,\n ctypes.c_void_p,\n ctypes.c_int,\n ctypes.c_void_p,\n ctypes.c_void_p]\n\n_libcusparse.cusparseSdense2csr.restype = int\n_libcusparse.cusparseSdense2csr.argtypes = [ctypes.c_int,\n ctypes.c_int,\n ctypes.c_int,\n cusparseMatDescr,\n ctypes.c_void_p,\n ctypes.c_int,\n ctypes.c_void_p,\n ctypes.c_void_p,\n ctypes.c_void_p,\n ctypes.c_void_p]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class cusparseError(Exception):\n \"\"\"CUSPARSE error\"\"\"\n pass", "metadata": "root.cusparseError", "header": "['module', '___EOS___']", "index": 51 }, { "content": "class cusparseStatusNotInitialized(cusparseError):\n \"\"\"CUSPARSE library not initialized\"\"\"\n pass", "metadata": "root.cusparseStatusNotInitialized", "header": "['module', '___EOS___']", "index": 55 }, { "content": "class cusparseStatusAllocFailed(cusparseError):\n \"\"\"CUSPARSE resource allocation failed\"\"\"\n pass", "metadata": "root.cusparseStatusAllocFailed", "header": "['module', '___EOS___']", "index": 59 }, { "content": "class cusparseStatusInvalidValue(cusparseError):\n \"\"\"Unsupported value passed to the function\"\"\"\n pass", "metadata": "root.cusparseStatusInvalidValue", "header": "['module', '___EOS___']", "index": 63 }, { "content": "class cusparseStatusArchMismatch(cusparseError):\n \"\"\"Function requires a feature absent from the device architecture\"\"\"\n pass", "metadata": "root.cusparseStatusArchMismatch", "header": "['module', '___EOS___']", "index": 67 }, { "content": "class cusparseStatusMappingError(cusparseError):\n \"\"\"An access to GPU memory space failed\"\"\"\n pass", "metadata": "root.cusparseStatusMappingError", "header": "['module', '___EOS___']", "index": 71 }, { "content": "class cusparseStatusExecutionFailed(cusparseError):\n \"\"\"GPU program failed to execute\"\"\"\n pass", "metadata": "root.cusparseStatusExecutionFailed", "header": "['module', '___EOS___']", "index": 75 }, { "content": "class cusparseStatusInternalError(cusparseError):\n \"\"\"An internal CUSPARSE operation failed\"\"\"\n pass", "metadata": "root.cusparseStatusInternalError", "header": "['module', '___EOS___']", "index": 79 }, { "content": "class cusparseStatusMatrixTypeNotSupported(cusparseError):\n \"\"\"The matrix type is not supported by this function\"\"\"\n pass", "metadata": "root.cusparseStatusMatrixTypeNotSupported", "header": "['module', '___EOS___']", "index": 83 }, { "content": "class cusparseMatDescr(ctypes.Structure):\n _fields_ = [\n ('MatrixType', ctypes.c_int),\n ('FillMode', ctypes.c_int),\n ('DiagType', ctypes.c_int),\n ('IndexBase', ctypes.c_int)\n ]", "metadata": "root.cusparseMatDescr", "header": "['module', '___EOS___']", "index": 125 }, { "content": "def cusparseCheckStatus(status):\n \"\"\"\n Raise CUSPARSE exception\n\n Raise an exception corresponding to the specified CUSPARSE error\n code.\n\n Parameters\n ----------\n status : int\n CUSPARSE error code.\n\n See Also\n --------\n cusparseExceptions\n\n \"\"\"\n\n if status != 0:\n try:\n raise cusparseExceptions[status]\n except KeyError:\n raise cusparseError", "metadata": "root.cusparseCheckStatus", "header": "['module', '___EOS___']", "index": 133 }, { "content": "def cusparseCreate():\n \"\"\"\n Initialize CUSPARSE.\n\n Initializes CUSPARSE and creates a handle to a structure holding\n the CUSPARSE library context.\n\n Returns\n -------\n handle : int\n CUSPARSE library context.\n\n \"\"\"\n\n handle = ctypes.c_int()\n status = _libcusparse.cusparseCreate(ctypes.byref(handle))\n cusparseCheckStatus(status)\n return handle.value", "metadata": "root.cusparseCreate", "header": "['module', '___EOS___']", "index": 159 }, { "content": "def cusparseDestroy(handle):\n \"\"\"\n Release CUSPARSE resources.\n\n Releases hardware resources used by CUSPARSE\n\n Parameters\n ----------\n handle : int\n CUSPARSE library context.\n\n \"\"\"\n\n status = _libcusparse.cusparseDestroy(handle)\n cusparseCheckStatus(status)", "metadata": "root.cusparseDestroy", "header": "['module', '___EOS___']", "index": 180 }, { "content": "def cusparseGetVersion(handle):\n \"\"\"\n Return CUSPARSE library version.\n\n Returns the version number of the CUSPARSE library.\n\n Parameters\n ----------\n handle : int\n CUSPARSE library context.\n\n Returns\n -------\n version : int\n CUSPARSE library version number.\n\n \"\"\"\n\n version = ctypes.c_int()\n status = _libcusparse.cusparseGetVersion(handle,\n ctypes.byref(version))\n cusparseCheckStatus(status)\n return version.value", "metadata": "root.cusparseGetVersion", "header": "['module', '___EOS___']", "index": 199 }, { "content": "def cusparseSetStream(handle, id):\n \"\"\"\n Sets the CUSPARSE stream in which kernels will run.\n\n Parameters\n ----------\n handle : int\n CUSPARSE library context.\n id : int\n Stream ID.\n\n \"\"\"\n\n status = _libcusparse.cusparseSetStream(handle, id)\n cusparseCheckStatus(status)", "metadata": "root.cusparseSetStream", "header": "['module', '___EOS___']", "index": 226 }, { "content": "def cusparseCreateMatDescr():\n \"\"\"\n Initialize a sparse matrix descriptor.\n\n Initializes the `MatrixType` and `IndexBase` fields of the matrix\n descriptor to the default values `CUSPARSE_MATRIX_TYPE_GENERAL`\n and `CUSPARSE_INDEX_BASE_ZERO`.\n\n Returns\n -------\n desc : cusparseMatDescr\n Matrix descriptor.\n\n \"\"\"\n\n desc = cusparseMatrixDesc()\n status = _libcusparse.cusparseCreateMatDescr(ctypes.byref(desc))\n cusparseCheckStatus(status)\n return desc", "metadata": "root.cusparseCreateMatDescr", "header": "['module', '___EOS___']", "index": 244 }, { "content": "def cusparseDestroyMatDescr(desc):\n \"\"\"\n Releases the memory allocated for the matrix descriptor.\n\n Parameters\n ----------\n desc : cusparseMatDescr\n Matrix descriptor.\n\n \"\"\"\n\n status = _libcusparse.cusparseDestroyMatDescr(desc)\n cusparseCheckStatus(status)", "metadata": "root.cusparseDestroyMatDescr", "header": "['module', '___EOS___']", "index": 266 }, { "content": "def cusparseSetMatType(desc, type):\n \"\"\"\n Sets the matrix type of the specified matrix.\n\n Parameters\n ----------\n desc : cusparseMatDescr\n Matrix descriptor.\n type : int\n Matrix type.\n\n \"\"\"\n\n status = _libcusparse.cusparseSetMatType(desc, type)\n cusparseCheckStatus(status)", "metadata": "root.cusparseSetMatType", "header": "['module', '___EOS___']", "index": 283 }, { "content": "def cusparseGetMatType(desc):\n \"\"\"\n Gets the matrix type of the specified matrix.\n\n Parameters\n ----------\n desc : cusparseMatDescr\n Matrix descriptor.\n\n Returns\n -------\n type : int\n Matrix type.\n\n \"\"\"\n\n return _libcusparse.cusparseGetMatType(desc)", "metadata": "root.cusparseGetMatType", "header": "['module', '___EOS___']", "index": 301 }, { "content": "def cusparseSnnz(handle, dirA, m, n, descrA, A, lda, \n nnzPerRowColumn, nnzTotalDevHostPtr):\n \"\"\"\n Compute number of non-zero elements per row, column, or dense matrix.\n\n Parameters\n ----------\n handle : int\n CUSPARSE library context.\n dirA : int\n Data direction of elements.\n m : int\n Rows in A.\n n : int\n Columns in A.\n descrA : cusparseMatDescr\n Matrix descriptor.\n A : pycuda.gpuarray.GPUArray\n Dense matrix of dimensions (lda, n).\n lda : int\n Leading dimension of A.\n \n Returns\n -------\n nnzPerRowColumn : pycuda.gpuarray.GPUArray\n Array of length m or n containing the number of \n non-zero elements per row or column, respectively.\n nnzTotalDevHostPtr : pycuda.gpuarray.GPUArray\n Total number of non-zero elements in device or host memory.\n\n \"\"\"\n\n # Unfinished:\n nnzPerRowColumn = gpuarray.empty()\n nnzTotalDevHostPtr = gpuarray.empty()\n\n status = _libcusparse.cusparseSnnz(handle, dirA, m, n, \n descrA, int(A), lda,\n int(nnzPerRowColumn), int(nnzTotalDevHostPtr))\n cusparseCheckStatus(status)\n return nnzPerVector, nnzHost", "metadata": "root.cusparseSnnz", "header": "['module', '___EOS___']", "index": 330 }, { "content": "def cusparseSdense2csr(handle, m, n, descrA, A, lda, \n nnzPerRow, csrValA, csrRowPtrA, csrColIndA):\n # Unfinished\n pass", "metadata": "root.cusparseSdense2csr", "header": "['module', '___EOS___']", "index": 383 } ]
[ { "span": "import atexit", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 13 }, { "span": "from string import Template", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 27 }, { "span": "import warnings", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 15 }, { "span": "import numpy as np", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 18 }, { "span": "import cuda", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 11 } ]
[]
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", ";", "Pyth", "on", " ", "interface", " ", "to", " ", "CU", "SPAR", "SE", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", "Not", "e", ":", " ", "this", " ", "module", " ", "doe", "s", " ", "not", " ", "explicit", "ly", " ", "depend", " ", "on", " ", "Py", "CU", "DA", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "atexit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ctypes_", "._", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "string_", "import_", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cuda_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "librar", "y", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "version", "\\u", "list_", "=_", "[_", "7.5_", ",_", "7.0_", ",_", "6.5", "_", ",_", "6.0_", ",_", "5.5_", ",_", "5.0_", ",_", "4.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "linux", "'_", "in_", "sys_", "._", "platform_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "libc", "usp", "arse", "\\u", "libname", "\\u", "list_", "=_", "[_", "'", "libc", "usp", "arse", ".", "so", "'_", "]_", "+_", "[_", "'", "libc", "usp", "arse", ".", "so", ".", "%", "s", "'_", "%_", "v_", "for_", "v_", "in_", "\\u", "version", "\\u", "list_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "libc", "usp", "arse", "\\u", "libname", "\\u", "list_", "=_", "[_", "'", "libc", "usp", "arse", ".", "dylib", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "'", "win32", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "platform_", "._", "machine_", "(_", ")_", "._", "endswith_", "(_", "'", "64", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "libc", "usp", "arse", "\\u", "libname", "\\u", "list_", "=_", "[_", "'", "cus", "parse", ".", "dll", "'_", "]_", "+_", "[_", "'", "cus", "parse", "64", "\\u", "%", "s", ".", "dll", "'_", "%_", "int_", "(_", "10_", "*_", "v_", ")_", "for_", "v_", "in_", "\\u", "version", "\\u", "list_", "]_", "\\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", "libc", "usp", "arse", "\\u", "libname", "\\u", "list_", "=_", "[_", "'", "cus", "parse", ".", "dll", "'_", "]_", "+_", "[_", "'", "cus", "parse", "32", "\\u", "%", "s", ".", "dll", "'_", "%_", "int_", "(_", "10_", "*_", "v_", ")_", "for_", "v_", "in_", "\\u", "version", "\\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 ", " _", "raise_", "Run", "time", "Error_", "(_", "'", "unsup", "porte", "d", " ", "platform", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "underst", "anda", "ble", " ", "error", " ", "message", " ", "whe", "n", " ", "librar", "y", " ", "cann", "ot", " ", "be", " ", "found", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "libc", "usp", "arse", "\\u", "libname", "_", "in_", "\\u", "libc", "usp", "arse", "\\u", "libname", "\\u", "list_", ":_", "\\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_", "sys_", "._", "platform_", "==_", "'", "win32", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "libc", "usp", "arse_", "=_", "ctypes_", "._", "windll_", "._", "Load", "Library_", "(_", "\\u", "libc", "usp", "arse", "\\u", "libname", "_", ")_", "\\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", "libc", "usp", "arse_", "=_", "ctypes_", "._", "cdl", "l_", "._", "Load", "Library_", "(_", "\\u", "libc", "usp", "arse", "\\u", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\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 ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "libc", "usp", "arse_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "OSE", "rror_", "(_", "'", "CU", "DA", " ", "spars", "e", " ", "librar", "y", " ", "not", " ", "found", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "cus", "parse", "Exceptions_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "cus", "parse", "Status", "Not", "Initialized", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "cus", "parse", "Status", "Alloc", "Failed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "cus", "parse", "Status", "Inva", "lid", "Value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "cus", "parse", "Status", "Arch", "Mismatch", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "cus", "parse", "Status", "Map", "ping", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "6_", ":_", "cus", "parse", "Status", "Execut", "ion", "Failed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "7_", ":_", "cus", "parse", "Status", "Intern", "al", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "8_", ":_", "cus", "parse", "Status", "Matrix", "Type", "Not", "Supported_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Matrix", " ", "types", ":_", "\\u\\u\\uNL\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "MATRIX", "\\u", "TYPE", "\\u", "GENERAL", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "MATRIX", "\\u", "TYPE", "\\u", "SYM", "METRIC", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "MATRIX", "\\u", "TYPE", "\\u", "HER", "MIT", "IAN", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "MATRIX", "\\u", "TYPE", "\\u", "TRIA", "NG", "ULA", "R_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "FILL", "\\u", "MODE", "\\u", "LOWER", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "FILL", "\\u", "MODE", "\\u", "UPPER", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "ther", " ", "or", " ", "not", " ", "a", " ", "matrix", "'", " ", "diagonal", " ", "entri", "es", " ", "are", " ", "unity", ":_", "\\u\\u\\uNL\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "DIA", "G", "\\u", "TYPE", "\\u", "NON", "\\u", "UNIT", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "DIA", "G", "\\u", "TYPE", "\\u", "UNIT", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Matrix", " ", "index", " ", "base", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "INDE", "X", "\\u", "BASE", "\\u", "ZERO_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "INDE", "X", "\\u", "BASE", "\\u", "ONE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Opera", "tion", " ", "types", ":_", "\\u\\u\\uNL\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "OPERATION", "\\u", "NON", "\\u", "TRANSP", "OSE", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "OPERATION", "\\u", "TRANSP", "OSE", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "OPERATION", "\\u", "CON", "JU", "GAT", "E", "\\u", "TRANSP", "OSE", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "ther", " ", "or", " ", "not", " ", "to", " ", "parse", " ", "element", "s", " ", "of", " ", "a", " ", "dens", "e", " ", "matrix", " ", "row", " ", "or", " ", "column", "-", "wis", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "DIRECTION", "\\u", "ROW", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CU", "SPAR", "SE", "\\u", "DIRECTION", "\\u", "COLUMN_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Help", "er", " ", "function", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Create_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Create_", "._", "argtypes_", "=_", "[_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Destroy_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Destroy_", "._", "argtypes_", "=_", "[_", "ctypes_", "._", "c\\u", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Get", "Version_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Get", "Version_", "._", "argtypes_", "=_", "[_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Set", "Stream_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Set", "Stream_", "._", "argtypes_", "=_", "[_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Creat", "e", "Mat", "Descr", "_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Creat", "e", "Mat", "Descr", "_", "._", "argtypes_", "=_", "[_", "cus", "parse", "Mat", "Descr", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Destr", "oy", "Mat", "Descr", "_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Destr", "oy", "Mat", "Descr", "_", "._", "argtypes_", "=_", "[_", "ctypes_", "._", "c\\u", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Set", "Mat", "Type_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Set", "Mat", "Type_", "._", "argtypes_", "=_", "[_", "cus", "parse", "Mat", "Descr", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Get", "Mat", "Type_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Get", "Mat", "Type_", "._", "argtypes_", "=_", "[_", "cus", "parse", "Mat", "Descr", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Format", " ", "conve", "rsi", "on", " ", "function", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Sn", "nz_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Sn", "nz_", "._", "argtypes_", "=_", "[_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cus", "parse", "Mat", "Descr", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Sd", "ense", "2c", "sr_", "._", "restype_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Sd", "ense", "2c", "sr_", "._", "argtypes_", "=_", "[_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cus", "parse", "Mat", "Descr", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\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_", "cus", "parse", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "CU", "SPAR", "SE", " ", "error", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "class_", "cus", "parse", "Status", "Not", "Initialized", "_", "(_", "cus", "parse", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "CU", "SPAR", "SE", " ", "librar", "y", " ", "not", " ", "initialize", "d", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "class_", "cus", "parse", "Status", "Alloc", "Failed_", "(_", "cus", "parse", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "CU", "SPAR", "SE", " ", "resource", " ", "allocat", "ion", " ", "fail", "ed", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "class_", "cus", "parse", "Status", "Inva", "lid", "Value_", "(_", "cus", "parse", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Unsu", "ppo", "rted", " ", "value", " ", "pass", "ed", " ", "to", " ", "the", " ", "function", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "class_", "cus", "parse", "Status", "Arch", "Mismatch", "_", "(_", "cus", "parse", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Function", " ", "require", "s", " ", "a", " ", "feature", " ", "absen", "t", " ", "from", " ", "the", " ", "device", " ", "architecture", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "class_", "cus", "parse", "Status", "Map", "ping", "Error_", "(_", "cus", "parse", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "access", " ", "to", " ", "GPU", " ", "memory", " ", "space", " ", "fail", "ed", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "class_", "cus", "parse", "Status", "Execut", "ion", "Failed_", "(_", "cus", "parse", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "GPU", " ", "program", " ", "fail", "ed", " ", "to", " ", "execute", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "class_", "cus", "parse", "Status", "Intern", "al", "Error_", "(_", "cus", "parse", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "internal", " ", "CU", "SPAR", "SE", " ", "operati", "on", " ", "fail", "ed", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "class_", "cus", "parse", "Status", "Matrix", "Type", "Not", "Supported_", "(_", "cus", "parse", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "matrix", " ", "type", " ", "is", " ", "not", " ", "support", "ed", " ", "by", " ", "this", " ", "function", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "cus", "parse", "Mat", "Descr", "_", "(_", "ctypes_", "._", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fields\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Matrix", "Type", "'_", ",_", "ctypes_", "._", "c\\u", "int_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Fil", "l", "Mode", "'_", ",_", "ctypes_", "._", "c\\u", "int_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Diag", "Type", "'_", ",_", "ctypes_", "._", "c\\u", "int_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Index", "Base", "'_", ",_", "ctypes_", "._", "c\\u", "int_", ")_", "\\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_", "def_", "cus", "parse", "Check", "Status_", "(_", "status_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "se", " ", "CU", "SPAR", "SE", " ", "exception", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "se", " ", "an", " ", "exception", " ", "correspond", "ing", " ", "to", " ", "the", " ", "specified", " ", "CU", "SPAR", "SE", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "code", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "status", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "CU", "SPAR", "SE", " ", "error", " ", "code", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Al", "so", "\\", "10", ";", " ", " ", " ", " ", "--------", "\\", "10", ";", " ", " ", " ", " ", "cus", "parse", "Except", "ion", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "status_", "!=_", "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 ", " _", "raise_", "cus", "parse", "Exceptions_", "[_", "status_", "]_", "\\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 ", " _", "raise_", "cus", "parse", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "e", " ", "CU", "SPAR", "SE", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "es", " ", "CU", "SPAR", "SE", " ", "and", " ", "create", "s", " ", "a", " ", "handle", " ", "to", " ", "a", " ", "structure", " ", "holding", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "CU", "SPAR", "SE", " ", "librar", "y", " ", "context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "handle", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "CU", "SPAR", "SE", " ", "librar", "y", " ", "context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle_", "=_", "ctypes_", "._", "c\\u", "int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Create_", "(_", "ctypes_", "._", "byref_", "(_", "handle_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cus", "parse", "Check", "Status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "handle_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Destroy_", "(_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Release", " ", "CU", "SPAR", "SE", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Release", "s", " ", "hard", "ware", " ", "resource", "s", " ", "used", " ", "by", " ", "CU", "SPAR", "SE", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "handle", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "CU", "SPAR", "SE", " ", "librar", "y", " ", "context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Destroy_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cus", "parse", "Check", "Status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Get", "Version_", "(_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "CU", "SPAR", "SE", " ", "librar", "y", " ", "version", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "version", " ", "number", " ", "of", " ", "the", " ", "CU", "SPAR", "SE", " ", "librar", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "handle", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "CU", "SPAR", "SE", " ", "librar", "y", " ", "context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "version", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "CU", "SPAR", "SE", " ", "librar", "y", " ", "version", " ", "number", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "ctypes_", "._", "c\\u", "int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Get", "Version_", "(_", "handle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "._", "byref_", "(_", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cus", "parse", "Check", "Status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "version_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Set", "Stream_", "(_", "handle_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "the", " ", "CU", "SPAR", "SE", " ", "stream", " ", "in", " ", "whi", "ch", " ", "kernels", " ", "will", " ", "run", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "handle", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "CU", "SPAR", "SE", " ", "librar", "y", " ", "context", ".", "\\", "10", ";", " ", " ", " ", " ", "id", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Stream", " ", "ID", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Set", "Stream_", "(_", "handle_", ",_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cus", "parse", "Check", "Status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Creat", "e", "Mat", "Descr", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "e", " ", "a", " ", "spars", "e", " ", "matrix", " ", "descrip", "tor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "es", " ", "the", " ", "`", "Matrix", "Type", "`", " ", "and", " ", "`", "Index", "Base", "`", " ", "fields", " ", "of", " ", "the", " ", "matrix", "\\", "10", ";", " ", " ", " ", " ", "descrip", "tor", " ", "to", " ", "the", " ", "default", " ", "values", " ", "`", "CU", "SPAR", "SE", "\\u", "MATRIX", "\\u", "TYPE", "\\u", "GENERAL", "`", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "`", "CU", "SPAR", "SE", "\\u", "INDE", "X", "\\u", "BASE", "\\u", "ZERO", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "desc", " ", ":", " ", "cus", "parse", "Mat", "Descr", "\\", "10", ";", " ", " ", " ", " ", "Matrix", " ", "descrip", "tor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "cus", "parse", "Matrix", "Desc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Creat", "e", "Mat", "Descr", "_", "(_", "ctypes_", "._", "byref_", "(_", "desc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cus", "parse", "Check", "Status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "desc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Destr", "oy", "Mat", "Descr", "_", "(_", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Release", "s", " ", "the", " ", "memory", " ", "allocated", " ", "for", " ", "the", " ", "matrix", " ", "descrip", "tor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "desc", " ", ":", " ", "cus", "parse", "Mat", "Descr", "\\", "10", ";", " ", " ", " ", " ", "Matrix", " ", "descrip", "tor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Destr", "oy", "Mat", "Descr", "_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cus", "parse", "Check", "Status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Set", "Mat", "Type_", "(_", "desc_", ",_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "the", " ", "matrix", " ", "type", " ", "of", " ", "the", " ", "specified", " ", "matrix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "desc", " ", ":", " ", "cus", "parse", "Mat", "Descr", "\\", "10", ";", " ", " ", " ", " ", "Matrix", " ", "descrip", "tor", ".", "\\", "10", ";", " ", " ", " ", " ", "type", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Matrix", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Set", "Mat", "Type_", "(_", "desc_", ",_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cus", "parse", "Check", "Status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Get", "Mat", "Type_", "(_", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", "s", " ", "the", " ", "matrix", " ", "type", " ", "of", " ", "the", " ", "specified", " ", "matrix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "desc", " ", ":", " ", "cus", "parse", "Mat", "Descr", "\\", "10", ";", " ", " ", " ", " ", "Matrix", " ", "descrip", "tor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "type", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Matrix", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Get", "Mat", "Type_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Sn", "nz_", "(_", "handle_", ",_", "dir", "A_", ",_", "m_", ",_", "n_", ",_", "descr", "A_", ",_", "A_", ",_", "lda", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nnz", "Per", "Row", "Column_", ",_", "nnz", "Total", "Dev", "Host", "Ptr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Compute", " ", "number", " ", "of", " ", "non", "-", "zero", " ", "element", "s", " ", "per", " ", "row", ",", " ", "column", ",", " ", "or", " ", "dens", "e", " ", "matrix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "handle", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "CU", "SPAR", "SE", " ", "librar", "y", " ", "context", ".", "\\", "10", ";", " ", " ", " ", " ", "dir", "A", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Data", " ", "direction", " ", "of", " ", "element", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "m", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Row", "s", " ", "in", " ", "A", ".", "\\", "10", ";", " ", " ", " ", " ", "n", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Colum", "ns", " ", "in", " ", "A", ".", "\\", "10", ";", " ", " ", " ", " ", "descr", "A", " ", ":", " ", "cus", "parse", "Mat", "Descr", "\\", "10", ";", " ", " ", " ", " ", "Matrix", " ", "descrip", "tor", ".", "\\", "10", ";", " ", " ", " ", " ", "A", " ", ":", " ", "pyc", "uda", ".", "gpu", "array", ".", "GPU", "Array", "\\", "10", ";", " ", " ", " ", " ", "Den", "se", " ", "matrix", " ", "of", " ", "dimension", "s", " ", "(", "lda", ",", " ", "n", ").", "\\", "10", ";", " ", " ", " ", " ", "lda", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Lead", "ing", " ", "dimension", " ", "of", " ", "A", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "nnz", "Per", "Row", "Colum", "n", " ", ":", " ", "pyc", "uda", ".", "gpu", "array", ".", "GPU", "Array", "\\", "10", ";", " ", " ", " ", " ", "Array", " ", "of", " ", "length", " ", "m", " ", "or", " ", "n", " ", "contain", "ing", " ", "the", " ", "number", " ", "of", " ", "\\", "10", ";", " ", " ", " ", " ", "non", "-", "zero", " ", "element", "s", " ", "per", " ", "row", " ", "or", " ", "column", ",", " ", "respec", "tiv", "el", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "nnz", "Total", "Dev", "Host", "Pt", "r", " ", ":", " ", "pyc", "uda", ".", "gpu", "array", ".", "GPU", "Array", "\\", "10", ";", " ", " ", " ", " ", "Total", " ", "number", " ", "of", " ", "non", "-", "zero", " ", "element", "s", " ", "in", " ", "device", " ", "or", " ", "host", " ", "memory", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unf", "ini", "shed", ":_", "\\u\\u\\uNL\\u\\u\\u_", "nnz", "Per", "Row", "Column_", "=_", "gpu", "array_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nnz", "Total", "Dev", "Host", "Ptr_", "=_", "gpu", "array_", "._", "empty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\\u", "libc", "usp", "arse_", "._", "cus", "parse", "Sn", "nz_", "(_", "handle_", ",_", "dir", "A_", ",_", "m_", ",_", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "descr", "A_", ",_", "int_", "(_", "A_", ")_", ",_", "lda", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "nnz", "Per", "Row", "Column_", ")_", ",_", "int_", "(_", "nnz", "Total", "Dev", "Host", "Ptr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cus", "parse", "Check", "Status_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "nnz", "Per", "Vector_", ",_", "nnz", "Host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cus", "parse", "Sd", "ense", "2c", "sr_", "(_", "handle_", ",_", "m_", ",_", "n_", ",_", "descr", "A_", ",_", "A_", ",_", "lda", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nnz", "Per", "Row_", ",_", "csr", "Val", "A_", ",_", "csr", "Row", "Pt", "r", "A_", ",_", "csr", "Col", "Ind", "A_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Unf", "ini", "shed", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 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, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 0, 1, 2, 2, 0, 1, 1, 1, 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, 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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, 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 ]
Variable defined multiple times
rtucker-mozilla/mozilla_inventory/api_v3/system_api.py
[ { "content": " def process_extra(self, bundle, request, **kwargs):\n patch_dict = json.loads(request.POST.items()[0][0])\n\n if patch_dict.has_key('delete_interface') and patch_dict.has_key('interface'):\n patch_dict.pop('delete_interface')\n sys = bundle.obj\n interface = patch_dict.pop('interface', None)\n if sys and interface:\n sys.delete_adapter(interface)\n\n if patch_dict.has_key('update_interface') and patch_dict.has_key('interface'):\n patch_dict.pop('update_interface')\n sys = bundle.obj\n if 'interface' in patch_dict:\n sys.update_adapter(**patch_dict)\n\n ## Entry point for adding a new adapter by mac address via the rest API\n if patch_dict.has_key('mac'):\n\n enable_dns = True\n enable_private = True\n enable_public = False\n sys = bundle.obj\n range = patch_dict.pop('range', None)\n fqdn = patch_dict.pop('fqdn', None)\n ip_str = patch_dict.pop('ip_address', None)\n interface = patch_dict.pop('interface', None)\n domain = patch_dict.pop('domain', 'mozilla.com')\n from core.lib.utils import create_ipv4_intr_from_range\n mac = patch_dict['mac']\n if interface:\n interface_type, primary, alias = SystemResource.extract_nic_attrs(interface)\n else:\n interface_type, primary, alias = sys.get_next_adapter()\n\n if not fqdn:\n domain_parsed = \".\".join(sys.hostname.split('.')[1:]) + '.' + domain\n domain_name = domain_parsed.lower()\n label = sys.hostname.split('.')[0]\n else:\n domain_parsed = \".\".join(fqdn.split('.')[1:])\n domain_name = domain_parsed.lower()\n label = fqdn.split('.')[0]\n\n\n if range:\n range_start_str = range.split(',')[0]\n range_end_str = range.split(',')[1]\n s, errors = create_ipv4_intr_from_range(label, domain_name, sys, mac, range_start_str, range_end_str)\n if ip_str:\n domain = Domain.objects.filter(name=domain_parsed)[0]\n s = StaticInterface(label=label, mac=mac, domain=domain, ip_str=ip_str, ip_type='4', system=sys)\n try:\n if s:\n s.save()\n s.update_attrs()\n if enable_dns and enable_public:\n private = View.objects.get(name='private')\n s.views.add(private)\n s.save()\n\n elif enable_dns and enable_private and not enable_public:\n private = View.objects.get(name='private')\n s.views.add(private)\n s.save()\n\n if interface:\n interface_type, primary, alias = SystemResource.extract_nic_attrs(interface)\n else:\n interface_type, primary, alias = sys.get_next_adapter()\n\n s.attrs.primary = primary\n s.attrs.interface_type = interface_type\n s.attrs.alias = alias\n else:\n print 'We failed'\n bundle.errors['error_message'] = \"Unable to create adapter for unknown reason\"\n raise ValidationError(join(e.messages))\n except ValidationError, e:\n bundle.errors['error_message'] = \" \".join(e.messages)\n raise ValidationError(join(e.messages))\n except Exception, e:\n print e", "metadata": "root.SystemResource.process_extra", "header": "['class', 'SystemResource', '(', 'CustomAPIResource', ')', ':', '___EOS___']", "index": 133 } ]
[ { "span": "interface_type,", "start_line": 164, "start_column": 16, "end_line": 164, "end_column": 30 }, { "span": "primary,", "start_line": 164, "start_column": 32, "end_line": 164, "end_column": 39 }, { "span": "alias ", "start_line": 164, "start_column": 41, "end_line": 164, "end_column": 46 }, { "span": "interface_type,", "start_line": 166, "start_column": 16, "end_line": 166, "end_column": 30 }, { "span": "primary,", "start_line": 166, "start_column": 32, "end_line": 166, "end_column": 39 }, { "span": "alias ", "start_line": 166, "start_column": 41, "end_line": 166, "end_column": 46 } ]
[ { "span": "interface_type,", "start_line": 200, "start_column": 24, "end_line": 200, "end_column": 38 }, { "span": "primary,", "start_line": 200, "start_column": 40, "end_line": 200, "end_column": 47 }, { "span": "alias ", "start_line": 200, "start_column": 49, "end_line": 200, "end_column": 54 }, { "span": "interface_type,", "start_line": 202, "start_column": 24, "end_line": 202, "end_column": 38 }, { "span": "primary,", "start_line": 202, "start_column": 40, "end_line": 202, "end_column": 47 }, { "span": "alias ", "start_line": 202, "start_column": 49, "end_line": 202, "end_column": 54 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "System", "Resource_", "(_", "Custom", "API", "Resource_", ")_", ":_", "\\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_", "process", "\\u", "extra_", "(_", "self_", ",_", "bundle_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "patch", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "request_", "._", "POST_", "._", "items_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "patch", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "'", "delete", "\\u", "interface", "'_", ")_", "and_", "patch", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "'", "interface", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "patch", "\\u", "dict_", "._", "pop_", "(_", "'", "delete", "\\u", "interface", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "=_", "bundle_", "._", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interface_", "=_", "patch", "\\u", "dict_", "._", "pop_", "(_", "'", "interface", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "and_", "interface_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "delete", "\\u", "adapter_", "(_", "interface_", ")_", "\\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_", "patch", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "'", "update", "\\u", "interface", "'_", ")_", "and_", "patch", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "'", "interface", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "patch", "\\u", "dict_", "._", "pop_", "(_", "'", "update", "\\u", "interface", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "=_", "bundle_", "._", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "interface", "'_", "in_", "patch", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "update", "\\u", "adapter_", "(_", "**_", "patch", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Entr", "y", " ", "point", " ", "for", " ", "addin", "g", " ", "a", " ", "new", " ", "adapter", " ", "by", " ", "mac", " ", "address", " ", "via", " ", "the", " ", "rest", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "patch", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "'", "mac", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enable", "\\u", "dns_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enable", "\\u", "private_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enable", "\\u", "public_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "=_", "bundle_", "._", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range_", "=_", "patch", "\\u", "dict_", "._", "pop_", "(_", "'", "range", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fqdn_", "=_", "patch", "\\u", "dict_", "._", "pop_", "(_", "'", "fq", "dn", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip", "\\u", "str_", "=_", "patch", "\\u", "dict_", "._", "pop_", "(_", "'", "ip", "\\u", "address", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interface_", "=_", "patch", "\\u", "dict_", "._", "pop_", "(_", "'", "interface", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "patch", "\\u", "dict_", "._", "pop_", "(_", "'", "domain", "'_", ",_", "'", "moz", "illa", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "lib_", "._", "utils_", "import_", "create", "\\u", "ipv", "4", "\\u", "intr", "\\u", "from", "\\u", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mac_", "=_", "patch", "\\u", "dict_", "[_", "'", "mac", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interface_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interface", "\\u", "type_", ",_", "primary_", ",_", "alias_", "=_", "System", "Resource_", "._", "extract", "\\u", "nic", "\\u", "attrs_", "(_", "interface_", ")_", "\\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 ", " _", "interface", "\\u", "type_", ",_", "primary_", ",_", "alias_", "=_", "sys_", "._", "get", "\\u", "next", "\\u", "adapter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "fqdn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain", "\\u", "parsed_", "=_", "\".\"_", "._", "join_", "(_", "sys_", "._", "hostname_", "._", "split_", "(_", "'.'_", ")_", "[_", "1_", ":_", "]_", ")_", "+_", "'.'_", "+_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain", "\\u", "name_", "=_", "domain", "\\u", "parsed_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "sys_", "._", "hostname_", "._", "split_", "(_", "'.'_", ")_", "[_", "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 ", " _", "domain", "\\u", "parsed_", "=_", "\".\"_", "._", "join_", "(_", "fqdn_", "._", "split_", "(_", "'.'_", ")_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain", "\\u", "name_", "=_", "domain", "\\u", "parsed_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "fqdn_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\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_", "range_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "range", "\\u", "start", "\\u", "str_", "=_", "range_", "._", "split_", "(_", "','_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range", "\\u", "end", "\\u", "str_", "=_", "range_", "._", "split_", "(_", "','_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", ",_", "errors_", "=_", "create", "\\u", "ipv", "4", "\\u", "intr", "\\u", "from", "\\u", "range_", "(_", "label_", ",_", "domain", "\\u", "name_", ",_", "sys_", ",_", "mac_", ",_", "range", "\\u", "start", "\\u", "str_", ",_", "range", "\\u", "end", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ip", "\\u", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "Domain_", "._", "objects_", "._", "filter_", "(_", "name_", "=_", "domain", "\\u", "parsed_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Static", "Interface_", "(_", "label_", "=_", "label_", ",_", "mac_", "=_", "mac_", ",_", "domain_", "=_", "domain_", ",_", "ip", "\\u", "str_", "=_", "ip", "\\u", "str_", ",_", "ip", "\\u", "type_", "=_", "'", "4", "'_", ",_", "system_", "=_", "sys_", ")_", "\\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_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "s_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "update", "\\u", "attrs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "enable", "\\u", "dns_", "and_", "enable", "\\u", "public_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "private_", "=_", "View_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "'", "private", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "views_", "._", "add_", "(_", "private_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "enable", "\\u", "dns_", "and_", "enable", "\\u", "private_", "and_", "not_", "enable", "\\u", "public_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "private_", "=_", "View_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "'", "private", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "views_", "._", "add_", "(_", "private_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "interface_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "interface", "\\u", "type_", ",_", "primary_", ",_", "alias_", "=_", "System", "Resource_", "._", "extract", "\\u", "nic", "\\u", "attrs_", "(_", "interface_", ")_", "\\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 ", " ", " _", "interface", "\\u", "type_", ",_", "primary_", ",_", "alias_", "=_", "sys_", "._", "get", "\\u", "next", "\\u", "adapter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "._", "attrs_", "._", "primary_", "=_", "primary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "attrs_", "._", "interface", "\\u", "type_", "=_", "interface", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "attrs_", "._", "alias_", "=_", "alias_", "\\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_", "'", "We", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle_", "._", "errors_", "[_", "'", "error", "\\u", "message", "'_", "]_", "=_", "\"", "Una", "ble", " ", "to", " ", "create", " ", "adapter", " ", "for", " ", "unknown", " ", "reason", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Validat", "ion", "Error_", "(_", "join_", "(_", "e_", "._", "messages_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bundle_", "._", "errors_", "[_", "'", "error", "\\u", "message", "'_", "]_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "e_", "._", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Validat", "ion", "Error_", "(_", "join_", "(_", "e_", "._", "messages_", ")_", ")_", "\\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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 ]
Except block handles 'BaseException'
ardekantur/pyglet/pyglet/media/avbin.py
[ { "content": " def __del__(self):\n if _debug:\n print 'del avbin source'\n try:\n if self._video_stream:\n av.avbin_close_stream(self._video_stream)\n if self._audio_stream:\n av.avbin_close_stream(self._audio_stream)\n av.avbin_close_file(self._file)\n except:\n pass", "metadata": "root.AVbinSource.__del__", "header": "['class', 'AVbinSource', '(', 'StreamingSource', ')', ':', '___EOS___']", "index": 317 } ]
[ { "span": "except:", "start_line": 326, "start_column": 8, "end_line": 326, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "AV", "bin", "Source_", "(_", "Stream", "ing", "Source_", ")_", ":_", "\\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", "del\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "del", " ", "av", "bin", " ", "source", "'_", "\\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_", "self_", "._", "\\u", "video", "\\u", "stream_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "av_", "._", "av", "bin", "\\u", "close", "\\u", "stream_", "(_", "self_", "._", "\\u", "video", "\\u", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "audio", "\\u", "stream_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "av_", "._", "av", "bin", "\\u", "close", "\\u", "stream_", "(_", "self_", "._", "\\u", "audio", "\\u", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "av_", "._", "av", "bin", "\\u", "close", "\\u", "file_", "(_", "self_", "._", "\\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_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2 ]
Unused local variable
Arelle/Arelle/arelle/plugin/xbrlDB/XbrlSemanticJsonDB.py
[ { "content": "def isDBPort(host, port, db, timeout=10):\n if host == JSONFILE_HOSTNAME:\n return True\n # determine if postgres port\n t = 2\n while t < timeout:\n try:\n conn = urllib.request.urlopen(\"http://{0}:{1}/{2}/status\".format(host, port or '80', db))\n return True # success but doesn't need password\n except HTTPError:\n return False # success, this is really a postgres socket, wants user name\n except URLError:\n return False # something is there but not postgres\n except socket.timeout:\n t = t + 2 # relax - try again with longer timeout\n return False", "metadata": "root.isDBPort", "header": "['module', '___EOS___']", "index": 69 }, { "content": " def insertFiling(self, rssItem, g):\n self.showStatus(\"insert filing\")\n # accession graph -> document vertices\n new_filing = {'documents': []}\n if self.modelXbrl.modelDocument.creationSoftwareComment:\n new_filing['creation_software'] = self.modelXbrl.modelDocument.creationSoftwareComment\n datetimeNow = datetime.datetime.now()\n datetimeNowStr = XmlUtil.dateunionValue(datetimeNow)\n entryUri = modelObjectDocumentUri(self.modelXbrl)\n if rssItem is not None: # sec accession\n # set self.\n new_filing['filingType'] = \"SEC filing\"\n # for an RSS Feed entry from SEC, use rss item's accession information\n new_filing['filingNumber'] = filingNumber = rssItem.accessionNumber\n new_filing['acceptedTimestamp'] = XmlUtil.dateunionValue(rssItem.acceptanceDatetime)\n new_filing['filingDate'] = XmlUtil.dateunionValue(rssItem.filingDate)\n new_filing['entityId'] = rssItem.cikNumber\n new_filing['entityName'] = rssItem.companyName\n new_filing['SICCode'] = rssItem.assignedSic \n new_filing['SECHtmlUrl'] = rssItem.htmlUrl \n new_filing['entryUrl'] = rssItem.url\n self.filingURI = rssItem.htmlUrl\n else:\n # not an RSS Feed item, make up our own accession ID (the time in seconds of epoch)\n intNow = int(time.time())\n new_filing['filingNumber'] = filingNumber = str(intNow)\n self.filingId = int(time.time()) # only available if entered from an SEC filing\n new_filing['filingType'] = \"independent filing\"\n new_filing['acceptedTimestamp'] = datetimeNowStr\n new_filing['filingDate'] = datetimeNowStr\n new_filing['entryUrl'] = UrlUtil.ensureUrl(self.modelXbrl.fileSource.url)\n self.filingURI = filingNumber\n \n g[FILINGS][self.filingURI] = new_filing\n self.filing = new_filing\n \n # for now only one report per filing (but SEC may have multiple in future, such as form SD)\n self.reportURI = modelObjectDocumentUri(self.modelXbrl)\n self.report = {'filing': self.filingURI,\n 'aspectProxies': {},\n 'relationshipSets': {},\n 'dataPoints': {},\n 'messages': {}}\n new_filing['reports'] = {self.reportURI: self.report}\n \n # relationshipSets are a dts property\n self.relationshipSets = [(arcrole, ELR, linkqname, arcqname)\n for arcrole, ELR, linkqname, arcqname in self.modelXbrl.baseSets.keys()\n if ELR and (arcrole.startswith(\"XBRL-\") or (linkqname and arcqname))]", "metadata": "root.XbrlSemanticJsonDatabaseConnection.insertFiling", "header": "['class', 'XbrlSemanticJsonDatabaseConnection', '(', ')', ':', '___EOS___']", "index": 296 }, { "content": " def insertDataDictionary(self):\n # separate graph\n # document-> dataTypeSet -> dataType\n # do all schema dataTypeSet vertices\n \n self.type_id = {}\n self.aspect_id = {}\n self.aspect_proxy = {}\n self.aspect_proxy_uri = {}\n self.roleType_id = {}\n self.arcroleType_id = {}\n \n \n '''\n if any((not self.document_isNew[modelDocument.uri])\n for modelDocument in self.modelXbrl.urlDocs.values()):\n conceptsUsed = self.conceptsUsed()\n '''\n conceptsUsed = self.conceptsUsed()\n \n for modelDocument in self.modelXbrl.urlDocs.values():\n self.showStatus(\"insert DataDictionary \" + modelDocument.basename)\n docUri = modelObjectDocumentUri(modelDocument)\n document = self.documents[docUri]\n # don't re-output existing documents\n if modelDocument.type == Type.SCHEMA:\n isNewDocument = True # self.document_isNew[modelDocument.uri]\n modelConcepts = [modelConcept\n for modelConcept in self.modelXbrl.qnameConcepts.values()\n if modelConcept.modelDocument is modelDocument and\n (isNewDocument or modelConcept in conceptsUsed)]\n if docUri not in self.existingDocumentUris:\n # adding document as new\n document['dataTypes'] = dataTypes = {}\n for modelType in self.modelXbrl.qnameTypes.values():\n if modelType.modelDocument is modelDocument:\n dataTypes[modelType.name] = dataType = {\n 'dataType': modelObjectNameUri(modelType),\n 'document': modelObjectDocumentUri(modelType),\n 'url': modelObjectUri(modelType),\n 'namespaceURI': modelType.qname.namespaceURI,\n 'localName': modelType.name,\n }\n xbrliBaseType = modelType.baseXbrliTypeQname\n if not isinstance(xbrliBaseType, (tuple,list)):\n xbrliBaseType = (xbrliBaseType,)\n for baseType in xbrliBaseType:\n if baseType is not None:\n dataType['baseType'] = qnameUri(baseType)\n if baseType.namespaceURI == \"http://www.w3.org/2001/XMLSchema\":\n dataType['baseXsdType'] = qnameUri(baseType)\n \n typeDerivedFrom = modelType.typeDerivedFrom\n if not isinstance(typeDerivedFrom, (tuple,list)): # list if a union\n typeDerivedFrom = (typeDerivedFrom,)\n for dt in typeDerivedFrom:\n if dt is not None:\n dataType['derivedFrom'] = modelObjectNameUri(dt)\n \n for prop in ('isTextBlock', 'isDomainItemType'):\n propertyValue = getattr(modelType, prop, None)\n if propertyValue:\n dataType[prop] = propertyValue\n document['aspects'] = aspects = {}\n for modelConcept in modelConcepts:\n aspects[modelConcept.name] = aspect = {\n 'document': modelObjectDocumentUri(modelConcept),\n 'url': modelObjectUri(modelConcept),\n 'namespaceURI': modelConcept.qname.namespaceURI,\n 'localName': modelConcept.name,\n 'isAbstract': modelConcept.isAbstract\n }\n if modelConcept.periodType:\n aspect['periodType'] = modelConcept.periodType\n if modelConcept.balance:\n aspect['balance'] = modelConcept.balance\n \n for prop in ('isItem', 'isTuple', 'isLinkPart', \n 'isNumeric', 'isMonetary', 'isExplicitDimension', \n 'isDimensionItem', 'isPrimaryItem',\n 'isTypedDimension', 'isDomainMember', 'isHypercubeItem',\n 'isShares', 'isTextBlock', 'isNillable'):\n propertyValue = getattr(modelConcept, prop, None)\n if propertyValue:\n aspect[prop] = propertyValue\n \n conceptType = modelConcept.type\n if conceptType is not None:\n aspect['dataType'] = modelObjectNameUri(conceptType)\n \n substitutionGroup = modelConcept.substitutionGroup\n if substitutionGroup is not None:\n aspect['substitutionGroup'] = modelObjectNameUri(substitutionGroup)\n document['roleTypes'] = roleTypes = {}\n for modelRoleTypes in self.modelXbrl.roleTypes.values():\n for modelRoleType in modelRoleTypes:\n roleTypes[modelRoleType.roleURI] = roleType = {\n 'document': modelObjectDocumentUri(modelRoleType),\n 'url': modelObjectUri(modelRoleType),\n 'roleURI': modelRoleType.roleURI,\n 'definition': modelRoleType.definition,\n 'usedOn': [modelObjectUri(self.modelXbrl.qnameConcepts[qn]) \n for qn in modelRoleType.usedOns]\n }\n document['arcroleTypes'] = arcroleTypes = {}\n for modelArcroleTypes in self.modelXbrl.arcroleTypes.values():\n for modelArcroleType in modelArcroleTypes:\n arcroleTypes[modelRoleType.roleURI] = arcroleType = {\n 'document': modelObjectDocumentUri(modelArcroleType),\n 'url': modelObjectUri(modelArcroleType),\n 'arcroleURI': modelArcroleType.roleURI,\n 'definition': modelArcroleType.definition,\n 'usedOn': [modelObjectUri(self.modelXbrl.qnameConcepts[qn]) \n for qn in modelArcroleType.usedOns],\n 'cyclesAllowed': modelArcroleType.cyclesAllowed\n }\n\n activity = \"Insert data dictionary types, aspects, roles, and arcroles for \" + modelDocument.uri", "metadata": "root.XbrlSemanticJsonDatabaseConnection.insertDataDictionary", "header": "['class', 'XbrlSemanticJsonDatabaseConnection', '(', ')', ':', '___EOS___']", "index": 420 }, { "content": " def insertDataPoints(self):\n # separate graph\n # document-> dataTypeSet -> dataType\n self.showStatus(\"insert DataPoints\")\n \n # note these initial aspects Qnames used also must be in conceptsUsed above\n dimensions = [] # index by hash of dimension\n dimensionIds = {} # index for dimension\n if self.modelXbrl.modelDocument.type in (Type.INSTANCE, Type.INLINEXBRL):\n contextAspectValueSelections = {} # contexts processed already\n unitIDs = set() # units processed already\n periodProxies = {}\n entityIdentifierAspectProxies = {}\n dataPoints = self.report['dataPoints']\n for fact in self.modelXbrl.factsInInstance:\n self.insertAspectProxies( (fact.qname,) )\n factId = XmlUtil.elementFragmentIdentifier(fact)\n dataPoints[factId] = dataPoint = {\n 'document': modelObjectDocumentUri(fact),\n 'id': factId,\n 'sourceLine': fact.sourceline,\n 'dataPointUrl': modelObjectUri(fact),\n 'baseItem': self.aspectQnameProxyId(fact.qname)\n }\n \n context = fact.context\n concept = fact.concept\n if context is not None:\n if context.entityIdentifier not in entityIdentifierAspectProxies:\n entityScheme, entityIdentifier = context.entityIdentifier\n entityIdentifierAspectProxy = \"{}/{}\".format(\n qnamePrefix_Name(XbrlConst.qnXbrliIdentifier),\n entityIdentifier)\n e = self.insertAspectProxy(XbrlConst.qnXbrliIdentifier, entityIdentifierAspectProxy)\n e['scheme'] = entityScheme\n e['identifier'] = entityIdentifier\n entityIdentifierAspectProxies[context.entityIdentifier] = entityIdentifierAspectProxy\n else:\n entityIdentifierAspectProxy = entityIdentifierAspectProxies[context.entityIdentifier]\n dataPoint['entityIdentifier'] = entityIdentifierAspectProxy\n\n if context.isForeverPeriod:\n period = \"forever\"\n if context.isInstantPeriod:\n endDate = XmlUtil.dateunionValue(context.instantDatetime, subtractOneDay=True).replace(':','_')\n period = \"instant/{}\".format(endDate)\n else:\n startDate = XmlUtil.dateunionValue(context.startDatetime).replace(':','_')\n endDate = XmlUtil.dateunionValue(context.endDatetime, subtractOneDay=True).replace(':','_') \n period = \"duration/{}/{}\".format(startDate, endDate)\n if period not in periodProxies:\n periodProxy = \"{}/{}\".format(\n qnamePrefix_Name(XbrlConst.qnXbrliPeriod),\n period)\n p = self.insertAspectProxy(XbrlConst.qnXbrliPeriod, periodProxy)\n p['isForever'] = context.isForeverPeriod\n p['isInstant'] = context.isInstantPeriod\n if context.isStartEndPeriod:\n d = context.startDatetime\n if d.hour == 0 and d.minute == 0 and d.second == 0:\n d = d.date()\n p['startDate'] = d\n if context.isStartEndPeriod or context.isInstantPeriod:\n d = context.endDatetime\n if d.hour == 0 and d.minute == 0 and d.second == 0:\n d = (d - datetime.timedelta(1)).date()\n p['endDate'] = d\n periodProxies[period] = periodProxy\n else:\n periodProxy = periodProxies[period]\n dataPoint['period'] = periodProxy\n \n dataPoint['contextUrl'] = modelObjectUri(context)\n dataPoint['contextId'] = context.id\n if context.id not in contextAspectValueSelections:\n contextAspectValueSelections[context.id] = contextAspectValueSelection = []\n \n for dimVal in context.qnameDims.values():\n dim = qnamePrefix_Name(dimVal.dimensionQname)\n if dimVal.isExplicit:\n self.insertAspectProxies( (dimVal.memberQname,) ) # need imediate use of proxy\n v = self.aspectQnameProxyId(dimVal.memberQname)\n else:\n v = dimVal.typedMember.stringValue\n dimProxy = \"{}/{}\".format(dim, v)\n d = self.insertAspectProxy(dimVal.dimensionQname, dimProxy)\n contextAspectValueSelection.append(dimProxy)\n d['aspect'] = dim\n if dimVal.isExplicit:\n d['aspectValue'] = v\n else:\n d['typedValue'] = v\n else:\n contextAspectValueSelection = contextAspectValueSelections[context.id]\n dataPoint['aspectValueSelections'] = contextAspectValueSelection\n if fact.isNumeric:\n if fact.precision == \"INF\":\n dataPoint['precision'] = \"INF\"\n elif fact.precision is not None:\n dataPoint['precision'] = fact.precision\n if fact.decimals == \"INF\":\n dataPoint['decimals'] = \"INF\"\n elif fact.decimals is not None:\n dataPoint['decimals'] = fact.decimals\n if fact.unit is not None:\n unit = fact.unit\n unitProxy = \"{}/{}\".format(\n qnamePrefix_Name(XbrlConst.qnXbrliUnit),\n unit.id)\n dataPoint['unit'] = unitProxy\n if unit.id not in unitIDs:\n unitIDs.add(unit.id)\n u = self.insertAspectProxy(XbrlConst.qnXbrliUnit, unitProxy)\n u['unitId'] = unit.id\n \n mults, divs = unit.measures\n u['multiplyMeasures'] = [qnameUri(qn) for qn in mults]\n if divs:\n u['divideMeasures'] = [qnameUri(qn) for qn in divs]\n if fact.xmlLang is None and fact.concept is not None and fact.concept.baseXsdType is not None:\n dataPoint['value'] = fact.xValue\n # The insert with base XSD type but no language\n elif fact.xmlLang is not None:\n # assuming string type with language\n dataPoint['language'] = fact.xmlLang\n dataPoint['value'] = fact.value\n else:\n # Otherwise insert as plain liternal with no language or datatype\n dataPoint['value'] = fact.value\n \n if fact.modelTupleFacts:\n dataPoint['tuple'] = [XmlUtil.elementFragmentIdentifier(tupleFact)\n for tupleFact in fact.modelTupleFacts]", "metadata": "root.XbrlSemanticJsonDatabaseConnection.insertDataPoints", "header": "['class', 'XbrlSemanticJsonDatabaseConnection', '(', ')', ':', '___EOS___']", "index": 594 }, { "content": " def insertRelationshipSets(self):\n self.showStatus(\"insert relationship sets\")\n aspectQnamesUsed = set()\n for i, relationshipSetKey in enumerate(self.relationshipSets):\n arcrole, linkrole, linkqname, arcqname = relationshipSetKey\n if linkqname:\n aspectQnamesUsed.add(linkqname)\n if arcqname:\n aspectQnamesUsed.add(arcqname)\n self.insertAspectProxies(aspectQnamesUsed)\n \n relationshipSets = self.report['relationshipSets']\n relSetIds = {}\n for i, relationshipSetKey in enumerate(self.relationshipSets):\n arcrole, linkrole, linkqname, arcqname = relationshipSetKey\n if arcrole not in (\"XBRL-formulae\", \"Table-rendering\", \"XBRL-footnotes\") and linkrole and linkqname and arcqname:\n # skip paths and qnames for now (add later for non-SEC)\n relSetId = \"{}/{}\".format(\n os.path.basename(arcrole),\n os.path.basename(linkrole))\n relSetIds[relationshipSetKey] = relSetId\n relationshipSets[relSetId] = relationshipSet = {\n 'arcrole': arcrole,\n 'linkrole': linkrole,\n 'arcname': self.aspectQnameProxyId(arcqname),\n 'linkname': self.aspectQnameProxyId(linkqname),\n 'report': self.reportURI,\n 'roots': [],\n 'relationships': []\n }\n \n # do tree walk to build relationships with depth annotated, no targetRole navigation\n relE = [] # fromV, toV, label\n resources = set()\n aspectQnamesUsed = set()\n resourceIDs = {} # index by object\n \n def walkTree(rels, parentRelId, seq, depth, relationshipSetKey, relationshipSet, visited, relSetId, doVertices):\n for rel in rels:\n if rel not in visited:\n visited.add(rel)\n \n if not doVertices:\n _relProp = {'seq': seq,\n 'depth': depth,\n 'order': rel.orderDecimal,\n 'priority': rel.priority,\n 'relSetId': relSetId\n }\n if isinstance(rel.fromModelObject, ModelConcept):\n if doVertices:\n aspectQnamesUsed.add(rel.fromModelObject.qname)\n sourceUri = True\n else:\n sourceQname = rel.fromModelObject.qname\n sourceUri = self.aspectQnameProxyId(sourceQname)\n sourceId = qnamePrefix_Name(rel.fromModelObject.qname)\n else:\n sourceUri = None # tbd\n toModelObject = rel.toModelObject\n if isinstance(toModelObject, ModelConcept):\n if doVertices:\n aspectQnamesUsed.add(toModelObject.qname)\n targetUri = True\n else:\n targetUri = self.aspectQnameProxyId(toModelObject.qname)\n targetId = qnamePrefix_Name(toModelObject.qname)\n elif isinstance(toModelObject, ModelResource):\n if doVertices:\n resources.add(toModelObject)\n targetUri = 0 # just can't be None, but doesn't matter on doVertices pass\n else:\n if rel.preferredLabel:\n _relProp['preferredLabel'] = rel.preferredLabel\n if rel.arcrole in (XbrlConst.all, XbrlConst.notAll):\n _relProp['cubeClosed'] = rel.closed\n elif rel.arcrole in (XbrlConst.dimensionDomain, XbrlConst.domainMember):\n _relProp['aspectValueUsable'] = rel.usable\n elif rel.arcrole == XbrlConst.summationItem:\n _relProp['weight'] = rel.weightDecimal\n if relationshipSet.arcrole == \"XBRL-dimensions\":\n _relProp['arcrole'] = rel.arcrole\n if toModelObject.role:\n _relProp['resourceRole'] = toModelObject.role\n targetUri = modelObjectUri(toModelObject)\n targetId = toModelObject.modelDocument.basename + '#' + XmlUtil.elementFragmentIdentifier(toModelObject)\n else:\n targetUri = None # tbd\n if sourceUri is not None and targetUri is not None:\n targetRelSetId = relSetId\n targetRelSetKey = relationshipSetKey\n if relationshipSet.arcrole == \"XBRL-dimensions\" and rel.targetRole:\n targetRelSet = self.modelXbrl.relationshipSet(relationshipSet.arcrole, rel.targetRole)\n for i, relSetKey in enumerate(self.relationshipSets):\n arcrole, ELR, linkqname, arcqname = relSetKey\n if arcrole == \"XBRL-dimensions\" and ELR == rel.targetRole:\n targetRelationshipSetId = relSetIds[relSetKey]\n targetRelSetKey = relSetKey\n break\n if not doVertices:\n _relProp['targetLinkrole'] = rel.targetRole\n _relProp['targetRelSet'] = targetRelationshipSetId\n else:\n targetRelSetKey = relationshipSetKey\n targetRelSet = relationshipSet\n if doVertices:\n relId = None\n else:\n _relProp['from'] = sourceUri\n _relProp['fromQname'] = sourceQname\n _relProp['to'] = targetUri\n _arcrole = os.path.basename(rel.arcrole)\n relId = \"{}/{}/{}/{}\".format(\n _arcrole,\n os.path.basename(rel.linkrole),\n sourceId,\n targetId)\n _relProp['relId'] = relId\n _relProp['relSetKey'] = relationshipSetKey\n\n relE.append(_relProp)\n seq += 1\n seq = walkTree(targetRelSet.fromModelObject(toModelObject), relId, seq, depth+1, targetRelSetKey, targetRelSet, visited, targetRelSetId, doVertices)\n visited.remove(rel)\n return seq\n \n\n for doVertices in range(1,-1,-1): # pass 0 = vertices, pass 1 = edges\n for i, relationshipSetKey in enumerate(self.relationshipSets):\n arcrole, linkrole, linkqname, arcqname = relationshipSetKey\n if arcrole not in (\"XBRL-formulae\", \"Table-rendering\", \"XBRL-footnotes\") and linkrole and linkqname and arcqname: \n relSetId = relSetIds[relationshipSetKey]\n relationshipSet = self.modelXbrl.relationshipSet(*relationshipSetKey)\n seq = 1 \n for rootConcept in relationshipSet.rootConcepts:\n seq = walkTree(relationshipSet.fromModelObject(rootConcept), None, seq, 1, relationshipSetKey, relationshipSet, set(), relSetId, doVertices)\n if doVertices:\n if resources:\n for resource in resources:\n resourceUri = modelObjectUri(resource)\n r = {'url': resourceUri,\n 'value': resource.stringValue\n }\n if resource.xmlLang:\n r['language'] = resource.xmlLang\n if resource.role:\n r['role'] = resource.role\n self.documents[modelObjectDocumentUri(resource)]['resources'][\n XmlUtil.elementFragmentIdentifier(resource)] = r\n \n self.insertAspectProxies(aspectQnamesUsed)\n else:\n for j, rel in enumerate(relE):\n relId = rel['relId']\n relSetId = rel['relSetId']\n relSet = relationshipSets[relSetId]\n r = dict((k,v)\n for k,v in rel.items()\n if k not in ('relId', 'relPredicate', 'relSetId', 'relSetKey', 'fromQname'))\n relSet['relationships'].append(r)\n if rel.get('depth', 0) == 1:\n relSet['roots'].append(r)\n sourceQname = rel['fromQname']\n if sourceQname in self.aspect_proxy:\n self.aspect_proxy[sourceQname] \\\n .setdefault('relationships', {}) \\\n .setdefault(rel['relSetId'], []) \\\n .append(rel['to'])\n \n # TBD: do we want to link resources to the dts (by role, class, or otherwise?)\n \n resourceIDs.clear() # dereferemce objects\n resources = None", "metadata": "root.XbrlSemanticJsonDatabaseConnection.insertRelationshipSets", "header": "['class', 'XbrlSemanticJsonDatabaseConnection', '(', ')', ':', '___EOS___']", "index": 733 }, { "content": " def insertValidationResults(self):\n logEntries = []\n for handler in logging.getLogger(\"arelle\").handlers:\n if hasattr(handler, \"dbHandlerLogEntries\"):\n logEntries = handler.dbHandlerLogEntries()\n break\n \n messages = []\n messageRefs = [] # direct link to objects\n for i, logEntry in enumerate(logEntries):\n messageId = \"message/{}\".format(i+1)\n self.report['messages'][messageId] = m = {\n 'code': logEntry['code'],\n 'level': logEntry['level'],\n 'value': logEntry['message']['text'],\n 'report': self.reportURI,\n 'messageId': messageId\n }\n # capture message ref's\n for ref in logEntry['refs']:\n modelObject = self.modelXbrl.modelObject(ref.get('objectId',''))\n # for now just find a concept\n aspectObj = None\n if isinstance(modelObject, ModelFact):\n factId = XmlUtil.elementFragmentIdentifier(modelObject)\n dataPoint = self.report['dataPoints'][factId]\n dataPoint.setdefault('messages', []).append(messageId)\n elif isinstance(modelObject, ModelConcept):\n # be sure there's a proxy\n self.insertAspectProxies( (modelObject.qname,)) # need imediate use of proxy\n self.aspectQnameProxy(modelObject.qname).setdefault('messages', []).append(messageId)\n elif isinstance(modelObject, ModelRelationship):\n ''' TBD\n sourceId = qnamePrefix_Name(modelObject.fromModelObject.qname)\n toModelObject = modelObject.toModelObject\n if isinstance(toModelObject, ModelConcept):\n targetId = qnamePrefix_Name(toModelObject.qname)\n elif isinstance(toModelObject, ModelResource):\n targetId = toModelObject.modelDocument.basename + '#' + XmlUtil.elementFragmentIdentifier(toModelObject)\n else:\n continue\n objUri = URIRef(\"{}/Relationship/{}/{}/{}/{}\".format(\n self.reportURI, \n os.path.basename(modelObject.arcrole),\n os.path.basename(modelObject.linkrole),\n sourceId,\n targetId) )\n '''\n else:\n continue\n \n if messages:\n self.showStatus(\"insert validation messages\")", "metadata": "root.XbrlSemanticJsonDatabaseConnection.insertValidationResults", "header": "['class', 'XbrlSemanticJsonDatabaseConnection', '(', ')', ':', '___EOS___']", "index": 907 } ]
[ { "span": "conn ", "start_line": 76, "start_column": 12, "end_line": 76, "end_column": 16 }, { "span": "entryUri ", "start_line": 304, "start_column": 8, "end_line": 304, "end_column": 16 }, { "span": "filingNumber ", "start_line": 309, "start_column": 41, "end_line": 309, "end_column": 53 }, { "span": "roleType ", "start_line": 516, "start_column": 63, "end_line": 516, "end_column": 71 }, { "span": "arcroleType ", "start_line": 527, "start_column": 66, "end_line": 527, "end_column": 77 }, { "span": "activity ", "start_line": 537, "start_column": 20, "end_line": 537, "end_column": 28 }, { "span": "dimensions ", "start_line": 600, "start_column": 8, "end_line": 600, "end_column": 18 }, { "span": "dimensionIds ", "start_line": 601, "start_column": 8, "end_line": 601, "end_column": 20 }, { "span": "concept ", "start_line": 620, "start_column": 16, "end_line": 620, "end_column": 23 }, { "span": "relId ", "start_line": 886, "start_column": 20, "end_line": 886, "end_column": 25 }, { "span": "messageRefs ", "start_line": 915, "start_column": 8, "end_line": 915, "end_column": 19 }, { "span": "m ", "start_line": 918, "start_column": 49, "end_line": 918, "end_column": 50 }, { "span": "aspectObj ", "start_line": 929, "start_column": 16, "end_line": 929, "end_column": 25 } ]
[]
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_", "is", "DB", "Port_", "(_", "host_", ",_", "port_", ",_", "db_", ",_", "timeout_", "=_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "host_", "==_", "JSO", "NF", "ILE", "\\u", "HOSTNAME", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "if", " ", "postgres", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "t_", "<_", "timeout_", ":_", "\\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_", "=_", "urllib_", "._", "request_", "._", "urlopen_", "(_", "\"", "http", "://", "{", "0", "}:", "{", "1", "}/", "{", "2", "}/", "status", "\"_", "._", "format_", "(_", "host_", ",_", "port_", "or_", "'", "80", "'_", ",_", "db_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "#", " ", "success", " ", "but", " ", "doe", "sn", "'", "t", " ", "need", " ", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "HTTP", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "#", " ", "success", ",", " ", "this", " ", "is", " ", "reall", "y", " ", "a", " ", "postgres", " ", "socket", ",", " ", "want", "s", " ", "user", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "URL", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "#", " ", "somet", "hing", " ", "is", " ", "there", " ", "but", " ", "not", " ", "postgres_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "t_", "+_", "2_", "#", " ", "relax", " ", "-", " ", "try", " ", "again", " ", "with", " ", "long", "er", " ", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xbrl", "Semantic", "Js", "on", "Databa", "se", "Connection_", "(_", ")_", ":_", "\\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_", "insert", "Fil", "ing_", "(_", "self_", ",_", "rs", "s", "Item_", ",_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Status_", "(_", "\"", "insert", " ", "filing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "accessi", "on", " ", "graph", " ", "->", " ", "document", " ", "vertices_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "filing", "_", "=_", "{_", "'", "document", "s", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "model", "Xbrl", "_", "._", "model", "Document_", "._", "creati", "on", "Sof", "twa", "re", "Comment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "filing", "_", "[_", "'", "creati", "on", "\\u", "software", "'_", "]_", "=_", "self_", "._", "model", "Xbrl", "_", "._", "model", "Document_", "._", "creati", "on", "Sof", "twa", "re", "Comment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "datetime", "Now_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datetime", "No", "w", "Str_", "=_", "Xm", "l", "Util_", "._", "date", "uni", "on", "Value_", "(_", "datetime", "Now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry", "Uri_", "=_", "model", "Object", "Document", "Uri_", "(_", "self_", "._", "model", "Xbrl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rs", "s", "Item_", "is_", "not_", "None_", ":_", "#", " ", "sec", " ", "accession_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "self", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "filing", "_", "[_", "'", "filing", "Type", "'_", "]_", "=_", "\"", "SEC", " ", "filing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "an", " ", "RSS", " ", "Feed", " ", "entry", " ", "from", " ", "SEC", ",", " ", "use", " ", "rs", "s", " ", "item", "'", "s", " ", "accessi", "on", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "filing", "Number", "'_", "]_", "=_", "filing", "Number_", "=_", "rs", "s", "Item_", "._", "accessi", "on", "Number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "accept", "ed", "Timest", "amp", "'_", "]_", "=_", "Xm", "l", "Util_", "._", "date", "uni", "on", "Value_", "(_", "rs", "s", "Item_", "._", "acceptance", "Datetime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "filing", "Date", "'_", "]_", "=_", "Xm", "l", "Util_", "._", "date", "uni", "on", "Value_", "(_", "rs", "s", "Item_", "._", "filing", "Date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "entity", "Id", "'_", "]_", "=_", "rs", "s", "Item_", "._", "ci", "k", "Number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "entity", "Name", "'_", "]_", "=_", "rs", "s", "Item_", "._", "compan", "y", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "SI", "CC", "ode", "'_", "]_", "=_", "rs", "s", "Item_", "._", "assign", "ed", "Si", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "SEC", "Ht", "ml", "Ur", "l", "'_", "]_", "=_", "rs", "s", "Item_", "._", "html", "Url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "entry", "Ur", "l", "'_", "]_", "=_", "rs", "s", "Item_", "._", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filing", "URI_", "=_", "rs", "s", "Item_", "._", "html", "Url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "an", " ", "RSS", " ", "Feed", " ", "item", ",", " ", "make", " ", "up", " ", "our", " ", "own", " ", "accessi", "on", " ", "ID", " ", "(", "the", " ", "time", " ", "in", " ", "second", "s", " ", "of", " ", "epoch", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "int", "Now_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "filing", "Number", "'_", "]_", "=_", "filing", "Number_", "=_", "str_", "(_", "int", "Now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filing", "Id_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "#", " ", "only", " ", "avail", "able", " ", "if", " ", "enter", "ed", " ", "from", " ", "an", " ", "SEC", " ", "filing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "filing", "Type", "'_", "]_", "=_", "\"", "independent", " ", "filing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "accept", "ed", "Timest", "amp", "'_", "]_", "=_", "datetime", "No", "w", "Str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "filing", "Date", "'_", "]_", "=_", "datetime", "No", "w", "Str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "entry", "Ur", "l", "'_", "]_", "=_", "Ur", "l", "Util_", "._", "ensure", "Url_", "(_", "self_", "._", "model", "Xbrl", "_", "._", "file", "Source_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filing", "URI_", "=_", "filing", "Number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g_", "[_", "FIL", "INGS", "_", "]_", "[_", "self_", "._", "filing", "URI_", "]_", "=_", "new", "\\u", "filing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filing", "_", "=_", "new", "\\u", "filing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "now", " ", "only", " ", "one", " ", "report", " ", "per", " ", "filing", " ", "(", "but", " ", "SEC", " ", "may", " ", "have", " ", "multiple", " ", "in", " ", "future", ",", " ", "suc", "h", " ", "as", " ", "form", " ", "SD", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "report", "URI_", "=_", "model", "Object", "Document", "Uri_", "(_", "self_", "._", "model", "Xbrl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "report_", "=_", "{_", "'", "filing", "'_", ":_", "self_", "._", "filing", "URI_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "aspect", "Proxi", "es", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "relation", "ship", "Set", "s", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "Point", "s", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "s", "'_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "[_", "'", "report", "s", "'_", "]_", "=_", "{_", "self_", "._", "report", "URI_", ":_", "self_", "._", "report_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relation", "ship", "Set", "s", " ", "are", " ", "a", " ", "dt", "s", " ", "property_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "relation", "ship", "Sets_", "=_", "[_", "(_", "arc", "role_", ",_", "EL", "R_", ",_", "link", "qname_", ",_", "arc", "qname_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "arc", "role_", ",_", "EL", "R_", ",_", "link", "qname_", ",_", "arc", "qname_", "in_", "self_", "._", "model", "Xbrl", "_", "._", "base", "Sets_", "._", "keys_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "EL", "R_", "and_", "(_", "arc", "role_", "._", "startswith_", "(_", "\"", "XB", "RL", "-\"_", ")_", "or_", "(_", "link", "qname_", "and_", "arc", "qname_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xbrl", "Semantic", "Js", "on", "Databa", "se", "Connection_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "Data", "Dictionary_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "separate", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "document", "->", " ", "data", "Type", "Set", " ", "->", " ", "data", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "all", " ", "schema", " ", "data", "Type", "Set", " ", "vertices_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "type", "\\u", "id_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aspect", "\\u", "id_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aspect", "\\u", "proxy_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aspect", "\\u", "proxy", "\\u", "uri_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "role", "Type", "\\u", "id_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "arc", "role", "Type", "\\u", "id_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "any", "((", "not", " ", "self", ".", "document", "\\u", "is", "New", "[", "model", "Document", ".", "uri", "])", "\\", "10", ";", " ", " ", " ", "for", " ", "model", "Document", " ", "in", " ", "self", ".", "model", "Xbrl", ".", "url", "Docs", ".", "values", "())", ":", "\\", "10", ";", " ", " ", " ", " ", "concepts", "Us", "ed", " ", "=", " ", "self", ".", "concepts", "Us", "ed", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "concepts", "Used_", "=_", "self_", "._", "concepts", "Used_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "model", "Document_", "in_", "self_", "._", "model", "Xbrl", "_", "._", "url", "Docs", "_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Status_", "(_", "\"", "insert", " ", "Data", "Dict", "ionar", "y", " ", "\"_", "+_", "model", "Document_", "._", "basename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc", "Uri_", "=_", "model", "Object", "Document", "Uri_", "(_", "model", "Document_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "document_", "=_", "self_", "._", "documents_", "[_", "doc", "Uri_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "re", "-", "output", " ", "exist", "ing", " ", "documents_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "model", "Document_", "._", "type_", "==_", "Type_", "._", "SCHEMA_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "New", "Document_", "=_", "True_", "#", " ", "self", ".", "document", "\\u", "is", "New", "[", "model", "Document", ".", "uri", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Concept", "s_", "=_", "[_", "model", "Concept", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "model", "Concept", "_", "in_", "self_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", "._", "values_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "model", "Concept", "_", "._", "model", "Document_", "is_", "model", "Document_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "is", "New", "Document_", "or_", "model", "Concept", "_", "in_", "concepts", "Used_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "doc", "Uri_", "not_", "in_", "self_", "._", "exist", "ing", "Document", "Ur", "is_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "addin", "g", " ", "document", " ", "as", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "document_", "[_", "'", "data", "Type", "s", "'_", "]_", "=_", "data", "Types_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Type_", "in_", "self_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Types_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "model", "Type_", "._", "model", "Document_", "is_", "model", "Document_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Types_", "[_", "model", "Type_", "._", "name_", "]_", "=_", "data", "Type_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "Type", "'_", ":_", "model", "Object", "Name", "Uri_", "(_", "model", "Type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "document", "'_", ":_", "model", "Object", "Document", "Uri_", "(_", "model", "Type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "model", "Object", "Uri_", "(_", "model", "Type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "namespace", "URI", "'_", ":_", "model", "Type_", "._", "qname_", "._", "namespace", "URI_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "Name", "'_", ":_", "model", "Type_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xbr", "li", "Base", "Type_", "=_", "model", "Type_", "._", "base", "Xbrl", "i", "Type", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "xbr", "li", "Base", "Type_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "xbr", "li", "Base", "Type_", "=_", "(_", "xbr", "li", "Base", "Type_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "base", "Type_", "in_", "xbr", "li", "Base", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "base", "Type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Type_", "[_", "'", "base", "Type", "'_", "]_", "=_", "qna", "me", "Uri_", "(_", "base", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "base", "Type_", "._", "namespace", "URI_", "==_", "\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "data", "Type_", "[_", "'", "base", "Xs", "d", "Type", "'_", "]_", "=_", "qna", "me", "Uri_", "(_", "base", "Type_", ")_", "\\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_", "type", "Derive", "d", "From_", "=_", "model", "Type_", "._", "type", "Derive", "d", "From_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "type", "Derive", "d", "From_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", ":_", "#", " ", "list", " ", "if", " ", "a", " ", "union_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "type", "Derive", "d", "From_", "=_", "(_", "type", "Derive", "d", "From_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "dt_", "in_", "type", "Derive", "d", "From_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "dt_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Type_", "[_", "'", "derive", "d", "Fro", "m", "'_", "]_", "=_", "model", "Object", "Name", "Uri_", "(_", "dt_", ")_", "\\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_", "prop_", "in_", "(_", "'", "is", "Text", "Block", "'_", ",_", "'", "is", "Doma", "in", "Item", "Type", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "property", "Value_", "=_", "getattr_", "(_", "model", "Type_", ",_", "prop_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "property", "Value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Type_", "[_", "prop_", "]_", "=_", "property", "Value_", "\\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_", "document_", "[_", "'", "aspect", "s", "'_", "]_", "=_", "aspect", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Concept", "_", "in_", "model", "Concept", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "aspect", "s_", "[_", "model", "Concept", "_", "._", "name_", "]_", "=_", "aspect_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "document", "'_", ":_", "model", "Object", "Document", "Uri_", "(_", "model", "Concept", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "model", "Object", "Uri_", "(_", "model", "Concept", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "namespace", "URI", "'_", ":_", "model", "Concept", "_", "._", "qname_", "._", "namespace", "URI_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "Name", "'_", ":_", "model", "Concept", "_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Abstract", "'_", ":_", "model", "Concept", "_", "._", "is", "Abstract", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Concept", "_", "._", "period", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "aspect_", "[_", "'", "period", "Type", "'_", "]_", "=_", "model", "Concept", "_", "._", "period", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "model", "Concept", "_", "._", "balance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "aspect_", "[_", "'", "balance", "'_", "]_", "=_", "model", "Concept", "_", "._", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "prop_", "in_", "(_", "'", "is", "Item", "'_", ",_", "'", "is", "Tup", "le", "'_", ",_", "'", "is", "Link", "Part", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Numer", "ic", "'_", ",_", "'", "is", "Mone", "tar", "y", "'_", ",_", "'", "is", "Exp", "licit", "Dimen", "sion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Dimen", "sion", "Item", "'_", ",_", "'", "is", "Prim", "ary", "Item", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Type", "d", "Dimen", "sion", "'_", ",_", "'", "is", "Doma", "in", "Mem", "ber", "'_", ",_", "'", "is", "Hyper", "cube", "Item", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Share", "s", "'_", ",_", "'", "is", "Text", "Block", "'_", ",_", "'", "is", "Ni", "lla", "ble", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "property", "Value_", "=_", "getattr_", "(_", "model", "Concept", "_", ",_", "prop_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "property", "Value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "aspect_", "[_", "prop_", "]_", "=_", "property", "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_", "concept", "Type_", "=_", "model", "Concept", "_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "concept", "Type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "aspect_", "[_", "'", "data", "Type", "'_", "]_", "=_", "model", "Object", "Name", "Uri_", "(_", "concept", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "substitution", "Group_", "=_", "model", "Concept", "_", "._", "substitution", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "substitution", "Group_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "aspect_", "[_", "'", "substitution", "Group", "'_", "]_", "=_", "model", "Object", "Name", "Uri_", "(_", "substitution", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "document_", "[_", "'", "role", "Type", "s", "'_", "]_", "=_", "role", "Types_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Ro", "le", "Types_", "in_", "self_", "._", "model", "Xbrl", "_", "._", "role", "Types_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "model", "Ro", "le", "Type_", "in_", "model", "Ro", "le", "Types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "role", "Types_", "[_", "model", "Ro", "le", "Type_", "._", "role", "URI_", "]_", "=_", "role", "Type_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "document", "'_", ":_", "model", "Object", "Document", "Uri_", "(_", "model", "Ro", "le", "Type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "model", "Object", "Uri_", "(_", "model", "Ro", "le", "Type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "role", "URI", "'_", ":_", "model", "Ro", "le", "Type_", "._", "role", "URI_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "definit", "ion", "'_", ":_", "model", "Ro", "le", "Type_", "._", "definition_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "used", "On", "'_", ":_", "[_", "model", "Object", "Uri_", "(_", "self_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", "[_", "qn_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "qn_", "in_", "model", "Ro", "le", "Type_", "._", "used", "On", "s_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "document_", "[_", "'", "arc", "role", "Type", "s", "'_", "]_", "=_", "arc", "role", "Types_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Arc", "role", "Types_", "in_", "self_", "._", "model", "Xbrl", "_", "._", "arc", "role", "Types_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "model", "Arc", "role", "Type_", "in_", "model", "Arc", "role", "Types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arc", "role", "Types_", "[_", "model", "Ro", "le", "Type_", "._", "role", "URI_", "]_", "=_", "arc", "role", "Type_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "document", "'_", ":_", "model", "Object", "Document", "Uri_", "(_", "model", "Arc", "role", "Type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "model", "Object", "Uri_", "(_", "model", "Arc", "role", "Type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "arc", "role", "URI", "'_", ":_", "model", "Arc", "role", "Type_", "._", "role", "URI_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "definit", "ion", "'_", ":_", "model", "Arc", "role", "Type_", "._", "definition_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "used", "On", "'_", ":_", "[_", "model", "Object", "Uri_", "(_", "self_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", "[_", "qn_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "qn_", "in_", "model", "Arc", "role", "Type_", "._", "used", "On", "s_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cycle", "s", "All", "owe", "d", "'_", ":_", "model", "Arc", "role", "Type_", "._", "cycle", "s", "Allowed_", "\\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_", "activity_", "=_", "\"", "Insert", " ", "data", " ", "dictionar", "y", " ", "types", ",", " ", "aspect", "s", ",", " ", "role", "s", ",", " ", "and", " ", "arc", "role", "s", " ", "for", " ", "\"_", "+_", "model", "Document_", "._", "uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xbrl", "Semantic", "Js", "on", "Databa", "se", "Connection_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "Data", "Points_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "separate", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "document", "->", " ", "data", "Type", "Set", " ", "->", " ", "data", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Status_", "(_", "\"", "insert", " ", "Data", "Point", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", " ", "these", " ", "initial", " ", "aspect", "s", " ", "Qn", "ames", " ", "used", " ", "als", "o", " ", "must", " ", "be", " ", "in", " ", "concepts", "Us", "ed", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "dimensions_", "=_", "[_", "]_", "#", " ", "index", " ", "by", " ", "hash", " ", "of", " ", "dimension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dimension", "Ids_", "=_", "{_", "}_", "#", " ", "index", " ", "for", " ", "dimension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "model", "Xbrl", "_", "._", "model", "Document_", "._", "type_", "in_", "(_", "Type_", "._", "INSTANCE", "_", ",_", "Type_", "._", "IN", "LINE", "XB", "RL", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "Asp", "ect", "Value", "Selecti", "ons_", "=_", "{_", "}_", "#", " ", "context", "s", " ", "process", "ed", " ", "alr", "ead", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unit", "ID", "s_", "=_", "set_", "(_", ")_", "#", " ", "unit", "s", " ", "process", "ed", " ", "alr", "ead", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "period", "Proxi", "es_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "Identifie", "r", "Asp", "ect", "Proxi", "es_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Points_", "=_", "self_", "._", "report_", "[_", "'", "data", "Point", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fact_", "in_", "self_", "._", "model", "Xbrl", "_", "._", "fact", "s", "In", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert", "Asp", "ect", "Proxi", "es_", "(_", "(_", "fact_", "._", "qname_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fact", "Id_", "=_", "Xm", "l", "Util_", "._", "element", "Fragment", "Identifier_", "(_", "fact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Points_", "[_", "fact", "Id_", "]_", "=_", "data", "Point_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "document", "'_", ":_", "model", "Object", "Document", "Uri_", "(_", "fact_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "fact", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "Line", "'_", ":_", "fact_", "._", "source", "line_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "Point", "Ur", "l", "'_", ":_", "model", "Object", "Uri_", "(_", "fact_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "base", "Item", "'_", ":_", "self_", "._", "aspect", "Qn", "ame", "Pro", "xy", "Id_", "(_", "fact_", "._", "qname_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "fact_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "concept_", "=_", "fact_", "._", "concept_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "context_", "._", "entity", "Identifier_", "not_", "in_", "entity", "Identifie", "r", "Asp", "ect", "Proxi", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "entity", "Scheme_", ",_", "entity", "Identifier_", "=_", "context_", "._", "entity", "Identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "Identifie", "r", "Asp", "ect", "Proxy_", "=_", "\"{}", "/{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "qna", "me", "Pref", "ix", "\\u", "Name_", "(_", "Xbrl", "Const_", "._", "qn", "Xbrl", "i", "Identifier_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entity", "Identifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "insert", "Asp", "ect", "Proxy_", "(_", "Xbrl", "Const_", "._", "qn", "Xbrl", "i", "Identifier_", ",_", "entity", "Identifie", "r", "Asp", "ect", "Proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "[_", "'", "sche", "me", "'_", "]_", "=_", "entity", "Scheme_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "[_", "'", "identifi", "er", "'_", "]_", "=_", "entity", "Identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "Identifie", "r", "Asp", "ect", "Proxi", "es_", "[_", "context_", "._", "entity", "Identifier_", "]_", "=_", "entity", "Identifie", "r", "Asp", "ect", "Proxy_", "\\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 ", " ", " _", "entity", "Identifie", "r", "Asp", "ect", "Proxy_", "=_", "entity", "Identifie", "r", "Asp", "ect", "Proxi", "es_", "[_", "context_", "._", "entity", "Identifier_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data", "Point_", "[_", "'", "entity", "Identifie", "r", "'_", "]_", "=_", "entity", "Identifie", "r", "Asp", "ect", "Proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "._", "is", "Fore", "ver", "Period_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "period_", "=_", "\"", "forever", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "._", "is", "Instant", "Period_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "end", "Date_", "=_", "Xm", "l", "Util_", "._", "date", "uni", "on", "Value_", "(_", "context_", "._", "instant", "Datetime_", ",_", "subtract", "One", "Day_", "=_", "True_", ")_", "._", "replace_", "(_", "':'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "period_", "=_", "\"", "instant", "/{}\"_", "._", "format_", "(_", "end", "Date_", ")_", "\\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 ", " ", " _", "start", "Date_", "=_", "Xm", "l", "Util_", "._", "date", "uni", "on", "Value_", "(_", "context_", "._", "start", "Datetime_", ")_", "._", "replace_", "(_", "':'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Date_", "=_", "Xm", "l", "Util_", "._", "date", "uni", "on", "Value_", "(_", "context_", "._", "end", "Datetime_", ",_", "subtract", "One", "Day_", "=_", "True_", ")_", "._", "replace_", "(_", "':'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "period_", "=_", "\"", "duration", "/{}/", "{}\"_", "._", "format_", "(_", "start", "Date_", ",_", "end", "Date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "period_", "not_", "in_", "period", "Proxi", "es_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "period", "Proxy_", "=_", "\"{}", "/{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "qna", "me", "Pref", "ix", "\\u", "Name_", "(_", "Xbrl", "Const_", "._", "qn", "Xbrl", "i", "Period_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "self_", "._", "insert", "Asp", "ect", "Proxy_", "(_", "Xbrl", "Const_", "._", "qn", "Xbrl", "i", "Period_", ",_", "period", "Proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "is", "Fore", "ver", "'_", "]_", "=_", "context_", "._", "is", "Fore", "ver", "Period_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "is", "Instant", "'_", "]_", "=_", "context_", "._", "is", "Instant", "Period_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "._", "is", "Start", "End", "Period_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "d_", "=_", "context_", "._", "start", "Datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", "._", "hour_", "==_", "0_", "and_", "d_", "._", "minute_", "==_", "0_", "and_", "d_", "._", "second_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "d_", "=_", "d_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "start", "Date", "'_", "]_", "=_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "._", "is", "Start", "End", "Period_", "or_", "context_", "._", "is", "Instant", "Period_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "d_", "=_", "context_", "._", "end", "Datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", "._", "hour_", "==_", "0_", "and_", "d_", "._", "minute_", "==_", "0_", "and_", "d_", "._", "second_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "d_", "=_", "(_", "d_", "-_", "datetime_", "._", "timedelta_", "(_", "1_", ")_", ")_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "end", "Date", "'_", "]_", "=_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "period", "Proxi", "es_", "[_", "period_", "]_", "=_", "period", "Proxy_", "\\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 ", " ", " _", "period", "Proxy_", "=_", "period", "Proxi", "es_", "[_", "period_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data", "Point_", "[_", "'", "period", "'_", "]_", "=_", "period", "Proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data", "Point_", "[_", "'", "context", "Ur", "l", "'_", "]_", "=_", "model", "Object", "Uri_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Point_", "[_", "'", "context", "Id", "'_", "]_", "=_", "context_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "._", "id_", "not_", "in_", "context", "Asp", "ect", "Value", "Selecti", "ons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "context", "Asp", "ect", "Value", "Selecti", "ons_", "[_", "context_", "._", "id_", "]_", "=_", "context", "Asp", "ect", "Value", "Selection_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "dim", "Val_", "in_", "context_", "._", "qna", "me", "Dims", "_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dim_", "=_", "qna", "me", "Pref", "ix", "\\u", "Name_", "(_", "dim", "Val_", "._", "dimension", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dim", "Val_", "._", "is", "Exp", "licit", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "insert", "Asp", "ect", "Proxi", "es_", "(_", "(_", "dim", "Val_", "._", "member", "Qn", "ame_", ",_", ")_", ")_", "#", " ", "need", " ", "ime", "diat", "e", " ", "use", " ", "of", " ", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "self_", "._", "aspect", "Qn", "ame", "Pro", "xy", "Id_", "(_", "dim", "Val_", "._", "member", "Qn", "ame_", ")_", "\\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_", "=_", "dim", "Val_", "._", "typed", "Member_", "._", "string", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dim", "Proxy_", "=_", "\"{}", "/{}\"_", "._", "format_", "(_", "dim_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "insert", "Asp", "ect", "Proxy_", "(_", "dim", "Val_", "._", "dimension", "Qn", "ame_", ",_", "dim", "Proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "Asp", "ect", "Value", "Selection_", "._", "append_", "(_", "dim", "Proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "'", "aspect", "'_", "]_", "=_", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dim", "Val_", "._", "is", "Exp", "licit", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "d_", "[_", "'", "aspect", "Value", "'_", "]_", "=_", "v_", "\\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 ", " ", " _", "d_", "[_", "'", "typed", "Value", "'_", "]_", "=_", "v_", "\\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 ", " ", " _", "context", "Asp", "ect", "Value", "Selection_", "=_", "context", "Asp", "ect", "Value", "Selecti", "ons_", "[_", "context_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data", "Point_", "[_", "'", "aspect", "Value", "Selecti", "ons", "'_", "]_", "=_", "context", "Asp", "ect", "Value", "Selection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fact_", "._", "is", "Numeric_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "fact_", "._", "precision_", "==_", "\"", "INF", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Point_", "[_", "'", "preci", "sion", "'_", "]_", "=_", "\"", "INF", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fact_", "._", "precision_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Point_", "[_", "'", "preci", "sion", "'_", "]_", "=_", "fact_", "._", "precision_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fact_", "._", "decimals_", "==_", "\"", "INF", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Point_", "[_", "'", "decima", "ls", "'_", "]_", "=_", "\"", "INF", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fact_", "._", "decimals_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Point_", "[_", "'", "decima", "ls", "'_", "]_", "=_", "fact_", "._", "decimals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fact_", "._", "unit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unit_", "=_", "fact_", "._", "unit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unit", "Proxy_", "=_", "\"{}", "/{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "qna", "me", "Pref", "ix", "\\u", "Name_", "(_", "Xbrl", "Const_", "._", "qn", "Xbrl", "i", "Unit_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unit_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Point_", "[_", "'", "unit", "'_", "]_", "=_", "unit", "Proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unit_", "._", "id_", "not_", "in_", "unit", "ID", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unit", "ID", "s_", "._", "add_", "(_", "unit_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "self_", "._", "insert", "Asp", "ect", "Proxy_", "(_", "Xbrl", "Const_", "._", "qn", "Xbrl", "i", "Unit_", ",_", "unit", "Proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "[_", "'", "unit", "Id", "'_", "]_", "=_", "unit_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mult", "s_", ",_", "div", "s_", "=_", "unit_", "._", "measures_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "[_", "'", "multipl", "y", "Measure", "s", "'_", "]_", "=_", "[_", "qna", "me", "Uri_", "(_", "qn_", ")_", "for_", "qn_", "in_", "mult", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "div", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "u_", "[_", "'", "divide", "Measure", "s", "'_", "]_", "=_", "[_", "qna", "me", "Uri_", "(_", "qn_", ")_", "for_", "qn_", "in_", "div", "s_", "]_", "\\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_", "if_", "fact_", "._", "xml", "Lang_", "is_", "None_", "and_", "fact_", "._", "concept_", "is_", "not_", "None_", "and_", "fact_", "._", "concept_", "._", "base", "Xs", "d", "Type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Point_", "[_", "'", "value", "'_", "]_", "=_", "fact_", "._", "x", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "insert", " ", "with", " ", "base", " ", "XSD", " ", "type", " ", "but", " ", "no", " ", "language_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fact_", "._", "xml", "Lang_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ass", "umi", "ng", " ", "string", " ", "type", " ", "with", " ", "language_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Point_", "[_", "'", "language", "'_", "]_", "=_", "fact_", "._", "xml", "Lang_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Point_", "[_", "'", "value", "'_", "]_", "=_", "fact_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", " ", "insert", " ", "as", " ", "plain", " ", "lite", "rna", "l", " ", "with", " ", "no", " ", "language", " ", "or", " ", "datatype_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Point_", "[_", "'", "value", "'_", "]_", "=_", "fact_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fact_", "._", "model", "Tup", "le", "Fact", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data", "Point_", "[_", "'", "tuple", "'_", "]_", "=_", "[_", "Xm", "l", "Util_", "._", "element", "Fragment", "Identifier_", "(_", "tuple", "Fact", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tuple", "Fact", "_", "in_", "fact_", "._", "model", "Tup", "le", "Fact", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xbrl", "Semantic", "Js", "on", "Databa", "se", "Connection_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "Relationship", "Sets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Status_", "(_", "\"", "insert", " ", "relation", "ship", " ", "sets", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aspect", "Qn", "ames", "Used_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "relation", "ship", "Set", "Key_", "in_", "enumerate_", "(_", "self_", "._", "relation", "ship", "Sets_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arc", "role_", ",_", "link", "role_", ",_", "link", "qname_", ",_", "arc", "qname_", "=_", "relation", "ship", "Set", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link", "qname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aspect", "Qn", "ames", "Used_", "._", "add_", "(_", "link", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "arc", "qname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aspect", "Qn", "ames", "Used_", "._", "add_", "(_", "arc", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "insert", "Asp", "ect", "Proxi", "es_", "(_", "aspect", "Qn", "ames", "Used_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "relation", "ship", "Sets_", "=_", "self_", "._", "report_", "[_", "'", "relation", "ship", "Set", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rel", "Set", "Ids_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "relation", "ship", "Set", "Key_", "in_", "enumerate_", "(_", "self_", "._", "relation", "ship", "Sets_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arc", "role_", ",_", "link", "role_", ",_", "link", "qname_", ",_", "arc", "qname_", "=_", "relation", "ship", "Set", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arc", "role_", "not_", "in_", "(_", "\"", "XB", "RL", "-", "formula", "e", "\"_", ",_", "\"", "Table", "-", "render", "ing", "\"_", ",_", "\"", "XB", "RL", "-", "footnote", "s", "\"_", ")_", "and_", "link", "role_", "and_", "link", "qname_", "and_", "arc", "qname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "skip", " ", "path", "s", " ", "and", " ", "qna", "mes", " ", "for", " ", "now", " ", "(", "add", " ", "late", "r", " ", "for", " ", "non", "-", "SEC", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rel", "Set", "Id_", "=_", "\"{}", "/{}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "basename_", "(_", "arc", "role_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "basename_", "(_", "link", "role_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rel", "Set", "Ids_", "[_", "relation", "ship", "Set", "Key_", "]_", "=_", "rel", "Set", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation", "ship", "Sets_", "[_", "rel", "Set", "Id_", "]_", "=_", "relation", "ship", "Set_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "arc", "role", "'_", ":_", "arc", "role_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "role", "'_", ":_", "link", "role_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "arc", "name", "'_", ":_", "self_", "._", "aspect", "Qn", "ame", "Pro", "xy", "Id_", "(_", "arc", "qname_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "name", "'_", ":_", "self_", "._", "aspect", "Qn", "ame", "Pro", "xy", "Id_", "(_", "link", "qname_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "report", "'_", ":_", "self_", "._", "report", "URI_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "relation", "ships", "'_", ":_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "tree", " ", "walk", " ", "to", " ", "build", " ", "relation", "ships", " ", "with", " ", "depth", " ", "annotated", ",", " ", "no", " ", "target", "Ro", "le", " ", "navigation", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rel", "E_", "=_", "[_", "]_", "#", " ", "from", "V", ",", " ", "to", "V", ",", " ", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resources_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aspect", "Qn", "ames", "Used_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "ID", "s_", "=_", "{_", "}_", "#", " ", "index", " ", "by", " ", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "walk", "Tree_", "(_", "rels_", ",_", "parent", "Rel", "Id_", ",_", "seq_", ",_", "depth_", ",_", "relation", "ship", "Set", "Key_", ",_", "relation", "ship", "Set_", ",_", "visited_", ",_", "rel", "Set", "Id_", ",_", "do", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rel_", "in_", "rels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rel_", "not_", "in_", "visited_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "visited_", "._", "add_", "(_", "rel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "do", "Vertices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "rel", "Prop_", "=_", "{_", "'", "seq", "'_", ":_", "seq_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "depth", "'_", ":_", "depth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "'_", ":_", "rel_", "._", "order", "Decimal_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "priorit", "y", "'_", ":_", "rel_", "._", "priority_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rel", "Set", "Id", "'_", ":_", "rel", "Set", "Id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "rel_", "._", "from", "Model", "Object_", ",_", "Model", "Concept", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "do", "Vertices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "aspect", "Qn", "ames", "Used_", "._", "add_", "(_", "rel_", "._", "from", "Model", "Object_", "._", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "Uri_", "=_", "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 ", " ", " _", "source", "Qn", "ame_", "=_", "rel_", "._", "from", "Model", "Object_", "._", "qname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "Uri_", "=_", "self_", "._", "aspect", "Qn", "ame", "Pro", "xy", "Id_", "(_", "source", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "Id_", "=_", "qna", "me", "Pref", "ix", "\\u", "Name_", "(_", "rel_", "._", "from", "Model", "Object_", "._", "qname_", ")_", "\\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 ", " ", " _", "source", "Uri_", "=_", "None_", "#", " ", "tb", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "Model", "Object_", "=_", "rel_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "to", "Model", "Object_", ",_", "Model", "Concept", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "do", "Vertices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "aspect", "Qn", "ames", "Used_", "._", "add_", "(_", "to", "Model", "Object_", "._", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Uri_", "=_", "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 ", " ", " _", "target", "Uri_", "=_", "self_", "._", "aspect", "Qn", "ame", "Pro", "xy", "Id_", "(_", "to", "Model", "Object_", "._", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Id_", "=_", "qna", "me", "Pref", "ix", "\\u", "Name_", "(_", "to", "Model", "Object_", "._", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "to", "Model", "Object_", ",_", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "do", "Vertices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "resources_", "._", "add_", "(_", "to", "Model", "Object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Uri_", "=_", "0_", "#", " ", "just", " ", "can", "'", "t", " ", "be", " ", "Non", "e", ",", " ", "but", " ", "doe", "sn", "'", "t", " ", "matte", "r", " ", "on", " ", "do", "Vert", "ices", " ", "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 ", " ", " _", "if_", "rel_", "._", "prefer", "red", "Label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "rel", "Prop_", "[_", "'", "prefer", "red", "Label", "'_", "]_", "=_", "rel_", "._", "prefer", "red", "Label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rel_", "._", "arc", "role_", "in_", "(_", "Xbrl", "Const_", "._", "all_", ",_", "Xbrl", "Const_", "._", "not", "All_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "rel", "Prop_", "[_", "'", "cube", "Clos", "ed", "'_", "]_", "=_", "rel_", "._", "closed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "rel_", "._", "arc", "role_", "in_", "(_", "Xbrl", "Const_", "._", "dimension", "Domain_", ",_", "Xbrl", "Const_", "._", "domain", "Member_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "rel", "Prop_", "[_", "'", "aspect", "Value", "Us", "able", "'_", "]_", "=_", "rel_", "._", "usable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "rel_", "._", "arc", "role_", "==_", "Xbrl", "Const_", "._", "summa", "tion", "Item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "rel", "Prop_", "[_", "'", "weight", "'_", "]_", "=_", "rel_", "._", "weight", "Decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "relation", "ship", "Set_", "._", "arc", "role_", "==_", "\"", "XB", "RL", "-", "dimension", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "rel", "Prop_", "[_", "'", "arc", "role", "'_", "]_", "=_", "rel_", "._", "arc", "role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "to", "Model", "Object_", "._", "role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "rel", "Prop_", "[_", "'", "resource", "Ro", "le", "'_", "]_", "=_", "to", "Model", "Object_", "._", "role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "Uri_", "=_", "model", "Object", "Uri_", "(_", "to", "Model", "Object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Id_", "=_", "to", "Model", "Object_", "._", "model", "Document_", "._", "basename_", "+_", "'#'_", "+_", "Xm", "l", "Util_", "._", "element", "Fragment", "Identifier_", "(_", "to", "Model", "Object_", ")_", "\\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 ", " ", " _", "target", "Uri_", "=_", "None_", "#", " ", "tb", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "source", "Uri_", "is_", "not_", "None_", "and_", "target", "Uri_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "Rel", "Set", "Id_", "=_", "rel", "Set", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Rel", "Set", "Key_", "=_", "relation", "ship", "Set", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "relation", "ship", "Set_", "._", "arc", "role_", "==_", "\"", "XB", "RL", "-", "dimension", "s", "\"_", "and_", "rel_", "._", "target", "Role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "Rel", "Set_", "=_", "self_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "relation", "ship", "Set_", "._", "arc", "role_", ",_", "rel_", "._", "target", "Role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "rel", "Set", "Key_", "in_", "enumerate_", "(_", "self_", "._", "relation", "ship", "Sets_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arc", "role_", ",_", "EL", "R_", ",_", "link", "qname_", ",_", "arc", "qname_", "=_", "rel", "Set", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arc", "role_", "==_", "\"", "XB", "RL", "-", "dimension", "s", "\"_", "and_", "EL", "R_", "==_", "rel_", "._", "target", "Role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "target", "Relationship", "Set", "Id_", "=_", "rel", "Set", "Ids_", "[_", "rel", "Set", "Key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Rel", "Set", "Key_", "=_", "rel", "Set", "Key_", "\\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_", "if_", "not_", "do", "Vertices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "rel", "Prop_", "[_", "'", "target", "Link", "role", "'_", "]_", "=_", "rel_", "._", "target", "Role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "rel", "Prop_", "[_", "'", "target", "Rel", "Set", "'_", "]_", "=_", "target", "Relationship", "Set", "Id_", "\\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 ", " ", " _", "target", "Rel", "Set", "Key_", "=_", "relation", "ship", "Set", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Rel", "Set_", "=_", "relation", "ship", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "do", "Vertices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rel", "Id_", "=_", "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 ", " ", " _", "\\u", "rel", "Prop_", "[_", "'", "from", "'_", "]_", "=_", "source", "Uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "rel", "Prop_", "[_", "'", "from", "Qn", "ame", "'_", "]_", "=_", "source", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "rel", "Prop_", "[_", "'", "to", "'_", "]_", "=_", "target", "Uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "arc", "role_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "rel_", "._", "arc", "role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rel", "Id_", "=_", "\"{}", "/{}/", "{}/{}", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "arc", "role_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "basename_", "(_", "rel_", "._", "link", "role_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "rel", "Prop_", "[_", "'", "rel", "Id", "'_", "]_", "=_", "rel", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "rel", "Prop_", "[_", "'", "rel", "Set", "Key", "'_", "]_", "=_", "relation", "ship", "Set", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rel", "E_", "._", "append_", "(_", "\\u", "rel", "Prop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "seq_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq_", "=_", "walk", "Tree_", "(_", "target", "Rel", "Set_", "._", "from", "Model", "Object_", "(_", "to", "Model", "Object_", ")_", ",_", "rel", "Id_", ",_", "seq_", ",_", "depth_", "+_", "1_", ",_", "target", "Rel", "Set", "Key_", ",_", "target", "Rel", "Set_", ",_", "visited_", ",_", "target", "Rel", "Set", "Id_", ",_", "do", "Vertices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visited_", "._", "remove_", "(_", "rel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "do", "Vertices_", "in_", "range_", "(_", "1_", ",_", "-_", "1_", ",_", "-_", "1_", ")_", ":_", "#", " ", "pass", " ", "0", " ", "=", " ", "vertice", "s", ",", " ", "pass", " ", "1", " ", "=", " ", "edges_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "relation", "ship", "Set", "Key_", "in_", "enumerate_", "(_", "self_", "._", "relation", "ship", "Sets_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arc", "role_", ",_", "link", "role_", ",_", "link", "qname_", ",_", "arc", "qname_", "=_", "relation", "ship", "Set", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arc", "role_", "not_", "in_", "(_", "\"", "XB", "RL", "-", "formula", "e", "\"_", ",_", "\"", "Table", "-", "render", "ing", "\"_", ",_", "\"", "XB", "RL", "-", "footnote", "s", "\"_", ")_", "and_", "link", "role_", "and_", "link", "qname_", "and_", "arc", "qname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rel", "Set", "Id_", "=_", "rel", "Set", "Ids_", "[_", "relation", "ship", "Set", "Key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation", "ship", "Set_", "=_", "self_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "*_", "relation", "ship", "Set", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "root", "Concept", "_", "in_", "relation", "ship", "Set_", "._", "root", "Concept", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "seq_", "=_", "walk", "Tree_", "(_", "relation", "ship", "Set_", "._", "from", "Model", "Object_", "(_", "root", "Concept", "_", ")_", ",_", "None_", ",_", "seq_", ",_", "1_", ",_", "relation", "ship", "Set", "Key_", ",_", "relation", "ship", "Set_", ",_", "set_", "(_", ")_", ",_", "rel", "Set", "Id_", ",_", "do", "Vertices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "do", "Vertices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "resources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "resource_", "in_", "resources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "resource", "Uri_", "=_", "model", "Object", "Uri_", "(_", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "{_", "'", "url", "'_", ":_", "resource", "Uri_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "resource_", "._", "string", "Value_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resource_", "._", "xml", "Lang_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", "[_", "'", "language", "'_", "]_", "=_", "resource_", "._", "xml", "Lang_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "resource_", "._", "role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", "[_", "'", "role", "'_", "]_", "=_", "resource_", "._", "role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "documents_", "[_", "model", "Object", "Document", "Uri_", "(_", "resource_", ")_", "]_", "[_", "'", "resource", "s", "'_", "]_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Xm", "l", "Util_", "._", "element", "Fragment", "Identifier_", "(_", "resource_", ")_", "]_", "=_", "r_", "\\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_", "._", "insert", "Asp", "ect", "Proxi", "es_", "(_", "aspect", "Qn", "ames", "Used_", ")_", "\\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_", "j_", ",_", "rel_", "in_", "enumerate_", "(_", "rel", "E_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rel", "Id_", "=_", "rel_", "[_", "'", "rel", "Id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rel", "Set", "Id_", "=_", "rel_", "[_", "'", "rel", "Set", "Id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rel", "Set_", "=_", "relation", "ship", "Sets_", "[_", "rel", "Set", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "dict_", "(_", "(_", "k_", ",_", "v_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "rel_", "._", "items_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "k_", "not_", "in_", "(_", "'", "rel", "Id", "'_", ",_", "'", "rel", "Predicate", "'_", ",_", "'", "rel", "Set", "Id", "'_", ",_", "'", "rel", "Set", "Key", "'_", ",_", "'", "from", "Qn", "ame", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rel", "Set_", "[_", "'", "relation", "ships", "'_", "]_", "._", "append_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rel_", "._", "get_", "(_", "'", "depth", "'_", ",_", "0_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rel", "Set_", "[_", "'", "root", "s", "'_", "]_", "._", "append_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source", "Qn", "ame_", "=_", "rel_", "[_", "'", "from", "Qn", "ame", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "source", "Qn", "ame_", "in_", "self_", "._", "aspect", "\\u", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "aspect", "\\u", "proxy_", "[_", "source", "Qn", "ame_", "]_", "._", "setdefault_", "(_", "'", "relation", "ships", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "rel_", "[_", "'", "rel", "Set", "Id", "'_", "]_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "rel_", "[_", "'", "to", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TB", "D", ":", " ", "do", " ", "we", " ", "want", " ", "to", " ", "link", " ", "resource", "s", " ", "to", " ", "the", " ", "dt", "s", " ", "(", "by", " ", "role", ",", " ", "class", ",", " ", "or", " ", "other", "wis", "e", "?)", "_", "\\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_", "resource", "ID", "s_", "._", "clear_", "(_", ")_", "#", " ", "deref", "ere", "mce", " ", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resources_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xbrl", "Semantic", "Js", "on", "Databa", "se", "Connection_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "Validat", "ion", "Results_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "Entries_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "handler_", "in_", "logging_", "._", "get", "Logger_", "(_", "\"", "are", "lle", "\"_", ")_", "._", "handlers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "handler_", ",_", "\"", "db", "Handle", "r", "Log", "Entr", "ies", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "Entries_", "=_", "handler_", "._", "db", "Handle", "r", "Log", "Entries_", "(_", ")_", "\\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_", "messages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "Refs", "_", "=_", "[_", "]_", "#", " ", "direct", " ", "link", " ", "to", " ", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "log", "Entry_", "in_", "enumerate_", "(_", "log", "Entries_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message", "Id_", "=_", "\"", "message", "/{}\"_", "._", "format_", "(_", "i_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "report_", "[_", "'", "message", "s", "'_", "]_", "[_", "message", "Id_", "]_", "=_", "m_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "log", "Entry_", "[_", "'", "code", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "log", "Entry_", "[_", "'", "level", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "log", "Entry_", "[_", "'", "message", "'_", "]_", "[_", "'", "text", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "report", "'_", ":_", "self_", "._", "report", "URI_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "Id", "'_", ":_", "message", "Id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "captur", "e", " ", "message", " ", "ref", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ref_", "in_", "log", "Entry_", "[_", "'", "refs", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Object_", "=_", "self_", "._", "model", "Xbrl", "_", "._", "model", "Object_", "(_", "ref_", "._", "get_", "(_", "'", "object", "Id", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "now", " ", "just", " ", "find", " ", "a", " ", "concept_", "\\u\\u\\uNL\\u\\u\\u_", "aspect", "Obj_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "model", "Object_", ",_", "Model", "Fact", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fact", "Id_", "=_", "Xm", "l", "Util_", "._", "element", "Fragment", "Identifier_", "(_", "model", "Object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Point_", "=_", "self_", "._", "report_", "[_", "'", "data", "Point", "s", "'_", "]_", "[_", "fact", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Point_", "._", "setdefault_", "(_", "'", "message", "s", "'_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "message", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "model", "Object_", ",_", "Model", "Concept", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "be", " ", "sure", " ", "there", "'", "s", " ", "a", " ", "proxy_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "insert", "Asp", "ect", "Proxi", "es_", "(_", "(_", "model", "Object_", "._", "qname_", ",_", ")_", ")_", "#", " ", "need", " ", "ime", "diat", "e", " ", "use", " ", "of", " ", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aspect", "Qn", "ame", "Proxy_", "(_", "model", "Object_", "._", "qname_", ")_", "._", "setdefault_", "(_", "'", "message", "s", "'_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "message", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "model", "Object_", ",_", "Model", "Relationship", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "'''", " ", "TB", "D", "\\", "10", ";", " ", " ", "source", "Id", " ", "=", " ", "qna", "me", "Pref", "ix", "\\u", "Name", "(", "model", "Object", ".", "from", "Model", "Object", ".", "qna", "me", ")", "\\", "10", ";", " ", " ", "to", "Model", "Object", " ", "=", " ", "model", "Object", ".", "to", "Model", "Object", "\\", "10", ";", " ", " ", "if", " ", "isin", "stance", "(", "to", "Model", "Object", ",", " ", "Model", "Concept", "):", "\\", "10", ";", " ", " ", "target", "Id", " ", "=", " ", "qna", "me", "Pref", "ix", "\\u", "Name", "(", "to", "Model", "Object", ".", "qna", "me", ")", "\\", "10", ";", " ", " ", "eli", "f", " ", "isin", "stance", "(", "to", "Model", "Object", ",", " ", "Model", "Reso", "urc", "e", "):", "\\", "10", ";", " ", " ", "target", "Id", " ", "=", " ", "to", "Model", "Object", ".", "model", "Document", ".", "basen", "ame", " ", "+", " ", "'#", "'", " ", "+", " ", "Xm", "l", "Ut", "il", ".", "element", "Fragment", "Identifie", "r", "(", "to", "Model", "Object", ")", "\\", "10", ";", " ", " ", "else", ":", "\\", "10", ";", " ", " ", "continue", "\\", "10", ";", " ", " ", "obj", "Ur", "i", " ", "=", " ", "URI", "Ref", "(\"", "{}/", "Relationship", "/{}/", "{}/{}", "/{}", "\".", "format", "(", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "self", ".", "report", "URI", ",", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "os", ".", "path", ".", "basen", "ame", "(", "model", "Object", ".", "arc", "role", "),", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "os", ".", "path", ".", "basen", "ame", "(", "model", "Object", ".", "link", "role", "),", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "source", "Id", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "target", "Id", ")", " ", ")", "\\", "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 ", " ", "_", "continue_", "\\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_", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "Status_", "(_", "\"", "insert", " ", "validation", " ", "message", "s", "\"_", ")_" ]
[ 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,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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 ]
Imprecise assert
corydolphin/flask-cors/tests/extension/test_app_extension.py
[ { "content": " def test_not_matching_origins(self):\n for resp in self.iter_responses('/test_list',origin=\"http://bazz.com\"):\n self.assertFalse(ACL_ORIGIN in resp.headers)", "metadata": "root.AppExtensionRegexp.test_not_matching_origins", "header": "['class', 'AppExtensionRegexp', '(', 'AppConfigTest', ')', ':', '___EOS___']", "index": 110 }, { "content": " def test_unexposed(self):\n for resp in self.iter_responses('/test_unexposed', origin='http://foo.com'):\n self.assertEqual(resp.status_code, 200)\n self.assertFalse(ACL_ORIGIN in resp.headers)", "metadata": "root.AppExtensionList.test_unexposed", "header": "['class', 'AppExtensionList', '(', 'FlaskCorsTestCase', ')', ':', '___EOS___']", "index": 189 }, { "content": " def test_exposed(self):\n for path in '/api/v1/foo', '/api/v1/bar':\n for resp in self.iter_responses(path, origin='http://bar.com'):\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(resp.headers.get(ACL_ORIGIN), 'http://bar.com')\n self.assertEqual(resp.headers.get(ACL_EXPOSE_HEADERS),\n 'X-Total-Count')\n for resp in self.iter_responses(path, origin='http://foo.com'):\n self.assertEqual(resp.status_code, 200)\n self.assertFalse(ACL_ORIGIN in resp.headers)\n self.assertFalse(ACL_EXPOSE_HEADERS in resp.headers)", "metadata": "root.AppExtensionString.test_exposed", "header": "['class', 'AppExtensionString', '(', 'FlaskCorsTestCase', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_unexposed(self):\n for resp in self.iter_responses('/', origin='http://bar.com'):\n self.assertEqual(resp.status_code, 200)\n self.assertFalse(ACL_ORIGIN in resp.headers)\n self.assertFalse(ACL_EXPOSE_HEADERS in resp.headers)", "metadata": "root.AppExtensionString.test_unexposed", "header": "['class', 'AppExtensionString', '(', 'FlaskCorsTestCase', ')', ':', '___EOS___']", "index": 232 }, { "content": " def test_override(self):\n for resp in self.iter_responses('/api/v1/special', origin='http://foo.com'):\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(resp.headers.get(ACL_ORIGIN), 'http://foo.com')\n\n self.assertFalse(ACL_EXPOSE_HEADERS in resp.headers)\n\n for resp in self.iter_responses('/api/v1/special', origin='http://bar.com'):\n self.assertEqual(resp.status_code, 200)\n self.assertFalse(ACL_ORIGIN in resp.headers)\n self.assertFalse(ACL_EXPOSE_HEADERS in resp.headers)", "metadata": "root.AppExtensionString.test_override", "header": "['class', 'AppExtensionString', '(', 'FlaskCorsTestCase', ')', ':', '___EOS___']", "index": 238 }, { "content": " def test_default(self):\n '''\n By default match all.\n '''\n\n self.app = Flask(__name__)\n CORS(self.app)\n\n @self.app.route('/')\n def index():\n return 'Welcome'\n\n for resp in self.iter_responses('/', origin='http://foo.com'):\n self.assertEqual(resp.status_code, 200)\n self.assertTrue(ACL_ORIGIN in resp.headers)", "metadata": "root.AppExtensionDefault.test_default", "header": "['class', 'AppExtensionDefault', '(', 'FlaskCorsTestCase', ')', ':', '___EOS___']", "index": 262 }, { "content": " def test_index(self):\n '''\n If regex does not match, do not set CORS\n '''\n for resp in self.iter_responses('/', origin='http://foo.bar'):\n self.assertFalse(ACL_ORIGIN in resp.headers)", "metadata": "root.AppExtensionExampleApp.test_index", "header": "['class', 'AppExtensionExampleApp', '(', 'FlaskCorsTestCase', ')', ':', '___EOS___']", "index": 298 }, { "content": " def test_wildcard(self):\n '''\n Match anything matching the path /api/* with an origin\n of 'http://blah.com' or 'http://foo.bar'\n '''\n for origin in ['http://foo.bar', 'http://blah.com']:\n for resp in self.iter_responses('/api/foo', origin=origin):\n self.assertTrue(ACL_ORIGIN in resp.headers)\n self.assertEqual(origin, resp.headers.get(ACL_ORIGIN))", "metadata": "root.AppExtensionExampleApp.test_wildcard", "header": "['class', 'AppExtensionExampleApp', '(', 'FlaskCorsTestCase', ')', ':', '___EOS___']", "index": 305 }, { "content": " def test_exact_match(self):\n '''\n Match anything matching the path /api/* with an origin\n of 'http://blah.com' or 'http://foo.bar'\n '''\n for origin in ['http://foo.bar', 'http://blah.com']:\n for resp in self.iter_responses('/api/', origin=origin):\n self.assertTrue(ACL_ORIGIN in resp.headers)\n self.assertEqual(origin, resp.headers.get(ACL_ORIGIN))", "metadata": "root.AppExtensionExampleApp.test_exact_match", "header": "['class', 'AppExtensionExampleApp', '(', 'FlaskCorsTestCase', ')', ':', '___EOS___']", "index": 315 }, { "content": " def test_compiled_regex(self):\n '''\n Ensure we do not error if the user sepcifies an bad regular\n expression.\n '''\n import re\n self.app = Flask(__name__)\n CORS(self.app, resources=re.compile('/api/.*'))\n\n @self.app.route('/')\n def index():\n return 'Welcome'\n\n @self.app.route('/api/v1')\n def example():\n return 'Welcome'\n\n for resp in self.iter_responses('/'):\n self.assertFalse(ACL_ORIGIN in resp.headers)\n\n for resp in self.iter_responses('/api/v1', origin='http://foo.com'):\n self.assertTrue(ACL_ORIGIN in resp.headers)", "metadata": "root.AppExtensionCompiledRegexp.test_compiled_regex", "header": "['class', 'AppExtensionCompiledRegexp', '(', 'FlaskCorsTestCase', ')', ':', '___EOS___']", "index": 327 } ]
[ { "span": "self.assertFalse(ACL_ORIGIN in resp.headers)", "start_line": 112, "start_column": 12, "end_line": 112, "end_column": 56 }, { "span": "self.assertFalse(ACL_ORIGIN in resp.headers)", "start_line": 192, "start_column": 12, "end_line": 192, "end_column": 56 }, { "span": "self.assertFalse(ACL_ORIGIN in resp.headers)", "start_line": 229, "start_column": 16, "end_line": 229, "end_column": 60 }, { "span": "self.assertFalse(ACL_EXPOSE_HEADERS in resp.headers)", "start_line": 230, "start_column": 16, "end_line": 230, "end_column": 68 }, { "span": "self.assertFalse(ACL_ORIGIN in resp.headers)", "start_line": 235, "start_column": 12, "end_line": 235, "end_column": 56 }, { "span": "self.assertFalse(ACL_EXPOSE_HEADERS in resp.headers)", "start_line": 236, "start_column": 12, "end_line": 236, "end_column": 64 }, { "span": "self.assertFalse(ACL_EXPOSE_HEADERS in resp.headers)", "start_line": 243, "start_column": 12, "end_line": 243, "end_column": 64 }, { "span": "self.assertFalse(ACL_ORIGIN in resp.headers)", "start_line": 247, "start_column": 12, "end_line": 247, "end_column": 56 }, { "span": "self.assertFalse(ACL_EXPOSE_HEADERS in resp.headers)", "start_line": 248, "start_column": 12, "end_line": 248, "end_column": 64 }, { "span": "self.assertTrue(ACL_ORIGIN in resp.headers)", "start_line": 276, "start_column": 12, "end_line": 276, "end_column": 55 }, { "span": "self.assertFalse(ACL_ORIGIN in resp.headers)", "start_line": 303, "start_column": 12, "end_line": 303, "end_column": 56 }, { "span": "self.assertTrue(ACL_ORIGIN in resp.headers)", "start_line": 312, "start_column": 16, "end_line": 312, "end_column": 59 }, { "span": "self.assertTrue(ACL_ORIGIN in resp.headers)", "start_line": 322, "start_column": 16, "end_line": 322, "end_column": 59 }, { "span": "self.assertFalse(ACL_ORIGIN in resp.headers)", "start_line": 345, "start_column": 12, "end_line": 345, "end_column": 56 }, { "span": "self.assertTrue(ACL_ORIGIN in resp.headers)", "start_line": 348, "start_column": 12, "end_line": 348, "end_column": 55 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "Regexp_", "(_", "App", "Config", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "not", "\\u", "matchi", "ng", "\\u", "origins", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/", "test\\u", "list", "'_", ",_", "origin_", "=_", "\"", "http", "://", "ba", "zz", ".", "com", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "List_", "(_", "Fla", "sk", "Cor", "s", "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", "une", "xpo", "sed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/", "test\\u", "une", "xpo", "sed", "'_", ",_", "origin_", "=_", "'", "http", "://", "foo", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "String_", "(_", "Fla", "sk", "Cor", "s", "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", "exposed", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "path_", "in_", "'/", "api", "/", "v1", "/", "foo", "'_", ",_", "'/", "api", "/", "v1", "/", "bar", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "path_", ",_", "origin_", "=_", "'", "http", "://", "bar", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "headers_", "._", "get_", "(_", "ACL", "\\u", "ORIGIN", "_", ")_", ",_", "'", "http", "://", "bar", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "headers_", "._", "get_", "(_", "ACL", "\\u", "EXP", "OSE", "\\u", "HEADERS_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Total", "-", "Count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "path_", ",_", "origin_", "=_", "'", "http", "://", "foo", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "EXP", "OSE", "\\u", "HEADERS_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "String_", "(_", "Fla", "sk", "Cor", "s", "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_", "def_", "test\\u", "une", "xpo", "sed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/'_", ",_", "origin_", "=_", "'", "http", "://", "bar", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "EXP", "OSE", "\\u", "HEADERS_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "String_", "(_", "Fla", "sk", "Cor", "s", "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", "override_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/", "api", "/", "v1", "/", "special", "'_", ",_", "origin_", "=_", "'", "http", "://", "foo", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "headers_", "._", "get_", "(_", "ACL", "\\u", "ORIGIN", "_", ")_", ",_", "'", "http", "://", "foo", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "EXP", "OSE", "\\u", "HEADERS_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/", "api", "/", "v1", "/", "special", "'_", ",_", "origin_", "=_", "'", "http", "://", "bar", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "EXP", "OSE", "\\u", "HEADERS_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "Default_", "(_", "Fla", "sk", "Cor", "s", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", " ", "match", " ", "all", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CORS", "_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "app_", "._", "route_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Wel", "come", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/'_", ",_", "origin_", "=_", "'", "http", "://", "foo", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "Exam", "ple", "App_", "(_", "Fla", "sk", "Cor", "s", "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", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "regex", " ", "doe", "s", " ", "not", " ", "match", ",", " ", "do", " ", "not", " ", "set", " ", "CORS", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/'_", ",_", "origin_", "=_", "'", "http", "://", "foo", ".", "bar", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "Exam", "ple", "App_", "(_", "Fla", "sk", "Cor", "s", "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", "wildcard_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Match", " ", "anyt", "hing", " ", "matchi", "ng", " ", "the", " ", "path", " ", "/", "api", "/*", " ", "with", " ", "an", " ", "orig", "in", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "'", "http", "://", "bla", "h", ".", "com", "'", " ", "or", " ", "'", "http", "://", "foo", ".", "bar", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "origin_", "in_", "[_", "'", "http", "://", "foo", ".", "bar", "'_", ",_", "'", "http", "://", "bla", "h", ".", "com", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/", "api", "/", "foo", "'_", ",_", "origin_", "=_", "origin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "origin_", ",_", "resp_", "._", "headers_", "._", "get_", "(_", "ACL", "\\u", "ORIGIN", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "Exam", "ple", "App_", "(_", "Fla", "sk", "Cor", "s", "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_", "def_", "test\\u", "exact", "\\u", "match_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Match", " ", "anyt", "hing", " ", "matchi", "ng", " ", "the", " ", "path", " ", "/", "api", "/*", " ", "with", " ", "an", " ", "orig", "in", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "'", "http", "://", "bla", "h", ".", "com", "'", " ", "or", " ", "'", "http", "://", "foo", ".", "bar", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "origin_", "in_", "[_", "'", "http", "://", "foo", ".", "bar", "'_", ",_", "'", "http", "://", "bla", "h", ".", "com", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/", "api", "/'_", ",_", "origin_", "=_", "origin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "origin_", ",_", "resp_", "._", "headers_", "._", "get_", "(_", "ACL", "\\u", "ORIGIN", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Ext", "ensi", "on", "Compiled", "Regexp_", "(_", "Fla", "sk", "Cor", "s", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "compile", "d\\u", "regex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "we", " ", "do", " ", "not", " ", "error", " ", "if", " ", "the", " ", "user", " ", "sep", "cif", "ies", " ", "an", " ", "bad", " ", "regular", "\\", "10", ";", " ", " ", " ", " ", "express", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CORS", "_", "(_", "self_", "._", "app_", ",_", "resources_", "=_", "re_", "._", "compile_", "(_", "'/", "api", "/.*", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "app_", "._", "route_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Wel", "come", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "self_", "._", "app_", "._", "route_", "(_", "'/", "api", "/", "v1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "example_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Wel", "come", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "resp_", "in_", "self_", "._", "iter", "\\u", "responses_", "(_", "'/", "api", "/", "v1", "'_", ",_", "origin_", "=_", "'", "http", "://", "foo", ".", "com", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "ACL", "\\u", "ORIGIN", "_", "in_", "resp_", "._", "headers_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 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, 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, 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, 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2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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, 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, 2 ]
Except block handles 'BaseException'
mrknow/filmkodi/plugin.video.specto/resources/lib/libraries/cache.py
[ { "content": "# -*- coding: utf-8 -*-\n\n'''\n Specto Add-on\n Copyright (C) 2015 lambda\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n'''\n\n\nimport re,hashlib,time, json\n\ntry:\n from sqlite3 import dbapi2 as database\nexcept:\n from pysqlite2 import dbapi2 as database\n\nfrom resources.lib.libraries import control\n\n\n\n\n\n\n#def getMovieSource(self, title, year, imdb, source, call):\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get(function, timeout, *args, **table):\n try:\n response = None\n\n f = repr(function)\n f = re.sub('.+\\smethod\\s|.+function\\s|\\sat\\s.+|\\sof\\s.+', '', f)\n\n a = hashlib.md5()\n for i in args: a.update(str(i))\n a = str(a.hexdigest())\n except:\n pass\n\n try:\n table = table['table']\n except:\n table = 'rel_list'\n\n try:\n control.makeFile(control.dataPath)\n dbcon = database.connect(control.cacheFile)\n dbcur = dbcon.cursor()\n dbcur.execute(\"SELECT * FROM %s WHERE func = '%s' AND args = '%s'\" % (table, f, a))\n match = dbcur.fetchone()\n\n response = eval(match[2].encode('utf-8'))\n\n t1 = int(match[3])\n t2 = int(time.time())\n update = (abs(t2 - t1) / 3600) >= int(timeout)\n if update == False:\n return response\n except:\n pass\n\n try:\n r = function(*args)\n if (r == None or r == []) and not response == None:\n return response\n elif (r == None or r == []):\n return r\n except:\n return\n\n try:\n r = repr(r)\n t = int(time.time())\n dbcur.execute(\"CREATE TABLE IF NOT EXISTS %s (\"\"func TEXT, \"\"args TEXT, \"\"response TEXT, \"\"added TEXT, \"\"UNIQUE(func, args)\"\");\" % table)\n dbcur.execute(\"DELETE FROM %s WHERE func = '%s' AND args = '%s'\" % (table, f, a))\n dbcur.execute(\"INSERT INTO %s Values (?, ?, ?, ?)\" % table, (f, a, r, t))\n dbcon.commit()\n except:\n pass\n\n try:\n return eval(r.encode('utf-8'))\n except:\n pass", "metadata": "root.get", "header": "['module', '___EOS___']", "index": 31 }, { "content": "def clear(table=None):\n try:\n control.idle()\n\n if table == None: table = ['rel_list', 'rel_lib']\n elif not type(table) == list: table = [table]\n\n yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '')\n if not yes: return\n\n dbcon = database.connect(control.cacheFile)\n dbcur = dbcon.cursor()\n\n for t in table:\n try:\n dbcur.execute(\"DROP TABLE IF EXISTS %s\" % t)\n dbcur.execute(\"VACUUM\")\n dbcon.commit()\n except:\n pass\n\n control.infoDialog(control.lang(30402).encode('utf-8'))\n except:\n pass", "metadata": "root.clear", "header": "['module', '___EOS___']", "index": 91 }, { "content": "def get_cached_url(self, url, data='', cache_limit=8):\n try:\n dbcon = database.connect(control.sourcescachedUrl)\n dbcur = dbcon.cursor()\n\n #dbcur.execute(\n # \"CREATE TABLE IF NOT EXISTS rel_url (\"\"source TEXT, \"\"imdb_id TEXT, \"\"season TEXT, \"\"episode TEXT, \"\"rel_url TEXT, \"\"UNIQUE(source, imdb_id, season, episode)\"\");\")\n dbcur.execute(\n \"CREATE TABLE IF NOT EXISTS url_cache (url VARCHAR(255) NOT NULL, data VARCHAR(255), response, res_header, timestamp, PRIMARY KEY(url, data))\")\n except:\n pass\n\n try:\n if data is None: data = ''\n html = ''\n res_header = []\n created = 0\n now = time.time()\n age = now - created\n limit = 60 * 60 * cache_limit\n dbcur.execute('SELECT timestamp, response, res_header FROM url_cache WHERE url = %s and data=%s' % (url,data))\n rows = dbcur.fetchall()\n control.log('DB ROWS: Url: %s, ' % (rows))\n\n if rows:\n created = float(rows[0][0])\n res_header = json.loads(rows[0][2])\n age = now - created\n if age < limit:\n html = rows[0][1]\n control.log('DB Cache: Url: %s, Data: %s, Cache Hit: %s, created: %s, age: %.2fs (%.2fh), limit: %ss' % (\n url, data, bool(html), created, age, age / (60 * 60), limit))\n return created, res_header, html\n except:\n return", "metadata": "root.get_cached_url", "header": "['module', '___EOS___']", "index": 118 }, { "content": "def cache_url(self, url, body, data=None, res_header=None):\n try:\n dbcon = database.connect(control.sourcescachedUrl)\n dbcur = dbcon.cursor()\n dbcur.execute(\n \"CREATE TABLE IF NOT EXISTS url_cache (url VARCHAR(255) NOT NULL, data VARCHAR(255), response, res_header, timestamp, PRIMARY KEY(url, data))\")\n except:\n pass\n try:\n now = time.time()\n if data is None: data = ''\n if res_header is None: res_header = []\n res_header = json.dumps(res_header)\n # truncate data if running mysql and greater than col size\n sql = \"REPLACE INTO url_cache (url, data, response, res_header, timestamp) VALUES(?, ?, ?, ?, ?)\" % (url, data, body, res_header, now)\n #dbcur.execute(\"DELETE FROM url_cache WHERE func = '%s' AND args = '%s'\" % (table, f, a))\n #dbcur.execute(\"INSERT INTO %s Values (?, ?, ?, ?)\" % table, (f, a, r, t))\n dbcur.execute(sql)\n dbcon.commit()\n except:\n pass", "metadata": "root.cache_url", "header": "['module', '___EOS___']", "index": 155 }, { "content": "def timeout(function, *args, **table):\n try:\n response = None\n\n f = repr(function)\n f = re.sub('.+\\smethod\\s|.+function\\s|\\sat\\s.+|\\sof\\s.+', '', f)\n\n a = hashlib.md5()\n for i in args: a.update(str(i))\n a = str(a.hexdigest())\n except:\n pass\n\n try:\n table = table['table']\n except:\n table = 'rel_list'\n\n try:\n control.makeFile(control.dataPath)\n dbcon = database.connect(control.cacheFile)\n dbcur = dbcon.cursor()\n dbcur.execute(\"SELECT * FROM %s WHERE func = '%s' AND args = '%s'\" % (table, f, a))\n match = dbcur.fetchone()\n return int(match[3])\n except:\n return", "metadata": "root.timeout", "header": "['module', '___EOS___']", "index": 177 } ]
[ { "span": "except:", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 7 }, { "span": "except:", "start_line": 41, "start_column": 4, "end_line": 41, "end_column": 11 }, { "span": "except:", "start_line": 46, "start_column": 4, "end_line": 46, "end_column": 11 }, { "span": "except:", "start_line": 63, "start_column": 4, "end_line": 63, "end_column": 11 }, { "span": "except:", "start_line": 72, "start_column": 4, "end_line": 72, "end_column": 11 }, { "span": "except:", "start_line": 82, "start_column": 4, "end_line": 82, "end_column": 11 }, { "span": "except:", "start_line": 87, "start_column": 4, "end_line": 87, "end_column": 11 }, { "span": "except:", "start_line": 109, "start_column": 12, "end_line": 109, "end_column": 19 }, { "span": "except:", "start_line": 113, "start_column": 4, "end_line": 113, "end_column": 11 }, { "span": "except:", "start_line": 127, "start_column": 4, "end_line": 127, "end_column": 11 }, { "span": "except:", "start_line": 151, "start_column": 4, "end_line": 151, "end_column": 11 }, { "span": "except:", "start_line": 161, "start_column": 4, "end_line": 161, "end_column": 11 }, { "span": "except:", "start_line": 174, "start_column": 4, "end_line": 174, "end_column": 11 }, { "span": "except:", "start_line": 187, "start_column": 4, "end_line": 187, "end_column": 11 }, { "span": "except:", "start_line": 192, "start_column": 4, "end_line": 192, "end_column": 11 }, { "span": "except:", "start_line": 202, "start_column": 4, "end_line": 202, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "Spect", "o", " ", "Add", "-", "on", "\\", "10", ";", " ", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "201", "5", " ", "lambda", "\\", "10", ";", "\\", "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", ";", " ", " ", " ", " ", "Thi", "s", " ", "program", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", " ", "See", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "\\", "10", ";", " ", " ", " ", " ", "along", " ", "with", " ", "this", " ", "program", ".", " ", " ", "If", " ", "not", ",", " ", "see", " ", "<", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/>", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", ",_", "hashlib_", ",_", "time_", ",_", "json_", "\\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_", "sqlite3_", "import_", "dbapi", "2_", "as_", "database_", "\\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_", "pys", "qli", "te", "2_", "import_", "dbapi", "2_", "as_", "database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "resources_", "._", "lib_", "._", "libraries_", "import_", "control_", "\\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_", "#", "def", " ", "get", "Movi", "e", "Sou", "rce", "(", "self", ",", " ", "title", ",", " ", "year", ",", " ", "imd", "b", ",", " ", "source", ",", " ", "call", "):", "_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "function_", ",_", "timeout_", ",_", "*_", "args_", ",_", "**_", "table_", ")_", ":_", "\\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 ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "repr_", "(_", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "re_", "._", "sub_", "(_", "'.", "+\\\\", "sme", "thod", "\\\\", "s", "|.", "+", "function", "\\\\", "s", "|\\\\", "sat", "\\\\", "s", ".+", "|\\\\", "sof", "\\\\", "s", ".+", "'_", ",_", "''_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "args_", ":_", "a_", "._", "update_", "(_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "str_", "(_", "a_", "._", "hexdigest_", "(_", ")_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "table_", "[_", "'", "table", "'_", "]_", "\\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 ", " _", "table_", "=_", "'", "rel", "\\u", "list", "'_", "\\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 ", " _", "control_", "._", "make", "File_", "(_", "control_", "._", "data", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "cache", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "%", "s", " ", "WHE", "RE", " ", "func", " ", "=", " ", "'%", "s", "'", " ", "AND", " ", "args", " ", "=", " ", "'%", "s", "'\"_", "%_", "(_", "table_", ",_", "f_", ",_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "dbc", "ur_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "eval_", "(_", "match_", "[_", "2_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "int_", "(_", "match_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update_", "=_", "(_", "abs_", "(_", "t2_", "-_", "t1_", ")_", "/_", "3600_", ")_", ">=_", "int_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "function_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "r_", "==_", "None_", "or_", "r_", "==_", "[_", "]_", ")_", "and_", "not_", "response_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "r_", "==_", "None_", "or_", "r_", "==_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "r_", "\\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 ", " _", "return_", "\\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 ", " _", "r_", "=_", "repr_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "%", "s", " ", "(\"_", "\"", "func", " ", "TEXT", ",", " ", "\"_", "\"", "args", " ", "TEXT", ",", " ", "\"_", "\"", "response", " ", "TEXT", ",", " ", "\"_", "\"", "adde", "d", " ", "TEXT", ",", " ", "\"_", "\"", "UNI", "QUE", "(", "func", ",", " ", "args", ")\"_", "\");", "\"_", "%_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "DELET", "E", " ", "FROM", " ", "%", "s", " ", "WHE", "RE", " ", "func", " ", "=", " ", "'%", "s", "'", " ", "AND", " ", "args", " ", "=", " ", "'%", "s", "'\"_", "%_", "(_", "table_", ",_", "f_", ",_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "INSERT", " ", "INT", "O", " ", "%", "s", " ", "Value", "s", " ", "(?", ",", " ", "?", ",", " ", "?", ",", " ", "?)\"_", "%_", "table_", ",_", "(_", "f_", ",_", "a_", ",_", "r_", ",_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "._", "commit_", "(_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "eval_", "(_", "r_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\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_", "[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_", "clear_", "(_", "table_", "=_", "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 ", " _", "control_", "._", "idle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "table_", "==_", "None_", ":_", "table_", "=_", "[_", "'", "rel", "\\u", "list", "'_", ",_", "'", "rel", "\\u", "lib", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "not_", "type_", "(_", "table_", ")_", "==_", "list_", ":_", "table_", "=_", "[_", "table_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yes_", "=_", "control_", "._", "yesno", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "01_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "''_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "yes_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "cache", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "table_", ":_", "\\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 ", " _", "dbc", "ur_", "._", "execute_", "(_", "\"", "DROP", " ", "TAB", "LE", " ", "IF", " ", "EXIST", "S", " ", "%", "s", "\"_", "%_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "VA", "CU", "UM", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "._", "commit_", "(_", ")_", "\\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_", "control_", "._", "info", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "02_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\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_", "[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_", "get", "\\u", "cache", "d\\u", "url_", "(_", "self_", ",_", "url_", ",_", "data_", "=_", "''_", ",_", "cache", "\\u", "limit_", "=_", "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 ", " _", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "source", "sca", "ched", "Url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "dbc", "ur", ".", "execute", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "rel", "\\u", "url", " ", "(\"", "\"", "source", " ", "TEXT", ",", " ", "\"\"", "imd", "b", "\\u", "id", " ", "TEXT", ",", " ", "\"\"", "season", " ", "TEXT", ",", " ", "\"\"", "episode", " ", "TEXT", ",", " ", "\"\"", "rel", "\\u", "url", " ", "TEXT", ",", " ", "\"\"", "UNI", "QUE", "(", "source", ",", " ", "imd", "b", "\\u", "id", ",", " ", "season", ",", " ", "episode", ")\"", "\");", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "url", "\\u", "cache", " ", "(", "url", " ", "VARCHA", "R", "(", "255", ")", " ", "NOT", " ", "NULL", ",", " ", "data", " ", "VARCHA", "R", "(", "255", "),", " ", "response", ",", " ", "res", "\\u", "header", ",", " ", "timestamp", ",", " ", "PRIMA", "RY", " ", "KEY", "(", "url", ",", " ", "data", "))\"_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "is_", "None_", ":_", "data_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "header_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "age_", "=_", "now_", "-_", "created_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "60_", "*_", "60_", "*_", "cache", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "'", "SELECT", " ", "timestamp", ",", " ", "response", ",", " ", "res", "\\u", "header", " ", "FROM", " ", "url", "\\u", "cache", " ", "WHE", "RE", " ", "url", " ", "=", " ", "%", "s", " ", "and", " ", "data", "=", "%", "s", "'_", "%_", "(_", "url_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "dbc", "ur_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "log_", "(_", "'", "DB", " ", "ROWS", ":", " ", "Ur", "l", ":", " ", "%", "s", ",", " ", "'_", "%_", "(_", "rows_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "created_", "=_", "float_", "(_", "rows_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "header_", "=_", "json_", "._", "loads_", "(_", "rows_", "[_", "0_", "]_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "age_", "=_", "now_", "-_", "created_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "age_", "<_", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "=_", "rows_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "control_", "._", "log_", "(_", "'", "DB", " ", "Cache", ":", " ", "Ur", "l", ":", " ", "%", "s", ",", " ", "Data", ":", " ", "%", "s", ",", " ", "Cache", " ", "Hit", ":", " ", "%", "s", ",", " ", "created", ":", " ", "%", "s", ",", " ", "age", ":", " ", "%", ".2", "fs", " ", "(%", ".2", "fh", "),", " ", "limit", ":", " ", "%", "ss", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", ",_", "data_", ",_", "bool_", "(_", "html_", ")_", ",_", "created_", ",_", "age_", ",_", "age_", "/_", "(_", "60_", "*_", "60_", ")_", ",_", "limit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "created_", ",_", "res", "\\u", "header_", ",_", "html_", "\\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_", "[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_", "cache", "\\u", "url_", "(_", "self_", ",_", "url_", ",_", "body_", ",_", "data_", "=_", "None_", ",_", "res", "\\u", "header_", "=_", "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 ", " _", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "source", "sca", "ched", "Url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "url", "\\u", "cache", " ", "(", "url", " ", "VARCHA", "R", "(", "255", ")", " ", "NOT", " ", "NULL", ",", " ", "data", " ", "VARCHA", "R", "(", "255", "),", " ", "response", ",", " ", "res", "\\u", "header", ",", " ", "timestamp", ",", " ", "PRIMA", "RY", " ", "KEY", "(", "url", ",", " ", "data", "))\"_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "is_", "None_", ":_", "data_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res", "\\u", "header_", "is_", "None_", ":_", "res", "\\u", "header_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "header_", "=_", "json_", "._", "dumps_", "(_", "res", "\\u", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "truncat", "e", " ", "data", " ", "if", " ", "runn", "ing", " ", "mysql", " ", "and", " ", "great", "er", " ", "than", " ", "col", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "=_", "\"", "REPLACE", " ", "INT", "O", " ", "url", "\\u", "cache", " ", "(", "url", ",", " ", "data", ",", " ", "response", ",", " ", "res", "\\u", "header", ",", " ", "timestamp", ")", " ", "VALU", "ES", "(?", ",", " ", "?", ",", " ", "?", ",", " ", "?", ",", " ", "?)\"_", "%_", "(_", "url_", ",_", "data_", ",_", "body_", ",_", "res", "\\u", "header_", ",_", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dbc", "ur", ".", "execute", "(\"", "DELET", "E", " ", "FROM", " ", "url", "\\u", "cache", " ", "WHE", "RE", " ", "func", " ", "=", " ", "'%", "s", "'", " ", "AND", " ", "args", " ", "=", " ", "'%", "s", "'\"", " ", "%", " ", "(", "table", ",", " ", "f", ",", " ", "a", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "dbc", "ur", ".", "execute", "(\"", "INSERT", " ", "INT", "O", " ", "%", "s", " ", "Value", "s", " ", "(?", ",", " ", "?", ",", " ", "?", ",", " ", "?)", "\"", " ", "%", " ", "table", ",", " ", "(", "f", ",", " ", "a", ",", " ", "r", ",", " ", "t", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "._", "commit_", "(_", ")_", "\\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_", "[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_", "timeout_", "(_", "function_", ",_", "*_", "args_", ",_", "**_", "table_", ")_", ":_", "\\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 ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "repr_", "(_", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "re_", "._", "sub_", "(_", "'.", "+\\\\", "sme", "thod", "\\\\", "s", "|.", "+", "function", "\\\\", "s", "|\\\\", "sat", "\\\\", "s", ".+", "|\\\\", "sof", "\\\\", "s", ".+", "'_", ",_", "''_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "args_", ":_", "a_", "._", "update_", "(_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "str_", "(_", "a_", "._", "hexdigest_", "(_", ")_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "table_", "[_", "'", "table", "'_", "]_", "\\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 ", " _", "table_", "=_", "'", "rel", "\\u", "list", "'_", "\\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 ", " _", "control_", "._", "make", "File_", "(_", "control_", "._", "data", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "cache", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "%", "s", " ", "WHE", "RE", " ", "func", " ", "=", " ", "'%", "s", "'", " ", "AND", " ", "args", " ", "=", " ", "'%", "s", "'\"_", "%_", "(_", "table_", ",_", "f_", ",_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "dbc", "ur_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "int_", "(_", "match_", "[_", "3_", "]_", ")_", "\\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_" ]
[ 4, 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
nii-cloud/dodai-compute/nova/tests/api/openstack/test_extensions.py
[ { "content": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2011 OpenStack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# 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, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport json\nimport os.path\nimport webob\nfrom lxml import etree\n\nfrom nova import context\nfrom nova import test\nfrom nova.api import openstack\nfrom nova.api.openstack import extensions\nfrom nova.api.openstack import flavors\nfrom nova.api.openstack import wsgi\nfrom nova.api.openstack import xmlutil\nfrom nova.tests.api.openstack import fakes\n\nNS = \"{http://docs.openstack.org/compute/api/v1.1}\"\nATOMNS = \"{http://www.w3.org/2005/Atom}\"\nresponse_body = \"Try to say this Mr. Knox, sir...\"\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 StubController(object):\n\n", "metadata": "root.StubController", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def __init__(self, body):\n self.body = body", "metadata": "root.StubController.__init__", "header": "['class', 'StubController', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": " def index(self, req):\n return self.body", "metadata": "root.StubController.index", "header": "['class', 'StubController', '(', 'object', ')', ':', '___EOS___']", "index": 41 }, { "content": "class StubExtensionManager(object):\n\n\n\n\n\n\n", "metadata": "root.StubExtensionManager", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def __init__(self, resource_ext=None, action_ext=None, request_ext=None):\n self.resource_ext = resource_ext\n self.action_ext = action_ext\n self.request_ext = request_ext", "metadata": "root.StubExtensionManager.__init__", "header": "['class', 'StubExtensionManager', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def get_name(self):\n return \"Tweedle Beetle Extension\"", "metadata": "root.StubExtensionManager.get_name", "header": "['class', 'StubExtensionManager', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " def get_alias(self):\n return \"TWDLBETL\"", "metadata": "root.StubExtensionManager.get_alias", "header": "['class', 'StubExtensionManager', '(', 'object', ')', ':', '___EOS___']", "index": 55 }, { "content": " def get_description(self):\n return \"Provides access to Tweedle Beetles\"", "metadata": "root.StubExtensionManager.get_description", "header": "['class', 'StubExtensionManager', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def get_resources(self):\n resource_exts = []\n if self.resource_ext:\n resource_exts.append(self.resource_ext)\n return resource_exts", "metadata": "root.StubExtensionManager.get_resources", "header": "['class', 'StubExtensionManager', '(', 'object', ')', ':', '___EOS___']", "index": 61 }, { "content": " def get_actions(self):\n action_exts = []\n if self.action_ext:\n action_exts.append(self.action_ext)\n return action_exts", "metadata": "root.StubExtensionManager.get_actions", "header": "['class', 'StubExtensionManager', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def get_request_extensions(self):\n request_extensions = []\n if self.request_ext:\n request_extensions.append(self.request_ext)\n return request_extensions", "metadata": "root.StubExtensionManager.get_request_extensions", "header": "['class', 'StubExtensionManager', '(', 'object', ')', ':', '___EOS___']", "index": 73 }, { "content": "class ExtensionControllerTest(test.TestCase):\n\n\n\n\n\n", "metadata": "root.ExtensionControllerTest", "header": "['module', '___EOS___']", "index": 80 }, { "content": " def setUp(self):\n super(ExtensionControllerTest, self).setUp()\n ext_path = os.path.join(os.path.dirname(__file__), \"extensions\")\n self.flags(osapi_extensions_path=ext_path)\n self.ext_list = [\n \"Createserverext\",\n \"FlavorExtraSpecs\",\n \"FlavorExtraData\",\n \"Floating_ips\",\n \"Fox In Socks\",\n \"Hosts\",\n \"Keypairs\",\n \"Multinic\",\n \"Quotas\",\n \"Rescue\",\n \"SecurityGroups\",\n \"SimpleTenantUsage\",\n \"VSAs\",\n \"VirtualInterfaces\",\n \"Volumes\",\n \"VolumeTypes\",\n ]\n self.ext_list.sort()", "metadata": "root.ExtensionControllerTest.setUp", "header": "['class', 'ExtensionControllerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 82 }, { "content": " def test_list_extensions_json(self):\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app)\n request = webob.Request.blank(\"/123/extensions\")\n response = request.get_response(ext_midware)\n self.assertEqual(200, response.status_int)\n\n # Make sure we have all the extensions.\n data = json.loads(response.body)\n names = [x['name'] for x in data['extensions']]\n names.sort()\n self.assertEqual(names, self.ext_list)\n\n # Make sure that at least Fox in Sox is correct.\n (fox_ext, ) = [\n x for x in data['extensions'] if x['alias'] == 'FOXNSOX']\n self.assertEqual(fox_ext, {\n 'namespace': 'http://www.fox.in.socks/api/ext/pie/v1.0',\n 'name': 'Fox In Socks',\n 'updated': '2011-01-22T13:25:27-06:00',\n 'description': 'The Fox In Socks Extension',\n 'alias': 'FOXNSOX',\n 'links': []\n },\n )", "metadata": "root.ExtensionControllerTest.test_list_extensions_json", "header": "['class', 'ExtensionControllerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test_get_extension_json(self):\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app)\n request = webob.Request.blank(\"/123/extensions/FOXNSOX\")\n response = request.get_response(ext_midware)\n self.assertEqual(200, response.status_int)\n\n data = json.loads(response.body)\n self.assertEqual(data['extension'], {\n \"namespace\": \"http://www.fox.in.socks/api/ext/pie/v1.0\",\n \"name\": \"Fox In Socks\",\n \"updated\": \"2011-01-22T13:25:27-06:00\",\n \"description\": \"The Fox In Socks Extension\",\n \"alias\": \"FOXNSOX\",\n \"links\": []})", "metadata": "root.ExtensionControllerTest.test_get_extension_json", "header": "['class', 'ExtensionControllerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 132 }, { "content": " def test_get_non_existing_extension_json(self):\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app)\n request = webob.Request.blank(\"/123/extensions/4\")\n response = request.get_response(ext_midware)\n self.assertEqual(404, response.status_int)", "metadata": "root.ExtensionControllerTest.test_get_non_existing_extension_json", "header": "['class', 'ExtensionControllerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 148 }, { "content": " def test_list_extensions_xml(self):\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app)\n request = webob.Request.blank(\"/123/extensions\")\n request.accept = \"application/xml\"\n response = request.get_response(ext_midware)\n self.assertEqual(200, response.status_int)\n print response.body\n\n root = etree.XML(response.body)\n self.assertEqual(root.tag.split('extensions')[0], NS)\n\n # Make sure we have all the extensions.\n exts = root.findall('{0}extension'.format(NS))\n self.assertEqual(len(exts), len(self.ext_list))\n\n # Make sure that at least Fox in Sox is correct.\n (fox_ext, ) = [x for x in exts if x.get('alias') == 'FOXNSOX']\n self.assertEqual(fox_ext.get('name'), 'Fox In Socks')\n self.assertEqual(fox_ext.get('namespace'),\n 'http://www.fox.in.socks/api/ext/pie/v1.0')\n self.assertEqual(fox_ext.get('updated'), '2011-01-22T13:25:27-06:00')\n self.assertEqual(fox_ext.findtext('{0}description'.format(NS)),\n 'The Fox In Socks Extension')\n\n xmlutil.validate_schema(root, 'extensions')", "metadata": "root.ExtensionControllerTest.test_list_extensions_xml", "header": "['class', 'ExtensionControllerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 155 }, { "content": " def test_get_extension_xml(self):\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app)\n request = webob.Request.blank(\"/123/extensions/FOXNSOX\")\n request.accept = \"application/xml\"\n response = request.get_response(ext_midware)\n self.assertEqual(200, response.status_int)\n xml = response.body\n print xml\n\n root = etree.XML(xml)\n self.assertEqual(root.tag.split('extension')[0], NS)\n self.assertEqual(root.get('alias'), 'FOXNSOX')\n self.assertEqual(root.get('name'), 'Fox In Socks')\n self.assertEqual(root.get('namespace'),\n 'http://www.fox.in.socks/api/ext/pie/v1.0')\n self.assertEqual(root.get('updated'), '2011-01-22T13:25:27-06:00')\n self.assertEqual(root.findtext('{0}description'.format(NS)),\n 'The Fox In Socks Extension')\n\n xmlutil.validate_schema(root, 'extension')", "metadata": "root.ExtensionControllerTest.test_get_extension_xml", "header": "['class', 'ExtensionControllerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 182 }, { "content": "class ResourceExtensionTest(test.TestCase):\n\n\n\n", "metadata": "root.ResourceExtensionTest", "header": "['module', '___EOS___']", "index": 205 }, { "content": " def setUp(self):\n super(ResourceExtensionTest, self).setUp()\n ext_path = os.path.join(os.path.dirname(__file__), \"extensions\")\n self.flags(osapi_extensions_path=ext_path)", "metadata": "root.ResourceExtensionTest.setUp", "header": "['class', 'ResourceExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 207 }, { "content": " def test_no_extension_present(self):\n manager = StubExtensionManager(None)\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app, manager)\n request = webob.Request.blank(\"/blah\")\n response = request.get_response(ext_midware)\n self.assertEqual(404, response.status_int)", "metadata": "root.ResourceExtensionTest.test_no_extension_present", "header": "['class', 'ResourceExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 212 }, { "content": " def test_get_resources(self):\n res_ext = extensions.ResourceExtension('tweedles',\n StubController(response_body))\n manager = StubExtensionManager(res_ext)\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app, manager)\n request = webob.Request.blank(\"/123/tweedles\")\n response = request.get_response(ext_midware)\n self.assertEqual(200, response.status_int)\n self.assertEqual(response_body, response.body)", "metadata": "root.ResourceExtensionTest.test_get_resources", "header": "['class', 'ResourceExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_get_resources_with_controller(self):\n res_ext = extensions.ResourceExtension('tweedles',\n StubController(response_body))\n manager = StubExtensionManager(res_ext)\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app, manager)\n request = webob.Request.blank(\"/123/tweedles\")\n response = request.get_response(ext_midware)\n self.assertEqual(200, response.status_int)\n self.assertEqual(response_body, response.body)", "metadata": "root.ResourceExtensionTest.test_get_resources_with_controller", "header": "['class', 'ResourceExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 231 }, { "content": "class InvalidExtension(object):\n", "metadata": "root.InvalidExtension", "header": "['module', '___EOS___']", "index": 243 }, { "content": " def get_alias(self):\n return \"THIRD\"", "metadata": "root.InvalidExtension.get_alias", "header": "['class', 'InvalidExtension', '(', 'object', ')', ':', '___EOS___']", "index": 245 }, { "content": "class ExtensionManagerTest(test.TestCase):\n\n response_body = \"Try to say this Mr. Knox, sir...\"\n\n\n", "metadata": "root.ExtensionManagerTest", "header": "['module', '___EOS___']", "index": 249 }, { "content": " def setUp(self):\n super(ExtensionManagerTest, self).setUp()\n ext_path = os.path.join(os.path.dirname(__file__), \"extensions\")\n self.flags(osapi_extensions_path=ext_path)", "metadata": "root.ExtensionManagerTest.setUp", "header": "['class', 'ExtensionManagerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 253 }, { "content": " def test_get_resources(self):\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app)\n request = webob.Request.blank(\"/123/foxnsocks\")\n response = request.get_response(ext_midware)\n self.assertEqual(200, response.status_int)\n self.assertEqual(response_body, response.body)", "metadata": "root.ExtensionManagerTest.test_get_resources", "header": "['class', 'ExtensionManagerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 258 }, { "content": " def test_invalid_extensions(self):\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app)\n ext_mgr = ext_midware.ext_mgr\n ext_mgr.add_extension(InvalidExtension())\n self.assertTrue('FOXNSOX' in ext_mgr.extensions)\n self.assertTrue('THIRD' not in ext_mgr.extensions)", "metadata": "root.ExtensionManagerTest.test_invalid_extensions", "header": "['class', 'ExtensionManagerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 266 }, { "content": "class ActionExtensionTest(test.TestCase):\n\n\n\n\n", "metadata": "root.ActionExtensionTest", "header": "['module', '___EOS___']", "index": 275 }, { "content": " def setUp(self):\n super(ActionExtensionTest, self).setUp()\n ext_path = os.path.join(os.path.dirname(__file__), \"extensions\")\n self.flags(osapi_extensions_path=ext_path)", "metadata": "root.ActionExtensionTest.setUp", "header": "['class', 'ActionExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 277 }, { "content": " def _send_server_action_request(self, url, body):\n app = openstack.APIRouterV11()\n ext_midware = extensions.ExtensionMiddleware(app)\n request = webob.Request.blank(url)\n request.method = 'POST'\n request.content_type = 'application/json'\n request.body = json.dumps(body)\n response = request.get_response(ext_midware)\n return response", "metadata": "root.ActionExtensionTest._send_server_action_request", "header": "['class', 'ActionExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 282 }, { "content": " def test_extended_action(self):\n body = dict(add_tweedle=dict(name=\"test\"))\n url = \"/123/servers/1/action\"\n response = self._send_server_action_request(url, body)\n self.assertEqual(200, response.status_int)\n self.assertEqual(\"Tweedle Beetle Added.\", response.body)\n\n body = dict(delete_tweedle=dict(name=\"test\"))\n response = self._send_server_action_request(url, body)\n self.assertEqual(200, response.status_int)\n self.assertEqual(\"Tweedle Beetle Deleted.\", response.body)", "metadata": "root.ActionExtensionTest.test_extended_action", "header": "['class', 'ActionExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 292 }, { "content": " def test_invalid_action_body(self):\n body = dict(blah=dict(name=\"test\")) # Doesn't exist\n url = \"/123/servers/1/action\"\n response = self._send_server_action_request(url, body)\n self.assertEqual(400, response.status_int)", "metadata": "root.ActionExtensionTest.test_invalid_action_body", "header": "['class', 'ActionExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 304 }, { "content": " def test_invalid_action(self):\n body = dict(blah=dict(name=\"test\"))\n url = \"/123/fdsa/1/action\"\n response = self._send_server_action_request(url, body)\n self.assertEqual(404, response.status_int)", "metadata": "root.ActionExtensionTest.test_invalid_action", "header": "['class', 'ActionExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 310 }, { "content": "class RequestExtensionTest(test.TestCase):\n\n\n", "metadata": "root.RequestExtensionTest", "header": "['module', '___EOS___']", "index": 317 }, { "content": " def setUp(self):\n super(RequestExtensionTest, self).setUp()\n ext_path = os.path.join(os.path.dirname(__file__), \"extensions\")\n self.flags(osapi_extensions_path=ext_path)", "metadata": "root.RequestExtensionTest.setUp", "header": "['class', 'RequestExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 319 }, { "content": " def test_get_resources_with_stub_mgr(self):\n\n def _req_handler(req, res):\n # only handle JSON responses\n data = json.loads(res.body)\n data['flavor']['googoose'] = req.GET.get('chewing')\n res.body = json.dumps(data)\n return res\n\n req_ext = extensions.RequestExtension('GET',\n '/v1.1/123/flavors/:(id)',\n _req_handler)\n\n manager = StubExtensionManager(None, None, req_ext)\n app = fakes.wsgi_app()\n ext_midware = extensions.ExtensionMiddleware(app, manager)\n request = webob.Request.blank(\"/v1.1/123/flavors/1?chewing=bluegoo\")\n request.environ['api.version'] = '1.1'\n response = request.get_response(ext_midware)\n self.assertEqual(200, response.status_int)\n response_data = json.loads(response.body)\n self.assertEqual('bluegoo', response_data['flavor']['googoose'])", "metadata": "root.RequestExtensionTest.test_get_resources_with_stub_mgr", "header": "['class', 'RequestExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 324 }, { "content": " def test_get_resources_with_mgr(self):\n\n app = fakes.wsgi_app()\n ext_midware = extensions.ExtensionMiddleware(app)\n request = webob.Request.blank(\"/v1.1/123/flavors/1?chewing=newblue\")\n request.environ['api.version'] = '1.1'\n response = request.get_response(ext_midware)\n self.assertEqual(200, response.status_int)\n response_data = json.loads(response.body)\n self.assertEqual('newblue', response_data['flavor']['googoose'])\n self.assertEqual(\"Pig Bands!\", response_data['big_bands'])", "metadata": "root.RequestExtensionTest.test_get_resources_with_mgr", "header": "['class', 'RequestExtensionTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 347 }, { "content": "class ExtensionsXMLSerializerTest(test.TestCase):\n\n", "metadata": "root.ExtensionsXMLSerializerTest", "header": "['module', '___EOS___']", "index": 360 }, { "content": " def test_serialize_extenstion(self):\n serializer = extensions.ExtensionsXMLSerializer()\n data = {'extension': {\n 'name': 'ext1',\n 'namespace': 'http://docs.rack.com/servers/api/ext/pie/v1.0',\n 'alias': 'RS-PIE',\n 'updated': '2011-01-22T13:25:27-06:00',\n 'description': 'Adds the capability to share an image.',\n 'links': [{'rel': 'describedby',\n 'type': 'application/pdf',\n 'href': 'http://docs.rack.com/servers/api/ext/cs.pdf'},\n {'rel': 'describedby',\n 'type': 'application/vnd.sun.wadl+xml',\n 'href': 'http://docs.rack.com/servers/api/ext/cs.wadl'}]}}\n\n xml = serializer.serialize(data, 'show')\n print xml\n root = etree.XML(xml)\n ext_dict = data['extension']\n self.assertEqual(root.findtext('{0}description'.format(NS)),\n ext_dict['description'])\n\n for key in ['name', 'namespace', 'alias', 'updated']:\n self.assertEqual(root.get(key), ext_dict[key])\n\n link_nodes = root.findall('{0}link'.format(ATOMNS))\n self.assertEqual(len(link_nodes), 2)\n for i, link in enumerate(ext_dict['links']):\n for key, value in link.items():\n self.assertEqual(link_nodes[i].get(key), value)\n\n xmlutil.validate_schema(root, 'extension')", "metadata": "root.ExtensionsXMLSerializerTest.test_serialize_extenstion", "header": "['class', 'ExtensionsXMLSerializerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 362 }, { "content": " def test_serialize_extensions(self):\n serializer = extensions.ExtensionsXMLSerializer()\n data = {\"extensions\": [{\n \"name\": \"Public Image Extension\",\n \"namespace\": \"http://foo.com/api/ext/pie/v1.0\",\n \"alias\": \"RS-PIE\",\n \"updated\": \"2011-01-22T13:25:27-06:00\",\n \"description\": \"Adds the capability to share an image.\",\n \"links\": [{\"rel\": \"describedby\",\n \"type\": \"application/pdf\",\n \"type\": \"application/vnd.sun.wadl+xml\",\n \"href\": \"http://foo.com/api/ext/cs-pie.pdf\"},\n {\"rel\": \"describedby\",\n \"type\": \"application/vnd.sun.wadl+xml\",\n \"href\": \"http://foo.com/api/ext/cs-pie.wadl\"}]},\n {\"name\": \"Cloud Block Storage\",\n \"namespace\": \"http://foo.com/api/ext/cbs/v1.0\",\n \"alias\": \"RS-CBS\",\n \"updated\": \"2011-01-12T11:22:33-06:00\",\n \"description\": \"Allows mounting cloud block storage.\",\n \"links\": [{\"rel\": \"describedby\",\n \"type\": \"application/pdf\",\n \"href\": \"http://foo.com/api/ext/cs-cbs.pdf\"},\n {\"rel\": \"describedby\",\n \"type\": \"application/vnd.sun.wadl+xml\",\n \"href\": \"http://foo.com/api/ext/cs-cbs.wadl\"}]}]}\n\n xml = serializer.serialize(data, 'index')\n print xml\n root = etree.XML(xml)\n ext_elems = root.findall('{0}extension'.format(NS))\n self.assertEqual(len(ext_elems), 2)\n for i, ext_elem in enumerate(ext_elems):\n ext_dict = data['extensions'][i]\n self.assertEqual(ext_elem.findtext('{0}description'.format(NS)),\n ext_dict['description'])\n\n for key in ['name', 'namespace', 'alias', 'updated']:\n self.assertEqual(ext_elem.get(key), ext_dict[key])\n\n link_nodes = ext_elem.findall('{0}link'.format(ATOMNS))\n self.assertEqual(len(link_nodes), 2)\n for i, link in enumerate(ext_dict['links']):\n for key, value in link.items():\n self.assertEqual(link_nodes[i].get(key), value)\n\n xmlutil.validate_schema(root, 'extensions')", "metadata": "root.ExtensionsXMLSerializerTest.test_serialize_extensions", "header": "['class', 'ExtensionsXMLSerializerTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 395 } ]
[ { "span": "from nova import context", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 24 }, { "span": "from nova.api.openstack import flavors", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 38 }, { "span": "from nova.api.openstack import wsgi", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "vim", ":", " ", "tabs", "top", "=", "4", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "Open", "Stack", " ", "LLC", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "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", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nova_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "api_", "import_", "openstack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "api_", "._", "openstack_", "import_", "extensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "api_", "._", "openstack_", "import_", "flavors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "api_", "._", "openstack_", "import_", "wsgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "api_", "._", "openstack_", "import_", "xml", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "tests_", "._", "api_", "._", "openstack_", "import_", "fakes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NS_", "=_", "\"{", "http", "://", "docs", ".", "openst", "ack", ".", "org", "/", "compute", "/", "api", "/", "v1", ".1", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ATOM", "NS_", "=_", "\"{", "http", "://", "www", ".", "w3", ".", "org", "/", "2005", "/", "Atom", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "body_", "=_", "\"", "Tr", "y", " ", "to", " ", "say", " ", "this", " ", "Mr", ".", " ", "Kno", "x", ",", " ", "sir", "...\"_", "\\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\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Stu", "b", "Controller_", "(_", "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_", "[SEP]_", "class_", "Stu", "b", "Controller_", "(_", "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_", ",_", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body_", "=_", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stu", "b", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "index_", "(_", "self_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "body_", "\\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_", "Stu", "b", "Ext", "ensi", "on", "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_", "\\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_", "Stu", "b", "Ext", "ensi", "on", "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_", ",_", "resource", "\\u", "ext_", "=_", "None_", ",_", "action", "\\u", "ext_", "=_", "None_", ",_", "request", "\\u", "ext_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "resource", "\\u", "ext_", "=_", "resource", "\\u", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "action", "\\u", "ext_", "=_", "action", "\\u", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "\\u", "ext_", "=_", "request", "\\u", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Twe", "edl", "e", " ", "Bee", "tle", " ", "Ext", "ensi", "on", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "alias_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "TW", "DL", "BET", "L", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Prov", "ides", " ", "access", " ", "to", " ", "Twe", "edl", "e", " ", "Bee", "tle", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "resources_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "exts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "resource", "\\u", "ext_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "exts_", "._", "append_", "(_", "self_", "._", "resource", "\\u", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "resource", "\\u", "exts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "actions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "\\u", "exts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "action", "\\u", "ext_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "\\u", "exts_", "._", "append_", "(_", "self_", "._", "action", "\\u", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "action", "\\u", "exts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "request", "\\u", "extensions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "extensions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "request", "\\u", "ext_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "extensions_", "._", "append_", "(_", "self_", "._", "request", "\\u", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "request", "\\u", "extensions_", "\\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_", "Ext", "ensi", "on", "Controlle", "r", "Test_", "(_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Controlle", "r", "Test_", "(_", "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 ", " _", "super_", "(_", "Ext", "ensi", "on", "Controlle", "r", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\"", "extensi", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flags_", "(_", "osa", "pi", "\\u", "extensions\\u", "path_", "=_", "ext", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ext", "\\u", "list_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Creat", "ese", "rver", "ext", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Fla", "vor", "Extra", "Spec", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Fla", "vor", "Extra", "Data", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Float", "ing", "\\u", "ips", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Fo", "x", " ", "In", " ", "Sock", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Host", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Keyp", "airs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Multi", "nic", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Quota", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Resc", "ue", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Secur", "it", "y", "Group", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Simple", "Ten", "ant", "Us", "age", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "VS", "As", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Virt", "ual", "Interface", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Volume", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Volume", "Type", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ext", "\\u", "list_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Controlle", "r", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "extensions\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "123", "/", "extensi", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "have", " ", "all", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "x_", "[_", "'", "name", "'_", "]_", "for_", "x_", "in_", "data_", "[_", "'", "extensi", "ons", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "names_", ",_", "self_", "._", "ext", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "at", " ", "leas", "t", " ", "Fo", "x", " ", "in", " ", "So", "x", " ", "is", " ", "correct", "._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "fox", "\\u", "ext_", ",_", ")_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "for_", "x_", "in_", "data_", "[_", "'", "extensi", "ons", "'_", "]_", "if_", "x_", "[_", "'", "alias", "'_", "]_", "==_", "'", "FO", "XN", "SO", "X", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fox", "\\u", "ext_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "namespace", "'_", ":_", "'", "http", "://", "www", ".", "fox", ".", "in", ".", "socks", "/", "api", "/", "ext", "/", "pie", "/", "v1", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Fo", "x", " ", "In", " ", "Sock", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "'", "2011", "-0", "1", "-", "2", "2", "T1", "3", ":", "25", ":", "2", "7", "-0", "6", ":", "00", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "The", " ", "Fo", "x", " ", "In", " ", "Sock", "s", " ", "Ext", "ensi", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alias", "'_", ":_", "'", "FO", "XN", "SO", "X", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "s", "'_", ":_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Controlle", "r", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "extensi", "on", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "123", "/", "extensi", "ons", "/", "FO", "XN", "SO", "X", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "data_", "[_", "'", "extensi", "on", "'_", "]_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "namespace", "\"_", ":_", "\"", "http", "://", "www", ".", "fox", ".", "in", ".", "socks", "/", "api", "/", "ext", "/", "pie", "/", "v1", ".0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Fo", "x", " ", "In", " ", "Sock", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "update", "d", "\"_", ":_", "\"", "2011", "-0", "1", "-", "2", "2", "T1", "3", ":", "25", ":", "2", "7", "-0", "6", ":", "00", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ":_", "\"", "The", " ", "Fo", "x", " ", "In", " ", "Sock", "s", " ", "Ext", "ensi", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "alias", "\"_", ":_", "\"", "FO", "XN", "SO", "X", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "link", "s", "\"_", ":_", "[_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Controlle", "r", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "non", "\\u", "exist", "ing", "\\u", "extensi", "on", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "123", "/", "extensi", "ons", "/", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "404_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Controlle", "r", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "extensions\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "123", "/", "extensi", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "accept_", "=_", "\"", "applica", "tion", "/", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "response_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "=_", "etree_", "._", "XML_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "tag_", "._", "split_", "(_", "'", "extensi", "ons", "'_", ")_", "[_", "0_", "]_", ",_", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "have", " ", "all", " ", "the", " ", "extensi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "exts_", "=_", "root_", "._", "findall_", "(_", "'{", "0", "}", "extensi", "on", "'_", "._", "format_", "(_", "NS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "exts_", ")_", ",_", "len_", "(_", "self_", "._", "ext", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "at", " ", "leas", "t", " ", "Fo", "x", " ", "in", " ", "So", "x", " ", "is", " ", "correct", "._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "fox", "\\u", "ext_", ",_", ")_", "=_", "[_", "x_", "for_", "x_", "in_", "exts_", "if_", "x_", "._", "get_", "(_", "'", "alias", "'_", ")_", "==_", "'", "FO", "XN", "SO", "X", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fox", "\\u", "ext_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "'", "Fo", "x", " ", "In", " ", "Sock", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fox", "\\u", "ext_", "._", "get_", "(_", "'", "namespace", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "fox", ".", "in", ".", "socks", "/", "api", "/", "ext", "/", "pie", "/", "v1", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fox", "\\u", "ext_", "._", "get_", "(_", "'", "update", "d", "'_", ")_", ",_", "'", "2011", "-0", "1", "-", "2", "2", "T1", "3", ":", "25", ":", "2", "7", "-0", "6", ":", "00", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fox", "\\u", "ext_", "._", "findtext_", "(_", "'{", "0", "}", "description", "'_", "._", "format_", "(_", "NS_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "Fo", "x", " ", "In", " ", "Sock", "s", " ", "Ext", "ensi", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "util_", "._", "validat", "e\\u", "schema_", "(_", "root_", ",_", "'", "extensi", "ons", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Controlle", "r", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "extensi", "on", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "123", "/", "extensi", "ons", "/", "FO", "XN", "SO", "X", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "accept_", "=_", "\"", "applica", "tion", "/", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "=_", "response_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "=_", "etree_", "._", "XML_", "(_", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "tag_", "._", "split_", "(_", "'", "extensi", "on", "'_", ")_", "[_", "0_", "]_", ",_", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "get_", "(_", "'", "alias", "'_", ")_", ",_", "'", "FO", "XN", "SO", "X", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "'", "Fo", "x", " ", "In", " ", "Sock", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "get_", "(_", "'", "namespace", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "://", "www", ".", "fox", ".", "in", ".", "socks", "/", "api", "/", "ext", "/", "pie", "/", "v1", ".0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "get_", "(_", "'", "update", "d", "'_", ")_", ",_", "'", "2011", "-0", "1", "-", "2", "2", "T1", "3", ":", "25", ":", "2", "7", "-0", "6", ":", "00", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "findtext_", "(_", "'{", "0", "}", "description", "'_", "._", "format_", "(_", "NS_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "Fo", "x", " ", "In", " ", "Sock", "s", " ", "Ext", "ensi", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "util_", "._", "validat", "e\\u", "schema_", "(_", "root_", ",_", "'", "extensi", "on", "'_", ")_", "\\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_", "Reso", "urc", "e", "Ext", "ensi", "on", "Test_", "(_", "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_", "Reso", "urc", "e", "Ext", "ensi", "on", "Test_", "(_", "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 ", " _", "super_", "(_", "Reso", "urc", "e", "Ext", "ensi", "on", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\"", "extensi", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flags_", "(_", "osa", "pi", "\\u", "extensions\\u", "path_", "=_", "ext", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Ext", "ensi", "on", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "extensi", "on", "\\u", "present_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manager_", "=_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ",_", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "bla", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "404_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Ext", "ensi", "on", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "resources_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "ext_", "=_", "extensions_", "._", "Reso", "urc", "e", "Extension_", "(_", "'", "twee", "dle", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stu", "b", "Controller_", "(_", "response", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "=_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "res", "\\u", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ",_", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "123", "/", "twee", "dle", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "body_", ",_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Ext", "ensi", "on", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "resource", "s", "\\u", "with", "\\u", "controller_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "ext_", "=_", "extensions_", "._", "Reso", "urc", "e", "Extension_", "(_", "'", "twee", "dle", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stu", "b", "Controller_", "(_", "response", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "=_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "res", "\\u", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ",_", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "123", "/", "twee", "dle", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "body_", ",_", "response_", "._", "body_", ")_", "\\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_", "Inva", "lid", "Extension_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Inva", "lid", "Extension_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "alias_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "THI", "RD", "\"_", "\\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_", "Ext", "ensi", "on", "Manager", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "body_", "=_", "\"", "Tr", "y", " ", "to", " ", "say", " ", "this", " ", "Mr", ".", " ", "Kno", "x", ",", " ", "sir", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Ext", "ensi", "on", "Manager", "Test_", "(_", "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 ", " _", "super_", "(_", "Ext", "ensi", "on", "Manager", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\"", "extensi", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flags_", "(_", "osa", "pi", "\\u", "extensions\\u", "path_", "=_", "ext", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Manager", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "resources_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "123", "/", "fox", "nso", "cks", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "body_", ",_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "on", "Manager", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "extensions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mgr_", "=_", "ext", "\\u", "mid", "ware_", "._", "ext", "\\u", "mgr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mgr_", "._", "add", "\\u", "extension_", "(_", "Inva", "lid", "Extension_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "FO", "XN", "SO", "X", "'_", "in_", "ext", "\\u", "mgr_", "._", "extensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "THI", "RD", "'_", "not_", "in_", "ext", "\\u", "mgr_", "._", "extensions_", ")_", "\\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_", "Action", "Ext", "ensi", "on", "Test_", "(_", "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_", "[SEP]_", "class_", "Action", "Ext", "ensi", "on", "Test_", "(_", "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 ", " _", "super_", "(_", "Action", "Ext", "ensi", "on", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\"", "extensi", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flags_", "(_", "osa", "pi", "\\u", "extensions\\u", "path_", "=_", "ext", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action", "Ext", "ensi", "on", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "send", "\\u", "server", "\\u", "action", "\\u", "request_", "(_", "self_", ",_", "url_", ",_", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "openstack_", "._", "API", "Route", "r", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "method_", "=_", "'", "POST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "body_", "=_", "json_", "._", "dumps_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action", "Ext", "ensi", "on", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "extend", "ed", "\\u", "action_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "dict_", "(_", "add", "\\u", "twee", "dle", "_", "=_", "dict_", "(_", "name_", "=_", "\"", "test", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\"/", "123", "/", "server", "s", "/", "1", "/", "action", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "send", "\\u", "server", "\\u", "action", "\\u", "request_", "(_", "url_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Twe", "edl", "e", " ", "Bee", "tle", " ", "Added", ".\"_", ",_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "dict_", "(_", "delete", "\\u", "twee", "dle", "_", "=_", "dict_", "(_", "name_", "=_", "\"", "test", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "send", "\\u", "server", "\\u", "action", "\\u", "request_", "(_", "url_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Twe", "edl", "e", " ", "Bee", "tle", " ", "Delete", "d", ".\"_", ",_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action", "Ext", "ensi", "on", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "action", "\\u", "body_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "dict_", "(_", "bla", "h_", "=_", "dict_", "(_", "name_", "=_", "\"", "test", "\"_", ")_", ")_", "#", " ", "Do", "esn", "'", "t", " ", "exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\"/", "123", "/", "server", "s", "/", "1", "/", "action", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "send", "\\u", "server", "\\u", "action", "\\u", "request_", "(_", "url_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "400_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action", "Ext", "ensi", "on", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "action_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "dict_", "(_", "bla", "h_", "=_", "dict_", "(_", "name_", "=_", "\"", "test", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\"/", "123", "/", "fds", "a", "/", "1", "/", "action", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "send", "\\u", "server", "\\u", "action", "\\u", "request_", "(_", "url_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "404_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\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_", "Request", "Ext", "ensi", "on", "Test_", "(_", "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_", "[SEP]_", "class_", "Request", "Ext", "ensi", "on", "Test_", "(_", "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 ", " _", "super_", "(_", "Request", "Ext", "ensi", "on", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\"", "extensi", "ons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flags_", "(_", "osa", "pi", "\\u", "extensions\\u", "path_", "=_", "ext", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Ext", "ensi", "on", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "resource", "s", "\\u", "with", "\\u", "stub", "\\u", "mgr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "req", "\\u", "handler_", "(_", "req_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "handle", " ", "JSO", "N", " ", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "json_", "._", "loads_", "(_", "res_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "flavor", "'_", "]_", "[_", "'", "goog", "oos", "e", "'_", "]_", "=_", "req_", "._", "GET_", "._", "get_", "(_", "'", "che", "wing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "body_", "=_", "json_", "._", "dumps_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req", "\\u", "ext_", "=_", "extensions_", "._", "Request", "Extension_", "(_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "v1", ".1", "/", "123", "/", "flavor", "s", "/", ":(", "id", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "req", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "=_", "Stu", "b", "Ext", "ensi", "on", "Manager_", "(_", "None_", ",_", "None_", ",_", "req", "\\u", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "fakes_", "._", "wsgi", "\\u", "app_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ",_", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "v1", ".1", "/", "123", "/", "flavor", "s", "/", "1", "?", "che", "wing", "=", "blue", "goo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "environ_", "[_", "'", "api", ".", "version", "'_", "]_", "=_", "'", "1.1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "data_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "blue", "goo", "'_", ",_", "response", "\\u", "data_", "[_", "'", "flavor", "'_", "]_", "[_", "'", "goog", "oos", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Ext", "ensi", "on", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "resource", "s", "\\u", "with", "\\u", "mgr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "fakes_", "._", "wsgi", "\\u", "app_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "mid", "ware_", "=_", "extensions_", "._", "Ext", "ensi", "on", "Middleware_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/", "v1", ".1", "/", "123", "/", "flavor", "s", "/", "1", "?", "che", "wing", "=", "newb", "lue", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "environ_", "[_", "'", "api", ".", "version", "'_", "]_", "=_", "'", "1.1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "ext", "\\u", "mid", "ware_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "data_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "newb", "lue", "'_", ",_", "response", "\\u", "data_", "[_", "'", "flavor", "'_", "]_", "[_", "'", "goog", "oos", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Pi", "g", " ", "Band", "s", "!\"_", ",_", "response", "\\u", "data_", "[_", "'", "big", "\\u", "band", "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_", "class_", "Ext", "ensi", "ons", "XML", "Seriali", "zer", "Test_", "(_", "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_", "[SEP]_", "class_", "Ext", "ensi", "ons", "XML", "Seriali", "zer", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "serialize", "\\u", "ext", "ens", "tion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serializer_", "=_", "extensions_", "._", "Ext", "ensi", "ons", "XML", "Serializer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "'", "extensi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "ext", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "namespace", "'_", ":_", "'", "http", "://", "docs", ".", "rack", ".", "com", "/", "server", "s", "/", "api", "/", "ext", "/", "pie", "/", "v1", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alias", "'_", ":_", "'", "RS", "-", "PIE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "'", "2011", "-0", "1", "-", "2", "2", "T1", "3", ":", "25", ":", "2", "7", "-0", "6", ":", "00", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "Add", "s", " ", "the", " ", "capab", "ilit", "y", " ", "to", " ", "share", " ", "an", " ", "image", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "s", "'_", ":_", "[_", "{_", "'", "rel", "'_", ":_", "'", "descri", "bed", "by", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "applica", "tion", "/", "pdf", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "href", "'_", ":_", "'", "http", "://", "docs", ".", "rack", ".", "com", "/", "server", "s", "/", "api", "/", "ext", "/", "cs", ".", "pdf", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "rel", "'_", ":_", "'", "descri", "bed", "by", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "applica", "tion", "/", "vn", "d", ".", "sun", ".", "wad", "l", "+", "xml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "href", "'_", ":_", "'", "http", "://", "docs", ".", "rack", ".", "com", "/", "server", "s", "/", "api", "/", "ext", "/", "cs", ".", "wad", "l", "'_", "}_", "]_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "=_", "serializer_", "._", "serialize_", "(_", "data_", ",_", "'", "show", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "etree_", "._", "XML_", "(_", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "dict_", "=_", "data_", "[_", "'", "extensi", "on", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "findtext_", "(_", "'{", "0", "}", "description", "'_", "._", "format_", "(_", "NS_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ext", "\\u", "dict_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "[_", "'", "name", "'_", ",_", "'", "namespace", "'_", ",_", "'", "alias", "'_", ",_", "'", "update", "d", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "get_", "(_", "key_", ")_", ",_", "ext", "\\u", "dict_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "\\u", "nodes_", "=_", "root_", "._", "findall_", "(_", "'{", "0", "}", "link", "'_", "._", "format_", "(_", "ATOM", "NS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "link", "\\u", "nodes_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "link_", "in_", "enumerate_", "(_", "ext", "\\u", "dict_", "[_", "'", "link", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "link_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "link", "\\u", "nodes_", "[_", "i_", "]_", "._", "get_", "(_", "key_", ")_", ",_", "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_", "xml", "util_", "._", "validat", "e\\u", "schema_", "(_", "root_", ",_", "'", "extensi", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "ons", "XML", "Seriali", "zer", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "serialize", "\\u", "extensions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serializer_", "=_", "extensions_", "._", "Ext", "ensi", "ons", "XML", "Serializer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "\"", "extensi", "ons", "\"_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Public", " ", "Image", " ", "Ext", "ensi", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "namespace", "\"_", ":_", "\"", "http", "://", "foo", ".", "com", "/", "api", "/", "ext", "/", "pie", "/", "v1", ".0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "alias", "\"_", ":_", "\"", "RS", "-", "PIE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "update", "d", "\"_", ":_", "\"", "2011", "-0", "1", "-", "2", "2", "T1", "3", ":", "25", ":", "2", "7", "-0", "6", ":", "00", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ":_", "\"", "Add", "s", " ", "the", " ", "capab", "ilit", "y", " ", "to", " ", "share", " ", "an", " ", "image", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "link", "s", "\"_", ":_", "[_", "{_", "\"", "rel", "\"_", ":_", "\"", "descri", "bed", "by", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "applica", "tion", "/", "pdf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "applica", "tion", "/", "vn", "d", ".", "sun", ".", "wad", "l", "+", "xml", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "href", "\"_", ":_", "\"", "http", "://", "foo", ".", "com", "/", "api", "/", "ext", "/", "cs", "-", "pie", ".", "pdf", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "rel", "\"_", ":_", "\"", "descri", "bed", "by", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "applica", "tion", "/", "vn", "d", ".", "sun", ".", "wad", "l", "+", "xml", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "href", "\"_", ":_", "\"", "http", "://", "foo", ".", "com", "/", "api", "/", "ext", "/", "cs", "-", "pie", ".", "wad", "l", "\"_", "}_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "name", "\"_", ":_", "\"", "Cloud", " ", "Block", " ", "Stor", "age", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "namespace", "\"_", ":_", "\"", "http", "://", "foo", ".", "com", "/", "api", "/", "ext", "/", "cbs", "/", "v1", ".0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "alias", "\"_", ":_", "\"", "RS", "-", "CB", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "update", "d", "\"_", ":_", "\"", "2011", "-0", "1", "-1", "2", "T1", "1", ":", "2", "2", ":", "3", "3", "-0", "6", ":", "00", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "description", "\"_", ":_", "\"", "All", "ow", "s", " ", "mount", "ing", " ", "cloud", " ", "block", " ", "storage", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "link", "s", "\"_", ":_", "[_", "{_", "\"", "rel", "\"_", ":_", "\"", "descri", "bed", "by", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "applica", "tion", "/", "pdf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "href", "\"_", ":_", "\"", "http", "://", "foo", ".", "com", "/", "api", "/", "ext", "/", "cs", "-", "cbs", ".", "pdf", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "rel", "\"_", ":_", "\"", "descri", "bed", "by", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "applica", "tion", "/", "vn", "d", ".", "sun", ".", "wad", "l", "+", "xml", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "href", "\"_", ":_", "\"", "http", "://", "foo", ".", "com", "/", "api", "/", "ext", "/", "cs", "-", "cbs", ".", "wad", "l", "\"_", "}_", "]_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "=_", "serializer_", "._", "serialize_", "(_", "data_", ",_", "'", "index", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "etree_", "._", "XML_", "(_", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "\\u", "elems_", "=_", "root_", "._", "findall_", "(_", "'{", "0", "}", "extensi", "on", "'_", "._", "format_", "(_", "NS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ext", "\\u", "elems_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "ext", "\\u", "elem_", "in_", "enumerate_", "(_", "ext", "\\u", "elems_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ext", "\\u", "dict_", "=_", "data_", "[_", "'", "extensi", "ons", "'_", "]_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ext", "\\u", "elem_", "._", "findtext_", "(_", "'{", "0", "}", "description", "'_", "._", "format_", "(_", "NS_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ext", "\\u", "dict_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "[_", "'", "name", "'_", ",_", "'", "namespace", "'_", ",_", "'", "alias", "'_", ",_", "'", "update", "d", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "ext", "\\u", "elem_", "._", "get_", "(_", "key_", ")_", ",_", "ext", "\\u", "dict_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "\\u", "nodes_", "=_", "ext", "\\u", "elem_", "._", "findall_", "(_", "'{", "0", "}", "link", "'_", "._", "format_", "(_", "ATOM", "NS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "link", "\\u", "nodes_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "link_", "in_", "enumerate_", "(_", "ext", "\\u", "dict_", "[_", "'", "link", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "link_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "Equal_", "(_", "link", "\\u", "nodes_", "[_", "i_", "]_", "._", "get_", "(_", "key_", ")_", ",_", "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_", "xml", "util_", "._", "validat", "e\\u", "schema_", "(_", "root_", ",_", "'", "extensi", "ons", "'_", ")_" ]
[ 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, 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from django.shortcuts import render\nfrom django.core import serializers\nfrom django.http import HttpResponse\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth import authenticate, login, logout\nfrom django.contrib.auth.decorators import login_required\nfrom django.conf import settings\nfrom registrar.models import Course\nfrom registrar.models import Student\nfrom registrar.models import Assignment\nfrom registrar.models import AssignmentSubmission\nfrom registrar.models import EssayQuestion\nfrom registrar.models import EssaySubmission\nfrom registrar.models import MultipleChoiceQuestion\nfrom registrar.models import MultipleChoiceSubmission\nfrom registrar.models import ResponseQuestion\nfrom registrar.models import ResponseSubmission\nfrom registrar.models import TrueFalseQuestion\nfrom registrar.models import TrueFalseSubmission\nimport json\nimport datetime\n\n# Forms\nfrom student.forms import EssaySubmissionForm\nfrom student.forms import AssignmentSubmissionForm\n\n\n# Private Functions\n\n\n\n# Public Functions\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#-------------------#\n# Private Functions #\n#-------------------#\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_submitted_assignments(course, student):\n # Fetch all the assignments for this course.\n try:\n assignments = Assignment.objects.filter(course=course).order_by('assignment_num')\n except Assignment.DoesNotExist:\n assignment = None\n \n # Fetch all submitted assignments\n try:\n submitted_assignments = AssignmentSubmission.objects.filter(\n assignment__course=course,\n student=student\n )\n except AssignmentSubmission.DoesNotExist:\n submitted_assignments = None\n\n # If the submissions & assignment counts do not equal, then we have to\n # iterate through all the assignments and create the missing 'submission'\n # entries for our system.\n if len(assignments) != len(submitted_assignments):\n for assignment in assignments:\n found_assignment = False\n for submitted_assignment in submitted_assignments:\n if assignment.assignment_id == submitted_assignment.assignment_id:\n found_assignment = True\n if not found_assignment:\n submission = AssignmentSubmission.objects.create(\n student=student,\n assignment=assignment,\n )\n submission.save()\n # Once we saved the data, we will have to fetch the results again.\n submitted_assignments = AssignmentSubmission.objects.filter(\n assignment__course=course,\n student=student\n )\n return submitted_assignments", "metadata": "root.get_submitted_assignments", "header": "['module', '___EOS___']", "index": 29 }, { "content": "@login_required(login_url='/landpage')\ndef assignments_page(request, course_id):\n course = Course.objects.get(id=course_id)\n student = Student.objects.get(user=request.user)\n return render(request, 'course/assignment/assignments_view.html',{\n 'course' : course,\n 'submitted_assignments': get_submitted_assignments(course, student),\n 'user' : request.user,\n 'tab' : 'assignments',\n 'subtab' : '',\n 'HAS_ADVERTISMENT': settings.APPLICATION_HAS_ADVERTISMENT,\n 'local_css_urls' : settings.SB_ADMIN_2_CSS_LIBRARY_URLS,\n 'local_js_urls' : settings.SB_ADMIN_2_JS_LIBRARY_URLS,\n })", "metadata": "root.assignments_page", "header": "['module', '___EOS___']", "index": 71 }, { "content": "@login_required(login_url='/landpage')\ndef assignments_table(request, course_id):\n course = Course.objects.get(id=course_id)\n student = Student.objects.get(user=request.user)\n return render(request, 'course/assignment/assignments_table.html',{\n 'course' : course,\n 'user' : request.user,\n 'submitted_assignments': get_submitted_assignments(course, student),\n 'ESSAY_QUESTION_TYPE' : settings.ESSAY_QUESTION_TYPE,\n 'MULTIPLECHOICE_QUESTION_TYPE' : settings.MULTIPLECHOICE_QUESTION_TYPE,\n 'TRUEFALSE_QUESTION_TYPE' : settings.TRUEFALSE_QUESTION_TYPE,\n 'RESPONSE_QUESTION_TYPE' : settings.RESPONSE_QUESTION_TYPE,\n })", "metadata": "root.assignments_table", "header": "['module', '___EOS___']", "index": 87 }, { "content": "@login_required(login_url='/landpage')\ndef assignment_page(request, course_id, assignment_id):\n course = Course.objects.get(id=course_id)\n student = Student.objects.get(user=request.user)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n \n # Load all essay type questions for this assignment.\n try:\n e_questions = EssayQuestion.objects.filter(assignment=assignment).order_by('question_num')\n except EssayQuestion.DoesNotExist:\n e_questions = None\n try:\n e_submissions = EssaySubmission.objects.filter(question__assignment=assignment, student=student)\n except EssayQuestion.DoesNotExist:\n e_submissions = None\n\n # Load all multiple-choice type questions/submissions for this assignment.\n try:\n mc_questions = MultipleChoiceQuestion.objects.filter(assignment=assignment).order_by('question_num')\n except MultipleChoiceQuestion.DoesNotExist:\n mc_questions = None\n try:\n mc_submissions = MultipleChoiceSubmission.objects.filter(question__assignment=assignment, student=student)\n except MultipleChoiceSubmission.DoesNotExist:\n mc_submissions = None\n\n # Load all true/false type questions/submissions for this assignment.\n try:\n tf_questions = TrueFalseQuestion.objects.filter(assignment=assignment).order_by('question_num')\n except TrueFalseQuestion.DoesNotExist:\n tf_questions = None\n try:\n tf_submissions = TrueFalseSubmission.objects.filter(question__assignment=assignment, student=student)\n except tf_submissions.DoesNotExist:\n tf_submissions = None\n\n # Load all response type questions for this assignment.\n try:\n r_questions = ResponseQuestion.objects.filter(assignment=assignment).order_by('question_num')\n except ResponseQuestion.DoesNotExist:\n r_questions = None\n try:\n r_submissions = ResponseSubmission.objects.filter(question__assignment=assignment, student=student)\n except ResponseQuestion.DoesNotExist:\n r_submissions = None\n\n return render(request, 'course/assignment/question_view.html',{\n 'student': student,\n 'course': course,\n 'assignment': assignment,\n 'e_questions': e_questions,\n 'e_submissions': e_submissions,\n 'mc_questions': mc_questions,\n 'mc_submissions': mc_submissions,\n 'tf_questions': tf_questions,\n 'tf_submissions': tf_submissions,\n 'r_questions': r_questions,\n 'r_submissions': r_submissions,\n 'ESSAY_QUESTION_TYPE': settings.ESSAY_QUESTION_TYPE,\n 'MULTIPLECHOICE_QUESTION_TYPE': settings.MULTIPLECHOICE_QUESTION_TYPE,\n 'TRUEFALSE_QUESTION_TYPE': settings.TRUEFALSE_QUESTION_TYPE,\n 'RESPONSE_QUESTION_TYPE': settings.RESPONSE_QUESTION_TYPE,\n 'user': request.user,\n 'tab': 'assignment',\n 'HAS_ADVERTISMENT': settings.APPLICATION_HAS_ADVERTISMENT,\n 'local_css_urls': settings.SB_ADMIN_2_CSS_LIBRARY_URLS,\n 'local_js_urls': settings.SB_ADMIN_2_JS_LIBRARY_URLS,\n })", "metadata": "root.assignment_page", "header": "['module', '___EOS___']", "index": 102 }, { "content": "@login_required()\ndef delete_assignment(request, course_id):\n response_data = {'status' : 'failed', 'message' : 'unknown error with deletion'}\n if request.is_ajax():\n if request.method == 'POST':\n assignment_id = int(request.POST['assignment_id'])\n course = Course.objects.get(id=course_id)\n student = Student.objects.get(user=request.user)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n\n # Set 'is_finished' to false to indicate we need to take the\n # assignment all over.\n try:\n submission = AssignmentSubmission.objects.get(\n student=student,\n assignment=assignment,\n )\n submission.is_finished = False\n submission.save()\n except AssignmentSubmission.DoesNotExist:\n return HttpResponse(json.dumps({\n 'status' : 'failed',\n 'message' : 'record does not exist'\n }), content_type=\"application/json\")\n\n # Delete all previous entries.\n try:\n e_submissions = EssaySubmission.objects.filter(question__assignment=assignment, student=student)\n e_submissions.delete()\n except EssayQuestion.DoesNotExist:\n pass\n try:\n mc_submissions = MultipleChoiceSubmission.objects.filter(question__assignment=assignment, student=student)\n mc_submissions.delete()\n except MultipleChoiceSubmission.DoesNotExist:\n pass\n try:\n tf_submissions = TrueFalseSubmission.objects.filter(question__assignment=assignment, student=student)\n tf_submissions.delete()\n except tf_submissions.DoesNotExist:\n pass\n try:\n r_submissions = ResponseSubmission.objects.filter(question__assignment=assignment, student=student)\n r_submissions.delete()\n except ResponseQuestion.DoesNotExist:\n pass\n\n response_data = {'status' : 'success', 'message' : 'assignment was deleted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.delete_assignment", "header": "['module', '___EOS___']", "index": 173 }, { "content": "@login_required()\ndef submit_e_assignment_answer(request, course_id, assignment_id):\n response_data = {'status' : 'failed', 'message' : 'error submitting'}\n if request.is_ajax():\n if request.method == 'POST':\n # Extract parameters from post\n question_id = int(request.POST['question_id'])\n try:\n file = request.FILES[\"file\"]\n except:\n response_data = {'status' : 'failed', 'message' : 'missing file'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n \n # Fetch from database\n course = Course.objects.get(id=course_id)\n student = Student.objects.get(user=request.user)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n\n # Fetch question and error if not found.\n try:\n question = EssayQuestion.objects.get(\n assignment=assignment,\n question_id=question_id,\n )\n except MultipleChoiceQuestion.DoesNotExist:\n response_data = {'status' : 'failed', 'message' : 'cannot find question'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n\n try:\n submission = EssaySubmission.objects.get(\n student=student,\n question=question,\n )\n except EssaySubmission.DoesNotExist:\n submission = EssaySubmission.objects.create(\n student=student,\n question=question,\n )\n submission.file = file\n submission.save()\n response_data = {'status' : 'success', 'message' : 'submitted'}\n\n# form = EssaySubmissionForm(instance=submission, files=request.FILES)\n# if form.is_valid():\n# form.save() # Save the form contents to the model\n# response_data = {'status' : 'success', 'message' : 'submitted'}\n# else:\n# response_data = {'status' : 'failed', 'message' : json.dumps(form.errors)}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_e_assignment_answer", "header": "['module', '___EOS___']", "index": 224 }, { "content": "@login_required()\ndef submit_mc_assignment_answer(request, course_id, assignment_id):\n if request.is_ajax():\n if request.method == 'POST':\n # Extract parameters from post\n question_id = int(request.POST['question_id'])\n answer = request.POST['answer']\n \n # Fetch from database\n course = Course.objects.get(id=course_id)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n student = Student.objects.get(user=request.user)\n \n # Fetch question and error if not found.\n try:\n question = MultipleChoiceQuestion.objects.get(\n assignment=assignment,\n question_id=question_id,\n )\n except MultipleChoiceQuestion.DoesNotExist:\n response_data = {'status' : 'failed', 'message' : 'cannot find question'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n\n # Fetch submission and create new submission if not found.\n try:\n submission = MultipleChoiceSubmission.objects.get(\n student=student,\n question=question,\n )\n except MultipleChoiceSubmission.DoesNotExist:\n submission = MultipleChoiceSubmission.objects.create(\n student=student,\n question=question,\n )\n\n # Save answer\n if answer == 'A':\n submission.a = not submission.a\n if answer == 'B':\n submission.b = not submission.b\n if answer == 'C':\n submission.c = not submission.c\n if answer == 'D':\n submission.d = not submission.d\n if answer == 'E':\n submission.e = not submission.e\n if answer == 'F':\n submission.f = not submission.f\n submission.save()\n \n # Caclulate score\n total = 6\n correct = 0\n if submission.a == submission.question.a_is_correct:\n correct += 1;\n if submission.b == submission.question.b_is_correct:\n correct += 1;\n if submission.c == submission.question.c_is_correct:\n correct += 1;\n if submission.d == submission.question.d_is_correct:\n correct += 1;\n if submission.e == submission.question.e_is_correct:\n correct += 1;\n if submission.f == submission.question.f_is_correct:\n correct += 1;\n\n # If all choices have been correctly selected, then give full credit.\n if total == correct:\n submission.marks = submission.question.marks\n else:\n submission.marks = 0\n submission.save()\n \n # Return success results\n response_data = {'status' : 'success', 'message' : 'submitted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n\n response_data = {'status' : 'failed', 'message' : 'error submitting'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_mc_assignment_answer", "header": "['module', '___EOS___']", "index": 275 }, { "content": "@login_required()\ndef submit_tf_assignment_answer(request, course_id, assignment_id):\n if request.is_ajax():\n if request.method == 'POST':\n # Extract parameters from post\n question_id = int(request.POST['question_id'])\n answer = request.POST['answer']\n \n # Fetch from database\n course = Course.objects.get(id=course_id)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n student = Student.objects.get(user=request.user)\n\n # Fetch question and error if not found.\n try:\n question = TrueFalseQuestion.objects.get(\n assignment=assignment,\n question_id=question_id,\n )\n except MultipleChoiceQuestion.DoesNotExist:\n response_data = {'status' : 'failed', 'message' : 'cannot find question'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n\n # Fetch submission and create new submission if not found.\n try:\n submission = TrueFalseSubmission.objects.get(\n student=student,\n question_id=question_id,\n )\n except TrueFalseSubmission.DoesNotExist:\n submission = TrueFalseSubmission.objects.create(\n student=student,\n question_id=question_id,\n )\n\n # Process the answer\n submission.answer = answer == \"true\"\n submission.save()\n \n # Calculate the marks\n if submission.answer == submission.question.answer:\n submission.marks = submission.question.marks\n else:\n submission.marks = 0\n submission.save()\n\n response_data = {'status' : 'success', 'message' : 'submitted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_tf_assignment_answer", "header": "['module', '___EOS___']", "index": 356 }, { "content": "@login_required()\ndef submit_r_assignment_answer(request, course_id, assignment_id):\n if request.is_ajax():\n if request.method == 'POST':\n # Extract parameters from post\n question_id = int(request.POST['question_id'])\n answer = request.POST['answer']\n \n # Fetch from database\n course = Course.objects.get(id=course_id)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n student = Student.objects.get(user=request.user)\n \n # Fetch question and error if not found.\n try:\n question = ResponseQuestion.objects.get(\n assignment=assignment,\n question_id=question_id,\n )\n except ResponseQuestion.DoesNotExist:\n response_data = {'status' : 'failed', 'message' : 'cannot find question'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")\n \n # Fetch submission and create new submission if not found.\n try:\n submission = ResponseSubmission.objects.get(\n student=student,\n question_id=question_id,\n )\n except ResponseSubmission.DoesNotExist:\n submission = ResponseSubmission.objects.create(\n student=student,\n question_id=question_id,\n )\n \n # Process the answer\n # Return success results\n submission.answer = answer\n submission.save()\n \n response_data = {'status' : 'success', 'message' : 'submitted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_r_assignment_answer", "header": "['module', '___EOS___']", "index": 406 }, { "content": "@login_required()\ndef submit_assignment(request, course_id, assignment_id):\n if request.is_ajax():\n if request.method == 'POST':\n # Fetch from database\n course = Course.objects.get(id=course_id)\n assignment = Assignment.objects.get(assignment_id=assignment_id)\n student = Student.objects.get(user=request.user)\n\n # Defensive Code: Prevent submitting assignment with missing questions\n #TODO: IMPL\n\n # Fetch submission and create new submission if not found.\n try:\n submission = AssignmentSubmission.objects.get(\n student=student,\n assignment=assignment,\n )\n except AssignmentSubmission.DoesNotExist:\n submission = AssignmentSubmission.objects.create(\n student=student,\n assignment=assignment,\n )\n submission.is_finished = True\n submission.save()\n \n # Compute the final score of the assignment\n compute_score(student, assignment, submission)\n \n response_data = {'status' : 'success', 'message' : 'submitted'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.submit_assignment", "header": "['module', '___EOS___']", "index": 450 }, { "content": "def compute_score(student, assignment, submission):\n submission.total_marks = 0\n submission.earned_marks = 0\n\n # Essay Submission(s)\n e_submissions = EssaySubmission.objects.filter(\n student=student,\n question__assignment=assignment,\n )\n for e_submission in e_submissions:\n submission.total_marks += e_submission.question.marks\n submission.earned_marks += e_submission.marks\n\n # Multiple Choice Submission(s)\n mc_submissions = MultipleChoiceSubmission.objects.filter(\n student=student,\n question__assignment=assignment,\n )\n for mc_submission in mc_submissions:\n submission.total_marks += mc_submission.question.marks\n submission.earned_marks += mc_submission.marks\n\n # True / False Submission(s)\n tf_submissions = TrueFalseSubmission.objects.filter(\n student=student,\n question__assignment=assignment,\n )\n for tf_submission in tf_submissions:\n submission.total_marks += tf_submission.question.marks\n submission.earned_marks += tf_submission.marks\n\n # Response Submission(s)\n r_submissions = ResponseSubmission.objects.filter(\n student=student,\n question__assignment=assignment,\n )\n for r_submission in r_submissions:\n submission.total_marks += r_submission.question.marks\n submission.earned_marks += r_submission.marks\n\n # Compute Percent\n try:\n submission.percent = round((submission.earned_marks / submission.total_marks) * 100)\n except ZeroDivisionError:\n submission.percent = 0\n\n # Save calculation\n submission.save()", "metadata": "root.compute_score", "header": "['module', '___EOS___']", "index": 487 } ]
[ { "span": "from django.core import serializers", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 35 }, { "span": "from django.contrib.auth.models import User", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 43 }, { "span": "from django.contrib.auth import authenticate, login, logout", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 59 }, { "span": "import datetime", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 15 }, { "span": "from student.forms import EssaySubmissionForm", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 45 }, { "span": "from student.forms import AssignmentSubmissionForm", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "serializers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "import_", "authenticate_", ",_", "login_", ",_", "logout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Course_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Student_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Assignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Assign", "ment", "Submission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Ess", "ay", "Question_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Ess", "ay", "Submission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Multipl", "e", "Choi", "ce", "Question_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Multipl", "e", "Choi", "ce", "Submission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Respons", "e", "Question_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Respons", "e", "Submission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Tru", "e", "Fal", "se", "Question_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Tru", "e", "Fal", "se", "Submission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Forms_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "student_", "._", "forms_", "import_", "Ess", "ay", "Subm", "ission", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "student_", "._", "forms_", "import_", "Assign", "ment", "Subm", "ission", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Priva", "te", " ", "Functions_", "\\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_", "#", " ", "Public", " ", "Functions_", "\\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\\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\\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\\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_", "#", " ", "Priva", "te", " ", "Function", "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", "submitted", "\\u", "assignments_", "(_", "course_", ",_", "student_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "all", " ", "the", " ", "assign", "ment", "s", " ", "for", " ", "this", " ", "course", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assignments_", "=_", "Assignment_", "._", "objects_", "._", "filter_", "(_", "course_", "=_", "course_", ")_", "._", "order", "\\u", "by_", "(_", "'", "assign", "ment", "\\u", "num", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assignment_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assignment_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "all", " ", "submitted", " ", "assignments_", "\\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 ", " _", "submitted", "\\u", "assignments_", "=_", "Assign", "ment", "Submission_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assign", "ment", "\\u\\u", "course_", "=_", "course_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assign", "ment", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submitted", "\\u", "assignments_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "subm", "ission", "s", " ", "&", " ", "assign", "ment", " ", "count", "s", " ", "do", " ", "not", " ", "equal", ",", " ", "then", " ", "we", " ", "have", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "iterate", " ", "through", " ", "all", " ", "the", " ", "assign", "ment", "s", " ", "and", " ", "create", " ", "the", " ", "missi", "ng", " ", "'", "subm", "ission", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "entri", "es", " ", "for", " ", "our", " ", "system", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "assignments_", ")_", "!=_", "len_", "(_", "submitted", "\\u", "assignments_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "assignment_", "in_", "assignments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "\\u", "assignment_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "submitted", "\\u", "assignment_", "in_", "submitted", "\\u", "assignments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "assignment_", "._", "assign", "ment", "\\u", "id_", "==_", "submitted", "\\u", "assignment_", "._", "assign", "ment", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "found", "\\u", "assignment_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found", "\\u", "assignment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Assign", "ment", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ce", " ", "we", " ", "saved", " ", "the", " ", "data", ",", " ", "we", " ", "will", " ", "have", " ", "to", " ", "fetch", " ", "the", " ", "results", " ", "again", "._", "\\u\\u\\uNL\\u\\u\\u_", "submitted", "\\u", "assignments_", "=_", "Assign", "ment", "Submission_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assign", "ment", "\\u\\u", "course_", "=_", "course_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\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_", "submitted", "\\u", "assignments_", "\\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_", "(_", "login", "\\u", "url_", "=_", "'/", "land", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "assign", "ment", "s", "\\u", "page_", "(_", "request_", ",_", "course", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "course", "/", "assign", "ment", "/", "assign", "ment", "s", "\\u", "view", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "course", "'_", ":_", "course_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "submitted", "\\u", "assign", "ment", "s", "'_", ":_", "get", "\\u", "submitted", "\\u", "assignments_", "(_", "course_", ",_", "student_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tab", "'_", ":_", "'", "assign", "ment", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subta", "b", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HAS", "\\u", "ADV", "ERT", "IS", "MENT", "'_", ":_", "settings_", "._", "APPLICATION", "\\u", "HAS", "\\u", "ADV", "ERT", "IS", "MENT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "css", "\\u", "urls", "'_", ":_", "settings_", "._", "SB", "\\u", "ADM", "IN", "\\u", "2", "\\u", "CS", "S", "\\u", "LIBRARY", "\\u", "URLS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "js", "\\u", "urls", "'_", ":_", "settings_", "._", "SB", "\\u", "ADM", "IN", "\\u", "2", "\\u", "JS", "\\u", "LIBRARY", "\\u", "URLS_", ",_", "\\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_", "@_", "login", "\\u", "required_", "(_", "login", "\\u", "url_", "=_", "'/", "land", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "assign", "ment", "s", "\\u", "table_", "(_", "request_", ",_", "course", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "course", "/", "assign", "ment", "/", "assign", "ment", "s", "\\u", "table", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "course", "'_", ":_", "course_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "submitted", "\\u", "assign", "ment", "s", "'_", ":_", "get", "\\u", "submitted", "\\u", "assignments_", "(_", "course_", ",_", "student_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ESS", "AY", "\\u", "QUESTION", "\\u", "TYPE", "'_", ":_", "settings_", "._", "ESS", "AY", "\\u", "QUESTION", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MULTIPLE", "CHOICE", "\\u", "QUESTION", "\\u", "TYPE", "'_", ":_", "settings_", "._", "MULTIPLE", "CHOICE", "\\u", "QUESTION", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TRU", "EF", "ALS", "E", "\\u", "QUESTION", "\\u", "TYPE", "'_", ":_", "settings_", "._", "TRU", "EF", "ALS", "E", "\\u", "QUESTION", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "RESPONSE", "\\u", "QUESTION", "\\u", "TYPE", "'_", ":_", "settings_", "._", "RESPONSE", "\\u", "QUESTION", "\\u", "TYPE_", ",_", "\\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_", "@_", "login", "\\u", "required_", "(_", "login", "\\u", "url_", "=_", "'/", "land", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "assign", "ment", "\\u", "page_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "all", " ", "essa", "y", " ", "type", " ", "question", "s", " ", "for", " ", "this", " ", "assign", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e\\u", "questions_", "=_", "Ess", "ay", "Question_", "._", "objects_", "._", "filter_", "(_", "assignment_", "=_", "assignment_", ")_", "._", "order", "\\u", "by_", "(_", "'", "question", "\\u", "num", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ess", "ay", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e\\u", "questions_", "=_", "None_", "\\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 ", " _", "e\\u", "submissions_", "=_", "Ess", "ay", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ess", "ay", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e\\u", "submissions_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "all", " ", "multiple", "-", "choice", " ", "type", " ", "question", "s", "/", "subm", "ission", "s", " ", "for", " ", "this", " ", "assign", "ment", "._", "\\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 ", " _", "mc", "\\u", "questions_", "=_", "Multipl", "e", "Choi", "ce", "Question_", "._", "objects_", "._", "filter_", "(_", "assignment_", "=_", "assignment_", ")_", "._", "order", "\\u", "by_", "(_", "'", "question", "\\u", "num", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mc", "\\u", "questions_", "=_", "None_", "\\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 ", " _", "mc", "\\u", "submissions_", "=_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mc", "\\u", "submissions_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "all", " ", "true", "/", "fal", "se", " ", "type", " ", "question", "s", "/", "subm", "ission", "s", " ", "for", " ", "this", " ", "assign", "ment", "._", "\\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 ", " _", "tf", "\\u", "questions_", "=_", "Tru", "e", "Fal", "se", "Question_", "._", "objects_", "._", "filter_", "(_", "assignment_", "=_", "assignment_", ")_", "._", "order", "\\u", "by_", "(_", "'", "question", "\\u", "num", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tru", "e", "Fal", "se", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tf", "\\u", "questions_", "=_", "None_", "\\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 ", " _", "tf", "\\u", "submissions_", "=_", "Tru", "e", "Fal", "se", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "tf", "\\u", "submissions_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tf", "\\u", "submissions_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "all", " ", "response", " ", "type", " ", "question", "s", " ", "for", " ", "this", " ", "assign", "ment", "._", "\\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 ", " _", "r", "\\u", "questions_", "=_", "Respons", "e", "Question_", "._", "objects_", "._", "filter_", "(_", "assignment_", "=_", "assignment_", ")_", "._", "order", "\\u", "by_", "(_", "'", "question", "\\u", "num", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Respons", "e", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "questions_", "=_", "None_", "\\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 ", " _", "r", "\\u", "submissions_", "=_", "Respons", "e", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Respons", "e", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "submissions_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "course", "/", "assign", "ment", "/", "question", "\\u", "view", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "student", "'_", ":_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "course", "'_", ":_", "course_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "assign", "ment", "'_", ":_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "e\\u", "question", "s", "'_", ":_", "e\\u", "questions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "e\\u", "subm", "ission", "s", "'_", ":_", "e\\u", "submissions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mc", "\\u", "question", "s", "'_", ":_", "mc", "\\u", "questions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mc", "\\u", "subm", "ission", "s", "'_", ":_", "mc", "\\u", "submissions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tf", "\\u", "question", "s", "'_", ":_", "tf", "\\u", "questions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tf", "\\u", "subm", "ission", "s", "'_", ":_", "tf", "\\u", "submissions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "r", "\\u", "question", "s", "'_", ":_", "r", "\\u", "questions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "r", "\\u", "subm", "ission", "s", "'_", ":_", "r", "\\u", "submissions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ESS", "AY", "\\u", "QUESTION", "\\u", "TYPE", "'_", ":_", "settings_", "._", "ESS", "AY", "\\u", "QUESTION", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MULTIPLE", "CHOICE", "\\u", "QUESTION", "\\u", "TYPE", "'_", ":_", "settings_", "._", "MULTIPLE", "CHOICE", "\\u", "QUESTION", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TRU", "EF", "ALS", "E", "\\u", "QUESTION", "\\u", "TYPE", "'_", ":_", "settings_", "._", "TRU", "EF", "ALS", "E", "\\u", "QUESTION", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "RESPONSE", "\\u", "QUESTION", "\\u", "TYPE", "'_", ":_", "settings_", "._", "RESPONSE", "\\u", "QUESTION", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tab", "'_", ":_", "'", "assign", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HAS", "\\u", "ADV", "ERT", "IS", "MENT", "'_", ":_", "settings_", "._", "APPLICATION", "\\u", "HAS", "\\u", "ADV", "ERT", "IS", "MENT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "css", "\\u", "urls", "'_", ":_", "settings_", "._", "SB", "\\u", "ADM", "IN", "\\u", "2", "\\u", "CS", "S", "\\u", "LIBRARY", "\\u", "URLS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "js", "\\u", "urls", "'_", ":_", "settings_", "._", "SB", "\\u", "ADM", "IN", "\\u", "2", "\\u", "JS", "\\u", "LIBRARY", "\\u", "URLS_", ",_", "\\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_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "assignment_", "(_", "request_", ",_", "course", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "unknown", " ", "error", " ", "with", " ", "deletion", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\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 ", " _", "assign", "ment", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "assign", "ment", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "'", "is", "\\u", "finish", "ed", "'", " ", "to", " ", "fal", "se", " ", "to", " ", "indicat", "e", " ", "we", " ", "need", " ", "to", " ", "take", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assign", "ment", " ", "all", " ", "over", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Assign", "ment", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "is", "\\u", "finished_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assign", "ment", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "'", "record", " ", "doe", "s", " ", "not", " ", "exist", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "all", " ", "previ", "ous", " ", "entri", "es", "._", "\\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 ", " _", "e\\u", "submissions_", "=_", "Ess", "ay", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "submissions_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ess", "ay", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\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 ", " _", "mc", "\\u", "submissions_", "=_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mc", "\\u", "submissions_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\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 ", " _", "tf", "\\u", "submissions_", "=_", "Tru", "e", "Fal", "se", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "\\u", "submissions_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "tf", "\\u", "submissions_", "._", "Do", "es", "Not", "Exist_", ":_", "\\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 ", " _", "r", "\\u", "submissions_", "=_", "Respons", "e", "Submission_", "._", "objects_", "._", "filter_", "(_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "student_", "=_", "student_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "submissions_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Respons", "e", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\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_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "assign", "ment", " ", "was", " ", "delete", "d", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\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_", "submit", "\\u", "e\\u", "assign", "ment", "\\u", "answer_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "error", " ", "submit", "ting", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "parameter", "s", " ", "from", " ", "post_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "question", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "request_", "._", "FILES_", "[_", "\"", "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 ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "missi", "ng", " ", "file", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "question", " ", "and", " ", "error", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question_", "=_", "Ess", "ay", "Question_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "cann", "ot", " ", "find", " ", "question", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\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 ", " _", "submission_", "=_", "Ess", "ay", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", "=_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ess", "ay", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Ess", "ay", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", "=_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "file_", "=_", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "form", " ", "=", " ", "Ess", "ay", "Subm", "ission", "Form", "(", "instance", "=", "subm", "ission", ",", " ", "files", "=", "request", ".", "FILE", "S", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "form", ".", "is", "\\u", "valid", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "form", ".", "save", "()", " ", " ", "#", " ", "Save", " ", "the", " ", "form", " ", "content", "s", " ", "to", " ", "the", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "response", "\\u", "data", " ", "=", " ", "{", "'", "status", "'", " ", ":", " ", "'", "success", "',", " ", "'", "message", "'", " ", ":", " ", "'", "submitted", "'}", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "response", "\\u", "data", " ", "=", " ", "{", "'", "status", "'", " ", ":", " ", "'", "fail", "ed", "',", " ", "'", "message", "'", " ", ":", " ", "json", ".", "dump", "s", "(", "form", ".", "error", "s", ")}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\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_", "submit", "\\u", "mc", "\\u", "assign", "ment", "\\u", "answer_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "parameter", "s", " ", "from", " ", "post_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "question", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "request_", "._", "POST_", "[_", "'", "answer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "question", " ", "and", " ", "error", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question_", "=_", "Multipl", "e", "Choi", "ce", "Question_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "cann", "ot", " ", "find", " ", "question", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "subm", "ission", " ", "and", " ", "create", " ", "new", " ", "subm", "ission", " ", "if", " ", "not", " ", "found", "._", "\\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 ", " _", "submission_", "=_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", "=_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question_", "=_", "question_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "answer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "A", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "a_", "=_", "not_", "submission_", "._", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "B", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "b_", "=_", "not_", "submission_", "._", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "C", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "c_", "=_", "not_", "submission_", "._", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "D", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "d_", "=_", "not_", "submission_", "._", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "e_", "=_", "not_", "submission_", "._", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "answer_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "f_", "=_", "not_", "submission_", "._", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ca", "clu", "late", " ", "score_", "\\u\\u\\uNL\\u\\u\\u_", "total_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "correct_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "submission_", "._", "a_", "==_", "submission_", "._", "question_", "._", "a", "\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "b_", "==_", "submission_", "._", "question_", "._", "b", "\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "c_", "==_", "submission_", "._", "question_", "._", "c\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "d_", "==_", "submission_", "._", "question_", "._", "d\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "e_", "==_", "submission_", "._", "question_", "._", "e\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "submission_", "._", "f_", "==_", "submission_", "._", "question_", "._", "f", "\\u", "is", "\\u", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct_", "+=_", "1_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "all", " ", "choice", "s", " ", "have", " ", "bee", "n", " ", "correct", "ly", " ", "selecte", "d", ",", " ", "then", " ", "give", " ", "full", " ", "credit", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "total_", "==_", "correct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "marks_", "=_", "submission_", "._", "question_", "._", "marks_", "\\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 ", " _", "submission_", "._", "marks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "success", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "error", " ", "submit", "ting", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\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_", "submit", "\\u", "tf", "\\u", "assign", "ment", "\\u", "answer_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "parameter", "s", " ", "from", " ", "post_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "question", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "request_", "._", "POST_", "[_", "'", "answer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "question", " ", "and", " ", "error", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question_", "=_", "Tru", "e", "Fal", "se", "Question_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Multipl", "e", "Choi", "ce", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "cann", "ot", " ", "find", " ", "question", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "subm", "ission", " ", "and", " ", "create", " ", "new", " ", "subm", "ission", " ", "if", " ", "not", " ", "found", "._", "\\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 ", " _", "submission_", "=_", "Tru", "e", "Fal", "se", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tru", "e", "Fal", "se", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Tru", "e", "Fal", "se", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "the", " ", "answer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "answer_", "=_", "answer_", "==_", "\"", "true", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "the", " ", "marks_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "submission_", "._", "answer_", "==_", "submission_", "._", "question_", "._", "answer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "marks_", "=_", "submission_", "._", "question_", "._", "marks_", "\\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 ", " _", "submission_", "._", "marks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\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_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "submit", "\\u", "r", "\\u", "assign", "ment", "\\u", "answer_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Extract", " ", "parameter", "s", " ", "from", " ", "post_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "question", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "request_", "._", "POST_", "[_", "'", "answer", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "question", " ", "and", " ", "error", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "question_", "=_", "Respons", "e", "Question_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Respons", "e", "Question_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "cann", "ot", " ", "find", " ", "question", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "subm", "ission", " ", "and", " ", "create", " ", "new", " ", "subm", "ission", " ", "if", " ", "not", " ", "found", "._", "\\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 ", " _", "submission_", "=_", "Respons", "e", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Respons", "e", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Respons", "e", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u", "id_", "=_", "question", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "the", " ", "answer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "success", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "answer_", "=_", "answer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\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_", "submit", "\\u", "assignment_", "(_", "request_", ",_", "course", "\\u", "id_", ",_", "assign", "ment", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "from", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "course_", "=_", "Course_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "course", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assignment_", "=_", "Assignment_", "._", "objects_", "._", "get_", "(_", "assign", "ment", "\\u", "id_", "=_", "assign", "ment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "student_", "=_", "Student_", "._", "objects_", "._", "get_", "(_", "user_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Defen", "sive", " ", "Code", ":", " ", "Prev", "ent", " ", "submit", "ting", " ", "assign", "ment", " ", "with", " ", "missi", "ng", " ", "questions_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "IMPL", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "subm", "ission", " ", "and", " ", "create", " ", "new", " ", "subm", "ission", " ", "if", " ", "not", " ", "found", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Assign", "ment", "Submission_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assign", "ment", "Submission_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "Assign", "ment", "Submission_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "is", "\\u", "finished_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "the", " ", "final", " ", "score", " ", "of", " ", "the", " ", "assignment_", "\\u\\u\\uNL\\u\\u\\u_", "compute", "\\u", "score_", "(_", "student_", ",_", "assignment_", ",_", "submission_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "submitted", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\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_", "compute", "\\u", "score_", "(_", "student_", ",_", "assignment_", ",_", "submission_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "total", "\\u", "marks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "earn", "ed", "\\u", "marks_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ess", "ay", " ", "Subm", "ission", "(", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "e\\u", "submissions_", "=_", "Ess", "ay", "Submission_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e\\u", "submission_", "in_", "e\\u", "submissions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "total", "\\u", "marks_", "+=_", "e\\u", "submission_", "._", "question_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "earn", "ed", "\\u", "marks_", "+=_", "e\\u", "submission_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Multipl", "e", " ", "Choi", "ce", " ", "Subm", "ission", "(", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mc", "\\u", "submissions_", "=_", "Multipl", "e", "Choi", "ce", "Submission_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mc", "\\u", "submission_", "in_", "mc", "\\u", "submissions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "total", "\\u", "marks_", "+=_", "mc", "\\u", "submission_", "._", "question_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "earn", "ed", "\\u", "marks_", "+=_", "mc", "\\u", "submission_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tru", "e", " ", "/", " ", "Fal", "se", " ", "Subm", "ission", "(", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tf", "\\u", "submissions_", "=_", "Tru", "e", "Fal", "se", "Submission_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tf", "\\u", "submission_", "in_", "tf", "\\u", "submissions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "total", "\\u", "marks_", "+=_", "tf", "\\u", "submission_", "._", "question_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "earn", "ed", "\\u", "marks_", "+=_", "tf", "\\u", "submission_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Respons", "e", " ", "Subm", "ission", "(", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r", "\\u", "submissions_", "=_", "Respons", "e", "Submission_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "student_", "=_", "student_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "question", "\\u\\u", "assignment_", "=_", "assignment_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r", "\\u", "submission_", "in_", "r", "\\u", "submissions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "total", "\\u", "marks_", "+=_", "r", "\\u", "submission_", "._", "question_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "._", "earn", "ed", "\\u", "marks_", "+=_", "r", "\\u", "submission_", "._", "marks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "Percent_", "\\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 ", " _", "submission_", "._", "percent_", "=_", "round_", "(_", "(_", "submission_", "._", "earn", "ed", "\\u", "marks_", "/_", "submission_", "._", "total", "\\u", "marks_", ")_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "._", "percent_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "calculati", "on_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submission_", "._", "save_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 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 ]
Unused local variable
google/simian/src/tests/simian/mac/client/client_test.py
[ { "content": " def testIsPackageUploadNecessaryWhenHashMissing(self):\n \"\"\"Test _IsPackageUploadNecessary().\"\"\"\n filename = '/tmp/pkgname.dmg'\n upload_pkginfo = self.mox.CreateMockAnything()\n upload_pkginfo_dict = {\n 'installer_item_size': 1,\n 'installer_item_hash': 'foobar',\n }\n cur_pkginfo = 'xml pkginfo data'\n pkginfo_plist = self.mox.CreateMockAnything()\n mock_mpip = self.mox.CreateMockAnything()\n pkginfo_dict = {'foo': 'bar'}\n\n self.mox.StubOutWithMock(self.client, 'GetPackageInfo')\n self.stubs.Set(client, 'plist', self.mox.CreateMock(client.plist))\n\n self.client.GetPackageInfo(filename).AndReturn(cur_pkginfo)\n client.plist.MunkiPackageInfoPlist(cur_pkginfo).AndReturn(mock_mpip)\n mock_mpip.Parse().AndReturn(None)\n mock_mpip.GetContents().AndReturn(pkginfo_dict)\n\n client.plist.MunkiPackageInfoPlist(upload_pkginfo).AndReturn(mock_mpip)\n mock_mpip.Parse().AndReturn(None)\n mock_mpip.GetContents().AndReturn(upload_pkginfo_dict)\n\n self.mox.ReplayAll()\n self.assertTrue(\n self.client._IsPackageUploadNecessary(filename, upload_pkginfo))\n self.mox.VerifyAll()", "metadata": "root.SimianClient.testIsPackageUploadNecessaryWhenHashMissing", "header": "['class', 'SimianClient', '(', 'mox', '.', 'MoxTestBase', ')', ':', '___EOS___']", "index": 273 }, { "content": " def testIsPackageUploadNecessaryWhenHashDifferent(self):\n \"\"\"Test _IsPackageUploadNecessary().\"\"\"\n filename = '/tmp/pkgname.dmg'\n orig_sha256_hash = 'haha hash 2'\n upload_pkginfo = self.mox.CreateMockAnything()\n upload_pkginfo_dict = {\n 'installer_item_size': 1,\n 'installer_item_hash': 'not %s' % orig_sha256_hash,\n }\n cur_pkginfo = 'xml pkginfo data'\n pkginfo_plist = self.mox.CreateMockAnything()\n mock_mpip = self.mox.CreateMockAnything()\n pkginfo_dict = {'installer_item_hash': orig_sha256_hash}\n\n self.mox.StubOutWithMock(self.client, 'GetPackageInfo')\n self.stubs.Set(client, 'plist', self.mox.CreateMock(client.plist))\n\n self.client.GetPackageInfo(filename).AndReturn(cur_pkginfo)\n client.plist.MunkiPackageInfoPlist(cur_pkginfo).AndReturn(mock_mpip)\n mock_mpip.Parse().AndReturn(None)\n mock_mpip.GetContents().AndReturn(pkginfo_dict)\n\n client.plist.MunkiPackageInfoPlist(upload_pkginfo).AndReturn(mock_mpip)\n mock_mpip.Parse().AndReturn(None)\n mock_mpip.GetContents().AndReturn(upload_pkginfo_dict)\n\n self.mox.ReplayAll()\n self.assertTrue(\n self.client._IsPackageUploadNecessary(filename, upload_pkginfo))\n self.mox.VerifyAll()", "metadata": "root.SimianClient.testIsPackageUploadNecessaryWhenHashDifferent", "header": "['class', 'SimianClient', '(', 'mox', '.', 'MoxTestBase', ')', ':', '___EOS___']", "index": 303 }, { "content": " def testIsPackageUploadNecessaryWhenHashSame(self):\n \"\"\"Test _IsPackageUploadNecessary().\"\"\"\n filename = '/tmp/pkgname.dmg'\n orig_sha256_hash = 'haha hash 2'\n upload_pkginfo = self.mox.CreateMockAnything()\n upload_pkginfo_dict = {\n 'uninstaller_item_size': 1,\n 'uninstaller_item_hash': orig_sha256_hash,\n }\n cur_pkginfo = 'xml pkginfo data'\n pkginfo_plist = self.mox.CreateMockAnything()\n mock_mpip = self.mox.CreateMockAnything()\n pkginfo_dict = {'uninstaller_item_hash': orig_sha256_hash}\n\n self.mox.StubOutWithMock(self.client, 'GetPackageInfo')\n self.stubs.Set(client, 'plist', self.mox.CreateMock(client.plist))\n\n self.client.GetPackageInfo(filename).AndReturn(cur_pkginfo)\n client.plist.MunkiPackageInfoPlist(cur_pkginfo).AndReturn(mock_mpip)\n mock_mpip.Parse().AndReturn(None)\n mock_mpip.GetContents().AndReturn(pkginfo_dict)\n\n client.plist.MunkiPackageInfoPlist(upload_pkginfo).AndReturn(mock_mpip)\n mock_mpip.Parse().AndReturn(None)\n mock_mpip.GetContents().AndReturn(upload_pkginfo_dict)\n\n self.mox.ReplayAll()\n self.assertFalse(\n self.client._IsPackageUploadNecessary(filename, upload_pkginfo))\n self.mox.VerifyAll()", "metadata": "root.SimianClient.testIsPackageUploadNecessaryWhenHashSame", "header": "['class', 'SimianClient', '(', 'mox', '.', 'MoxTestBase', ')', ':', '___EOS___']", "index": 334 }, { "content": " def testUploadMunkiPackageWhenNotReadOnlyDiskImage(self):\n \"\"\"Test UploadMunkiPackage().\"\"\"\n filename = '/tmp/filename'\n description = 'desc'\n display_name = 'dn'\n catalogs = 'catalogs'\n manifests = 'manifests'\n install_types = 'install_types'\n pkginfo = self.mox.CreateMockAnything()\n pkginfo_hooks = None\n pkginfo_dict = {\n 'installer_item_size': 'size',\n 'installer_item_hash': 'hash',\n }\n response = 'http response'\n\n self.mox.StubOutWithMock(self.client, '_IsDiskImageReadOnly')\n self.mox.StubOutWithMock(self.client, '_LoadPackageInfo')\n self.mox.StubOutWithMock(self.client, 'UploadPackage')\n\n self.client._IsDiskImageReadOnly(filename).AndReturn(False)\n\n self.mox.ReplayAll()\n self.assertRaises(\n client.client.SimianClientError,\n self.client.UploadMunkiPackage,\n filename, description, display_name, catalogs, manifests,\n install_types, pkginfo_hooks=pkginfo_hooks)\n self.mox.VerifyAll()", "metadata": "root.SimianClient.testUploadMunkiPackageWhenNotReadOnlyDiskImage", "header": "['class', 'SimianClient', '(', 'mox', '.', 'MoxTestBase', ')', ':', '___EOS___']", "index": 365 }, { "content": " def testUploadMunkiPackageWhenHookFalse(self):\n \"\"\"Test UploadMunkiPackage().\"\"\"\n filename = '/tmp/filename'\n description = 'desc'\n display_name = 'dn'\n catalogs = 'catalogs'\n manifests = 'manifests'\n install_types = 'install_types'\n pkginfo = self.mox.CreateMockAnything()\n pkginfo_hooks = [self.mox.CreateMockAnything()]\n pkginfo_dict = {\n 'installer_item_size': 'size',\n 'installer_item_hash': 'hash',\n }\n response = 'http response'\n\n self.mox.StubOutWithMock(self.client, '_IsDiskImageReadOnly')\n self.mox.StubOutWithMock(self.client, '_LoadPackageInfo')\n self.mox.StubOutWithMock(self.client, 'UploadPackage')\n\n self.client._IsDiskImageReadOnly(filename).AndReturn(True)\n self.client._LoadPackageInfo(\n filename, description, display_name, catalogs).AndReturn(pkginfo)\n pkginfo_hooks[0](pkginfo).AndReturn(False)\n pkginfo.Validate().AndReturn(None)\n\n self.mox.ReplayAll()\n self.assertRaises(\n client.client.SimianClientError,\n self.client.UploadMunkiPackage,\n filename, description, display_name, catalogs, manifests, install_types,\n pkginfo_hooks=pkginfo_hooks)\n self.mox.VerifyAll()", "metadata": "root.SimianClient.testUploadMunkiPackageWhenHookFalse", "header": "['class', 'SimianClient', '(', 'mox', '.', 'MoxTestBase', ')', ':', '___EOS___']", "index": 533 } ]
[ { "span": "pkginfo_plist ", "start_line": 282, "start_column": 4, "end_line": 282, "end_column": 17 }, { "span": "pkginfo_plist ", "start_line": 313, "start_column": 4, "end_line": 313, "end_column": 17 }, { "span": "pkginfo_plist ", "start_line": 344, "start_column": 4, "end_line": 344, "end_column": 17 }, { "span": "pkginfo ", "start_line": 373, "start_column": 4, "end_line": 373, "end_column": 11 }, { "span": "pkginfo_dict ", "start_line": 375, "start_column": 4, "end_line": 375, "end_column": 16 }, { "span": "response ", "start_line": 379, "start_column": 4, "end_line": 379, "end_column": 12 }, { "span": "pkginfo_dict ", "start_line": 543, "start_column": 4, "end_line": 543, "end_column": 16 }, { "span": "response ", "start_line": 547, "start_column": 4, "end_line": 547, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sim", "ian", "Client_", "(_", "mox_", "._", "Mo", "x", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Is", "Packa", "ge", "Upload", "Nec", "essa", "ry", "Whe", "n", "Hash", "Missing", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "\\u", "Is", "Packa", "ge", "Upload", "Nec", "essa", "ry", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "'/", "tmp", "/", "pkg", "name", ".", "dmg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "\\u", "pkg", "info_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "\\u", "pkg", "info", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "installer", "\\u", "item", "\\u", "size", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "installer", "\\u", "item", "\\u", "hash", "'_", ":_", "'", "fooba", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "pkg", "info_", "=_", "'", "xml", " ", "pkg", "info", " ", "data", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "plist_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "dict_", "=_", "{_", "'", "foo", "'_", ":_", "'", "bar", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "client_", ",_", "'", "Get", "Packa", "ge", "Info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Set_", "(_", "client_", ",_", "'", "plist", "'_", ",_", "self_", "._", "mox_", "._", "Creat", "e", "Mock_", "(_", "client_", "._", "plist_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "Get", "Packa", "ge", "Info_", "(_", "filename_", ")_", "._", "And", "Return_", "(_", "cur", "\\u", "pkg", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "plist_", "._", "Mun", "ki", "Packa", "ge", "Info", "Plist", "_", "(_", "cur", "\\u", "pkg", "info_", ")_", "._", "And", "Return_", "(_", "mock", "\\u", "mpi", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Parse_", "(_", ")_", "._", "And", "Return_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Get", "Contents_", "(_", ")_", "._", "And", "Return_", "(_", "pkg", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "plist_", "._", "Mun", "ki", "Packa", "ge", "Info", "Plist", "_", "(_", "upload", "\\u", "pkg", "info_", ")_", "._", "And", "Return_", "(_", "mock", "\\u", "mpi", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Parse_", "(_", ")_", "._", "And", "Return_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Get", "Contents_", "(_", ")_", "._", "And", "Return_", "(_", "upload", "\\u", "pkg", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "\\u", "Is", "Packa", "ge", "Upload", "Nec", "essa", "ry_", "(_", "filename_", ",_", "upload", "\\u", "pkg", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sim", "ian", "Client_", "(_", "mox_", "._", "Mo", "x", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Is", "Packa", "ge", "Upload", "Nec", "essa", "ry", "Whe", "n", "Hash", "Different", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "\\u", "Is", "Packa", "ge", "Upload", "Nec", "essa", "ry", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "'/", "tmp", "/", "pkg", "name", ".", "dmg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "\\u", "sha2", "56", "\\u", "hash_", "=_", "'", "hah", "a", " ", "hash", " ", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "\\u", "pkg", "info_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "\\u", "pkg", "info", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "installer", "\\u", "item", "\\u", "size", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "installer", "\\u", "item", "\\u", "hash", "'_", ":_", "'", "not", " ", "%", "s", "'_", "%_", "orig", "\\u", "sha2", "56", "\\u", "hash_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "pkg", "info_", "=_", "'", "xml", " ", "pkg", "info", " ", "data", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "plist_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "dict_", "=_", "{_", "'", "installer", "\\u", "item", "\\u", "hash", "'_", ":_", "orig", "\\u", "sha2", "56", "\\u", "hash_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "client_", ",_", "'", "Get", "Packa", "ge", "Info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Set_", "(_", "client_", ",_", "'", "plist", "'_", ",_", "self_", "._", "mox_", "._", "Creat", "e", "Mock_", "(_", "client_", "._", "plist_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "Get", "Packa", "ge", "Info_", "(_", "filename_", ")_", "._", "And", "Return_", "(_", "cur", "\\u", "pkg", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "plist_", "._", "Mun", "ki", "Packa", "ge", "Info", "Plist", "_", "(_", "cur", "\\u", "pkg", "info_", ")_", "._", "And", "Return_", "(_", "mock", "\\u", "mpi", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Parse_", "(_", ")_", "._", "And", "Return_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Get", "Contents_", "(_", ")_", "._", "And", "Return_", "(_", "pkg", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "plist_", "._", "Mun", "ki", "Packa", "ge", "Info", "Plist", "_", "(_", "upload", "\\u", "pkg", "info_", ")_", "._", "And", "Return_", "(_", "mock", "\\u", "mpi", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Parse_", "(_", ")_", "._", "And", "Return_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Get", "Contents_", "(_", ")_", "._", "And", "Return_", "(_", "upload", "\\u", "pkg", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "\\u", "Is", "Packa", "ge", "Upload", "Nec", "essa", "ry_", "(_", "filename_", ",_", "upload", "\\u", "pkg", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sim", "ian", "Client_", "(_", "mox_", "._", "Mo", "x", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Is", "Packa", "ge", "Upload", "Nec", "essa", "ry", "Whe", "n", "Hash", "Sam", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "\\u", "Is", "Packa", "ge", "Upload", "Nec", "essa", "ry", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "'/", "tmp", "/", "pkg", "name", ".", "dmg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "\\u", "sha2", "56", "\\u", "hash_", "=_", "'", "hah", "a", " ", "hash", " ", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "\\u", "pkg", "info_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "\\u", "pkg", "info", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uninstall", "er", "\\u", "item", "\\u", "size", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uninstall", "er", "\\u", "item", "\\u", "hash", "'_", ":_", "orig", "\\u", "sha2", "56", "\\u", "hash_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "pkg", "info_", "=_", "'", "xml", " ", "pkg", "info", " ", "data", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "plist_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "dict_", "=_", "{_", "'", "uninstall", "er", "\\u", "item", "\\u", "hash", "'_", ":_", "orig", "\\u", "sha2", "56", "\\u", "hash_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "client_", ",_", "'", "Get", "Packa", "ge", "Info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Set_", "(_", "client_", ",_", "'", "plist", "'_", ",_", "self_", "._", "mox_", "._", "Creat", "e", "Mock_", "(_", "client_", "._", "plist_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "Get", "Packa", "ge", "Info_", "(_", "filename_", ")_", "._", "And", "Return_", "(_", "cur", "\\u", "pkg", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "plist_", "._", "Mun", "ki", "Packa", "ge", "Info", "Plist", "_", "(_", "cur", "\\u", "pkg", "info_", ")_", "._", "And", "Return_", "(_", "mock", "\\u", "mpi", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Parse_", "(_", ")_", "._", "And", "Return_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Get", "Contents_", "(_", ")_", "._", "And", "Return_", "(_", "pkg", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "plist_", "._", "Mun", "ki", "Packa", "ge", "Info", "Plist", "_", "(_", "upload", "\\u", "pkg", "info_", ")_", "._", "And", "Return_", "(_", "mock", "\\u", "mpi", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Parse_", "(_", ")_", "._", "And", "Return_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "mpi", "p_", "._", "Get", "Contents_", "(_", ")_", "._", "And", "Return_", "(_", "upload", "\\u", "pkg", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "\\u", "Is", "Packa", "ge", "Upload", "Nec", "essa", "ry_", "(_", "filename_", ",_", "upload", "\\u", "pkg", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sim", "ian", "Client_", "(_", "mox_", "._", "Mo", "x", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Upload", "Mun", "ki", "Packa", "ge", "Whe", "n", "Not", "Read", "On", "ly", "Disk", "Image_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "Upload", "Mun", "ki", "Packa", "ge", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "'/", "tmp", "/", "filename", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "'", "desc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display", "\\u", "name_", "=_", "'", "dn", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "catalogs", "_", "=_", "'", "catalogs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifests", "_", "=_", "'", "manifests", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "types_", "=_", "'", "install", "\\u", "types", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "hooks_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "installer", "\\u", "item", "\\u", "size", "'_", ":_", "'", "size", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "installer", "\\u", "item", "\\u", "hash", "'_", ":_", "'", "hash", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "'", "http", " ", "response", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "client_", ",_", "'\\u", "Is", "Disk", "Image", "Read", "On", "ly", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "client_", ",_", "'\\u", "Load", "Packa", "ge", "Info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "client_", ",_", "'", "Upload", "Packa", "ge", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "\\u", "Is", "Disk", "Image", "Read", "Only_", "(_", "filename_", ")_", "._", "And", "Return_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "client_", "._", "Sim", "ian", "Client", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "Upload", "Mun", "ki", "Package_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", ",_", "description_", ",_", "display", "\\u", "name_", ",_", "catalogs", "_", ",_", "manifests", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "types_", ",_", "pkg", "info", "\\u", "hooks_", "=_", "pkg", "info", "\\u", "hooks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sim", "ian", "Client_", "(_", "mox_", "._", "Mo", "x", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Upload", "Mun", "ki", "Packa", "ge", "Whe", "n", "Hook", "False_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "Upload", "Mun", "ki", "Packa", "ge", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "'/", "tmp", "/", "filename", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "'", "desc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display", "\\u", "name_", "=_", "'", "dn", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "catalogs", "_", "=_", "'", "catalogs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifests", "_", "=_", "'", "manifests", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "types_", "=_", "'", "install", "\\u", "types", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "hooks_", "=_", "[_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "installer", "\\u", "item", "\\u", "size", "'_", ":_", "'", "size", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "installer", "\\u", "item", "\\u", "hash", "'_", ":_", "'", "hash", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "'", "http", " ", "response", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "client_", ",_", "'\\u", "Is", "Disk", "Image", "Read", "On", "ly", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "client_", ",_", "'\\u", "Load", "Packa", "ge", "Info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Stu", "b", "Out", "With", "Mock_", "(_", "self_", "._", "client_", ",_", "'", "Upload", "Packa", "ge", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "\\u", "Is", "Disk", "Image", "Read", "Only_", "(_", "filename_", ")_", "._", "And", "Return_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "\\u", "Load", "Packa", "ge", "Info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", ",_", "description_", ",_", "display", "\\u", "name_", ",_", "catalogs", "_", ")_", "._", "And", "Return_", "(_", "pkg", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info", "\\u", "hooks_", "[_", "0_", "]_", "(_", "pkg", "info_", ")_", "._", "And", "Return_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "info_", "._", "Validate", "_", "(_", ")_", "._", "And", "Return_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "client_", "._", "Sim", "ian", "Client", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "Upload", "Mun", "ki", "Package_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", ",_", "description_", ",_", "display", "\\u", "name_", ",_", "catalogs", "_", ",_", "manifests", "_", ",_", "install", "\\u", "types_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pkg", "info", "\\u", "hooks_", "=_", "pkg", "info", "\\u", "hooks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\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,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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, 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, 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 ]
Unused import
hoytak/lazyrunner/lazyrunner/pmodule/pmodulebase.py
[ { "content": "from copy import deepcopy, copy\nimport logging\nfrom treedict import TreeDict\nimport re\nfrom axisproxy import AxisProxy\n \n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PModule:\n \"\"\"\n The base class for a processing module.\n \"\"\"\n\n\n\n\n \n\n\n\n\n \n\n\n \n ############################################################\n # Now the initializing and running functions\n\n # The setup function; in case it's not needed\n\n \n\n ############################################################\n # Hash stuff\n\n\n\n \n \n\n \n\n", "metadata": "root.PModule", "header": "['module', '___EOS___']", "index": 6 }, { "content": " @classmethod\n def name(cls):\n \"\"\"\n A convenience function; returns the name of the class.\n \"\"\"\n \n return cls._name", "metadata": "root.PModule.name", "header": "['class', 'PModule', ':', '___EOS___']", "index": 11 }, { "content": " @classmethod\n def preprocessParameters(cls, local_parameters):\n \"\"\"\n Optionally, return a preprocessd version of the parameters with\n unneeded options removed. This allows for a hash to be\n calculated that just works with relevant parameters.\n\n meant to be overwritten.\n \"\"\"\n return local_parameters", "metadata": "root.PModule.preprocessParameters", "header": "['class', 'PModule', ':', '___EOS___']", "index": 19 }, { "content": " @classmethod\n def _preprocessParameters(cls, parameters):\n\n pb = parameters[cls._name]\n\n for t in [[], [pb], [pb,parameters.copy(freeze=True)]]:\n try:\n p = cls.preprocessParameters(*t)\n break\n except TypeError, te:\n\n if \"preprocessParameters\" in str(te):\n continue\n else:\n raise\n\n return p if p is not None else parameters[cls._name]", "metadata": "root.PModule._preprocessParameters", "header": "['class', 'PModule', ':', '___EOS___']", "index": 30 }, { "content": " @classmethod\n def _getDependencies(cls, parameters):\n \n def getDep(dep_type):\n\n # Get the precise dependencies \n dep_attr = dep_type + '_dependencies'\n\n def process_dependency(dl):\n def wrong_type(s):\n raise TypeError(\"'%s' dependency type '%s' for module '%s' not understood\"\n % (dep_type, str(type(s)), cls._name))\n \n def clean(s):\n if type(s) is str:\n return s.strip().lower()\n elif not getattr(s, \"__parameter_container__\", False):\n wrong_type(s)\n return s\n \n if type(dl) is str or getattr(dl, \"__parameter_container__\", False):\n s = [dl]\n elif type(dl) in [list, tuple, set]:\n s = list(dl)\n elif dl is None:\n s = []\n else:\n wrong_type(dl)\n \n s = [clean(se) for se in s]\n\n return [se for se in s if se != \"\"]\n\n if hasattr(cls, dep_attr):\n dependency_function = getattr(cls, dep_attr)\n\n if type(dependency_function) in [list, tuple, set, str]:\n return process_dependency(dependency_function)\n\n null_ = \"_null_\"\n\n deps = null_\n \n pb = parameters[cls._name]\n \n for t in [[], [pb], [pb,parameters]]:\n try:\n deps = dependency_function(*t)\n break\n except TypeError, te:\n\n if dep_attr in str(te):\n continue\n else:\n raise\n\n if deps is null_:\n raise TypeError((\"%s() for %s must be a string, list, tuple, set or \"\n \"take either no parameters, the local parameter \"\n \"tree, or the local and global parameter trees.\")\n % (dep_attr, cls._name))\n\n \n return process_dependency(deps) \n\n else:\n return []\n\n mod_dep = getDep(\"module\")\n res_dep = getDep(\"result\")\n par_dep = getDep(\"parameter\")\n\n return (mod_dep, res_dep, par_dep)", "metadata": "root.PModule._getDependencies", "header": "['class', 'PModule', ':', '___EOS___']", "index": 48 }, { "content": " @classmethod\n def _getVersion(cls):\n \"\"\"\n Returns a number indicating the version of the pmodule for\n caching purposes.\n \"\"\"\n \n if hasattr(cls, \"version\"):\n return cls.version\n else:\n return None", "metadata": "root.PModule._getVersion", "header": "['class', 'PModule', ':', '___EOS___']", "index": 123 }, { "content": " @classmethod\n def _getLogger(cls):\n \"\"\"\n Returns the logger associated with the given manager. Note\n that this is available to subclasses as `self.log` or class\n methods as `cls.log` (the log attribute is given to the module\n by the pmodule decorator)\n \"\"\"\n \n return logging.getLogger(cls._name)", "metadata": "root.PModule._getLogger", "header": "['class', 'PModule', ':', '___EOS___']", "index": 135 }, { "content": " @classmethod\n def __getBinaryAttr(self, attr, parameters):\n \n x = getattr(self, attr)\n\n if x in [True, False]:\n return x\n else:\n pb = parameters[self._name]\n\n for t in [[], [pb], [pb, parameters]]:\n try:\n ret = x(*t)\n break\n except TypeError, te:\n\n if attr in str(te):\n continue\n else:\n raise\n\n if ret not in [True, False]:\n raise TypeError(\"'%s' must evaluate to or \"\n \"return True or False.\" % attr)\n return ret ", "metadata": "root.PModule.__getBinaryAttr", "header": "['class', 'PModule', ':', '___EOS___']", "index": 146 }, { "content": " @classmethod\n def _allowsResultCaching(self, parameters):\n if not self._allowsCaching(parameters):\n return False\n\n if hasattr(self, \"disable_results_caching\"):\n return not self.__getBinaryAttr(\"disable_results_caching\", parameters)\n elif hasattr(self, \"disable_result_caching\"):\n return not self.__getBinaryAttr(\"disable_result_caching\", parameters)\n else:\n return True", "metadata": "root.PModule._allowsResultCaching", "header": "['class', 'PModule', ':', '___EOS___']", "index": 172 }, { "content": " @classmethod\n def _allowsCaching(self, parameters):\n if hasattr(self, \"disable_caching\"):\n return not self.__getBinaryAttr(\"disable_caching\", parameters)\n else:\n return True", "metadata": "root.PModule._allowsCaching", "header": "['class', 'PModule', ':', '___EOS___']", "index": 184 }, { "content": " def _setResults(self, r):\n self.local_results = r", "metadata": "root.PModule._setResults", "header": "['class', 'PModule', ':', '___EOS___']", "index": 191 }, { "content": " def _destroy(self):\n\n # makes the the GC easier\n\n del self.local_results\n del self.modules\n del self.results\n del self.parameters\n del self.p\n self.__container_map.clear()\n\n self.log.debug(\"Module %s destroyed.\" % self._name)\n\n self._pnode = None", "metadata": "root.PModule._destroy", "header": "['class', 'PModule', ':', '___EOS___']", "index": 194 }, { "content": " def __init__(self, pnode, parameters, results, modules):\n\n name = self._name\n \n self._pnode = pnode\n\n self.log.info('Initializing Module %s.' % self._name)\n\n self.parameters = parameters\n self.p = parameters[self._name]\n self.results = results\n self.modules = modules\n\n self.__container_map = {}\n\n # Now, call the per-class setup method\n self.setup()\n\n self.log.debug(\"Module %s set up.\" % self._name)", "metadata": "root.PModule.__init__", "header": "['class', 'PModule', ':', '___EOS___']", "index": 211 }, { "content": " def setup(self):\n \"\"\"\n `setup()` is called whenever the processing module is\n initialized, regardless of whether the results are requested\n or not. It is the proper place to put all code that sets up\n the module and is needed to be accessed from other modules\n\n Any return value is discarded.\n\n Note that :ref:`run` is called only if matching results are\n not in the cache.\n \"\"\"\n \n pass", "metadata": "root.PModule.setup", "header": "['class', 'PModule', ':', '___EOS___']", "index": 232 }, { "content": " @classmethod\n def reportResults(cls, parameters, p, r):\n \"\"\"\n Called after results are either loaded from cache or produced\n by :ref:`run` to allow for reporting information about the\n results to the log. Since this method is a class method, it\n cannot depend on :ref:`setup` or :ref:`run`.\n\n `parameters` is the full parameter tree, `p` is the branch of\n the parameter tree specific to this module, and `r` is the\n result tree produced by a previous call to `run` or loaded\n from cache.\n\n Note that results should normally be reported using the class\n attribute `cls.log`.\n \"\"\"\n \n\tcls.log.debug(\"Null Result Reporting function for %s.\" % cls._name)\n \n pass", "metadata": "root.PModule.reportResults", "header": "['class', 'PModule', ':', '___EOS___']", "index": 247 }, { "content": " def run(self):\n \"\"\"\n The primary method to produce results. It may return either\n None (no results produced) or a TreeDict instance with the\n results stored in it. This TreeDict instance is saved to the\n cache if caching is enabled.\n\n If the class attribute `disable_results_caching` is set to\n True, or the return result is None, then the results are never\n saved to cache and this method is always called when results\n from the module are requested. Otherwise, they are loaded\n from cache if possible.\n \"\"\"\n \n pass", "metadata": "root.PModule.run", "header": "['class', 'PModule', ':', '___EOS___']", "index": 268 }, { "content": " def itemHash(self, *items):\n\t\"\"\"\n\tReturns a hash of arbitrary items. This is intended to be\n\tused for fine-grained control of dependencies on parameters;\n\tthe resulting value can passed to :ref:`inCache`,\n\t:ref:`loadFromCache`, and :ref:`saveToCache`. For example::\n\n key = self.itemHash(self.p.x1, self.p.x2)\n\n if self.inCache(key):\n return self.loadFromCache(key)\n else:\n # process, create obj\n\n self.saveToCache(key, obj)\n\n Note that most of this functionality is provided by specifying\n `items` as a tuple to the key argument of :ref:inCache,\n :ref:loadFromCache, or :ref:saveToCache.\n \n\t\"\"\"\n\n\tt = TreeDict()\n\n\tfor n, it in enumerate(items):\n\t t[\"b%d\" % n] = it\n\n\treturn t.hash()", "metadata": "root.PModule.itemHash", "header": "['class', 'PModule', ':', '___EOS___']", "index": 287 }, { "content": " def _cacheAction(self, action,\n obj_name, key,\n ignore_module,\n ignore_local,\n ignore_dependencies,\n is_disk_writable,\n is_persistent,\n creation_function = None,\n obj = None):\n\n if key is not None:\n key = TreeDict(key = key).hash()\n\n d_key = (obj_name, key, ignore_module, ignore_local,\n ignore_dependencies, is_persistent)\n\n try:\n container = self.__container_map[d_key]\n except KeyError:\n container = self.__container_map[d_key] = self._pnode.getCacheContainer(\n obj_name, key, ignore_module, ignore_local,\n ignore_dependencies, is_disk_writable, is_persistent)\n\n if not is_disk_writable:\n container.disableDiskWriting()\n\n if action == \"query\":\n return container.objectIsLoaded()\n elif action == \"load\":\n if not container.objectIsLoaded():\n if creation_function is None:\n raise RuntimeError(\n \"creation_function must be supplied if the \"\n \"object is not available in the cache.\")\n \n container.setObject(creation_function())\n \n return container.getObject()\n \n elif action == \"save\":\n container.setObject(obj)\n\n elif action == \"key\":\n return container.getKeyAsString()\n \n else:\n assert False", "metadata": "root.PModule._cacheAction", "header": "['class', 'PModule', ':', '___EOS___']", "index": 316 }, { "content": " def inCache(self, obj_name, key = None,\n ignore_module = False,\n ignore_local = False,\n disk_writable = True,\n ignore_dependencies = False):\n \"\"\"\n Returns True if an object with key `obj_name` can be loaded\n from cache and False otherwise.\n\n If `key` is not None, a hash is taken of all the values in\n `key` and appended to `obj_name` to specify the name of the\n object. This is an easy and robust way of specifying\n dependencies on parameters. It can be almost any python\n object (the TreeDict hash() function is used to generate the\n hash).\n \n If `ignore_module` is True, then the specific module is\n ignored when caching the object. This can be used for sharing\n objects between modules (when the existing dependency system\n is inadequate).\n\n If `ignore_local` is True, then the local branch of the\n central parameter tree is ignored in calculating the\n dependencies. This allows for fine-grained control over which\n local parameters the object depends on. For example, perhaps\n an object only depends on the local parameters `x` and `y` and\n results from another module. The proper way to query such an\n object would be::\n\n self.inCache(\\\"myobj\\\", ignore_local = True, key = (self.p.x, self.p.y))\n\n If `ignore_dependencies` is True, then the parameters (and\n PModule versions) of all specified dependencies are ignored\n when generating the key for the queried object. For example,\n if an object only depends on the values of the local parameter\n branch and is independent of the results of dependent modules,\n then it can be stored and loaded from cache more frequently by\n specifying ``ignore_dependencies=True``).\n \n \"\"\"\n\n return self._cacheAction(\"query\", obj_name, key, ignore_module,\n ignore_local, ignore_dependencies, True, True)", "metadata": "root.PModule.inCache", "header": "['class', 'PModule', ':', '___EOS___']", "index": 364 }, { "content": " def loadFromCache(self, obj_name, key = None,\n ignore_module = False,\n ignore_local = False,\n ignore_dependencies = False,\n disk_writable = True,\n persistent = True,\n creation_function = None):\n \"\"\"\n Loads the specific object from the cache if available. If it\n is not available, a RuntimeError is raised.\n\n If `key` is not None, a hash is taken of all the values in\n `key` and appended to `obj_name` to specify the name of the\n object. This is an easy and robust way of specifying\n dependencies on parameters. It can be almost any python\n object (the TreeDict hash() function is used to generate the\n hash).\n\n If `ignore_module` is True, then the specific module is\n ignored when caching the object. This can be used for sharing\n objects between modules (when the existing dependency system\n is inadequate).\n\n If `ignore_local` is True, then the local branch of the\n central parameter tree is ignored in calculating the\n dependencies. This allows for fine-grained control over which\n local parameters the object depends on. For example, perhaps\n an object only depends on the local parameters `x` and `y` and\n results from another module. The proper way to load such an\n object would be::\n\n self.loadFromCache(\\\"myobj\\\", ignore_local = True,\n key = (self.p.x, self.p.y))\n\n If `ignore_dependencies` is True, then the parameters (and\n PModule versions) of all specified dependencies are ignored\n when generating the key for the requested object. For\n example, if an object only depends on the values of the local\n parameter branch and is independent of the results of\n dependent modules, then it can be stored and loaded from cache\n more frequently by specifying ``ignore_dependencies=True``).\n If `persistent` is False, then only one objects with the\n given name ever held in the in-memory cache at a single time.\n If `ignore_module` is True, this holds across modules,\n otherwise, it holds only within this module.\n\n If `disk_writable` is False, then only the internal memory\n cache is used; the object is never written to disk.\n\n If `creation_function` is not None, and the object is not in\n cache, ``creation_function()`` is called to create an instance\n of the object, which is then stored in cache and returned.\n For example, in the following code, the function ``create()``\n is called only if `listobj` is not in the cache::\n\n def run(self):\n\n # ...\n\n def create_listobj():\n return [None]*self.p.list_length\n\n L = self.loadFromCache(\\\"listobj\\\", creation_function = create_listobj)\n \n \"\"\"\n\n return self._cacheAction(\"load\", obj_name, key, ignore_module,\n ignore_local, ignore_dependencies, disk_writable,\n persistent, creation_function = creation_function)", "metadata": "root.PModule.loadFromCache", "header": "['class', 'PModule', ':', '___EOS___']", "index": 408 }, { "content": " def saveToCache(self, obj_name, obj,\n key = None,\n ignore_module = False,\n ignore_local = False,\n ignore_dependencies = False,\n persistent = True,\n disk_writable = True):\n \"\"\"\n Caches the specific object `obj` in the local cache.\n\n If `key` is not None, a hash is taken of all the values in\n `key` and appended to `obj_name` to specify the name of the\n object. This is an easy and robust way of specifying\n dependencies on parameters. It can be almost any python\n object (the TreeDict hash() function is used to generate the\n hash).\n\n If `ignore_module` is True, then the specific module is\n ignored when caching the object. This can be used for sharing\n objects between modules (when the existing dependency system\n is inadequate).\n\n If `ignore_local` is True, then the local branch of the\n central parameter tree is ignored in calculating the\n dependencies. This allows for fine-grained control over which\n local parameters the object depends on. For example, perhaps\n an object only depends on the local parameters `x` and `y` and\n results from another module. The proper way to save such an\n object to the cache would be::\n\n self.saveToCache(\\\"myobj\\\", ignore_local = True,\n key = (self.p.x, self.p.y))\n\n If `ignore_dependencies` is True, then the parameters (and\n PModule versions) of all specified dependencies are ignored\n when generating the key for the requested object. For\n example, if an object only depends on the values of the local\n parameter branch and is independent of the results of\n dependent modules, then it can be saved and loaded from cache\n more frequently by specifying ``ignore_dependencies=True``).\n\n If `persistent` is False, then only one objects with the\n given name ever held in the in-memory cache at a single time.\n If `ignore_module` is True, this holds across modules,\n otherwise, it holds only within this module.\n\n If `disk_writable` is False, then only the internal memory\n cache is used; the object is never written to disk.\n \"\"\"\n\n return self._cacheAction(\n \"save\", obj_name, key, ignore_module, ignore_local,\n ignore_dependencies, disk_writable, persistent, obj=obj)", "metadata": "root.PModule.saveToCache", "header": "['class', 'PModule', ':', '___EOS___']", "index": 478 }, { "content": " def key(self, obj_name = None,\n key = None,\n ignore_module = False,\n ignore_local = False,\n ignore_dependencies = False):\n \"\"\"\n Returns a unique string representing the state of the current\n processing module or a certain object. This string is a\n deterministic hash of the parameters, possibly including\n dependencies, for the processing module. \n\n \"\"\"\n\n return self._cacheAction(\"key\", \"__null__\" if obj_name is None else obj_name,\n key, ignore_module, ignore_local,\n ignore_dependencies, True, True)", "metadata": "root.PModule.key", "header": "['class', 'PModule', ':', '___EOS___']", "index": 532 }, { "content": " def getParameters(self, n):\n \"\"\"\n Returns the parameter tree specified\n \"\"\"\n\n return self._pnode.getSpecific(\"parameters\", n)", "metadata": "root.PModule.getParameters", "header": "['class', 'PModule', ':', '___EOS___']", "index": 549 }, { "content": " def getResults(self, r):\n \"\"\"\n Returns the results from r \n \"\"\"\n\n return self._pnode.getSpecific(\"results\", r)", "metadata": "root.PModule.getResults", "header": "['class', 'PModule', ':', '___EOS___']", "index": 556 }, { "content": " def getModule(self, m):\n \"\"\"\n\n \"\"\"\n\n return self._pnode.getSpecific(\"module\", m)", "metadata": "root.PModule.getModule", "header": "['class', 'PModule', ':', '___EOS___']", "index": 563 } ]
[ { "span": "from copy import deepcopy, copy", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 31 }, { "span": "import re", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 }, { "span": "from axisproxy import AxisProxy", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", ",_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tree", "dict_", "import_", "Tree", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "axis", "proxy_", "import_", "Axi", "s", "Proxy_", "\\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_", "PM", "odule_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "base", " ", "class", " ", "for", " ", "a", " ", "process", "ing", " ", "module", ".", "\\", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "No", "w", " ", "the", " ", "initiali", "zin", "g", " ", "and", " ", "runn", "ing", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "setup", " ", "function", ";", " ", "in", " ", "case", " ", "it", "'", "s", " ", "not", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Hash", " ", "stuff_", "\\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_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "name_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "convenien", "ce", " ", "function", ";", " ", "return", "s", " ", "the", " ", "name", " ", "of", " ", "the", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cls_", "._", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\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_", "preproc", "ess", "Parameters_", "(_", "cls_", ",_", "local", "\\u", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Optio", "nal", "ly", ",", " ", "return", " ", "a", " ", "preproc", "ess", "d", " ", "version", " ", "of", " ", "the", " ", "parameter", "s", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "unne", "eded", " ", "options", " ", "remove", "d", ".", " ", " ", "Thi", "s", " ", "allow", "s", " ", "for", " ", "a", " ", "hash", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "calculated", " ", "tha", "t", " ", "just", " ", "works", " ", "with", " ", "rele", "van", "t", " ", "parameter", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "mean", "t", " ", "to", " ", "be", " ", "overwrit", "ten", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "local", "\\u", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\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_", "\\u", "preproc", "ess", "Parameters_", "(_", "cls_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pb_", "=_", "parameters_", "[_", "cls_", "._", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "[_", "[_", "]_", ",_", "[_", "pb_", "]_", ",_", "[_", "pb_", ",_", "parameters_", "._", "copy_", "(_", "freeze_", "=_", "True_", ")_", "]_", "]_", ":_", "\\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 ", " _", "p_", "=_", "cls_", "._", "preproc", "ess", "Parameters_", "(_", "*_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "preproc", "ess", "Parameter", "s", "\"_", "in_", "str_", "(_", "te_", ")_", ":_", "\\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 ", " ", "_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "p_", "if_", "p_", "is_", "not_", "None_", "else_", "parameters_", "[_", "cls_", "._", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\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_", "\\u", "get", "Dependenc", "ies_", "(_", "cls_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "Dep", "_", "(_", "dep", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "precise", " ", "dependen", "cies", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dep", "\\u", "attr_", "=_", "dep", "\\u", "type_", "+_", "'\\u", "dependen", "cies", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process", "\\u", "dependency_", "(_", "dl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "wrong", "\\u", "type_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", "(_", "\"'", "%", "s", "'", " ", "dependen", "cy", " ", "type", " ", "'%", "s", "'", " ", "for", " ", "module", " ", "'%", "s", "'", " ", "not", " ", "underst", "oo", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "dep", "\\u", "type_", ",_", "str_", "(_", "type_", "(_", "s_", ")_", ")_", ",_", "cls_", "._", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "type_", "(_", "s_", ")_", "is_", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "s_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "getattr_", "(_", "s_", ",_", "\"\\u\\u", "parameter", "\\u", "container", "\\u\\u\"_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "wrong", "\\u", "type_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "dl_", ")_", "is_", "str_", "or_", "getattr_", "(_", "dl_", ",_", "\"\\u\\u", "parameter", "\\u", "container", "\\u\\u\"_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "s_", "=_", "[_", "dl_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "dl_", ")_", "in_", "[_", "list_", ",_", "tuple_", ",_", "set_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "s_", "=_", "list_", "(_", "dl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "dl_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "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 ", " ", "_", "wrong", "\\u", "type_", "(_", "dl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "[_", "clean_", "(_", "se_", ")_", "for_", "se_", "in_", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "se_", "for_", "se_", "in_", "s_", "if_", "se_", "!=_", "\"\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "cls_", ",_", "dep", "\\u", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependen", "cy", "\\u", "function_", "=_", "getattr_", "(_", "cls_", ",_", "dep", "\\u", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "dependen", "cy", "\\u", "function_", ")_", "in_", "[_", "list_", ",_", "tuple_", ",_", "set_", ",_", "str_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "process", "\\u", "dependency_", "(_", "dependen", "cy", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "null", "\\u_", "=_", "\"\\u", "null", "\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "deps_", "=_", "null", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pb_", "=_", "parameters_", "[_", "cls_", "._", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "[_", "[_", "]_", ",_", "[_", "pb_", "]_", ",_", "[_", "pb_", ",_", "parameters_", "]_", "]_", ":_", "\\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 ", " ", " _", "deps_", "=_", "dependen", "cy", "\\u", "function_", "(_", "*_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "dep", "\\u", "attr_", "in_", "str_", "(_", "te_", ")_", ":_", "\\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 ", " ", " _", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "deps_", "is_", "null", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", "(_", "(_", "\"%", "s", "()", " ", "for", " ", "%", "s", " ", "must", " ", "be", " ", "a", " ", "string", ",", " ", "list", ",", " ", "tuple", ",", " ", "set", " ", "or", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "take", " ", "eit", "her", " ", "no", " ", "parameter", "s", ",", " ", "the", " ", "local", " ", "parameter", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tree", ",", " ", "or", " ", "the", " ", "local", " ", "and", " ", "global", " ", "parameter", " ", "trees", ".\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "dep", "\\u", "attr_", ",_", "cls_", "._", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "process", "\\u", "dependency_", "(_", "deps_", ")_", "\\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 ", " _", "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_", "mod", "\\u", "dep_", "=_", "get", "Dep", "_", "(_", "\"", "module", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "dep_", "=_", "get", "Dep", "_", "(_", "\"", "result", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "\\u", "dep_", "=_", "get", "Dep", "_", "(_", "\"", "parameter", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "mod", "\\u", "dep_", ",_", "res", "\\u", "dep_", ",_", "par", "\\u", "dep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\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_", "\\u", "get", "Version_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "number", " ", "indicati", "ng", " ", "the", " ", "version", " ", "of", " ", "the", " ", "pmo", "dul", "e", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "caching", " ", "purpose", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "cls_", ",_", "\"", "version", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "version_", "\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "get", "Logger_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "logg", "er", " ", "associate", "d", " ", "with", " ", "the", " ", "give", "n", " ", "manage", "r", ".", " ", " ", "Not", "e", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "this", " ", "is", " ", "avail", "able", " ", "to", " ", "subclasses", " ", "as", " ", "`", "self", ".", "log", "`", " ", "or", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "method", "s", " ", "as", " ", "`", "cls", ".", "log", "`", " ", "(", "the", " ", "log", " ", "attribute", " ", "is", " ", "give", "n", " ", "to", " ", "the", " ", "module", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "the", " ", "pmo", "dul", "e", " ", "decorat", "or", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "logging_", "._", "get", "Logger_", "(_", "cls_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\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_", "\\u\\u", "get", "Bin", "ary", "Attr_", "(_", "self_", ",_", "attr_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "getattr_", "(_", "self_", ",_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x_", "in_", "[_", "True_", ",_", "False_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\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 ", " _", "pb_", "=_", "parameters_", "[_", "self_", "._", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "[_", "[_", "]_", ",_", "[_", "pb_", "]_", ",_", "[_", "pb_", ",_", "parameters_", "]_", "]_", ":_", "\\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 ", " ", "_", "ret_", "=_", "x_", "(_", "*_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "attr_", "in_", "str_", "(_", "te_", ")_", ":_", "\\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 ", " ", " _", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ret_", "not_", "in_", "[_", "True_", ",_", "False_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"'", "%", "s", "'", " ", "must", " ", "evaluate", " ", "to", " ", "or", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "return", " ", "Tru", "e", " ", "or", " ", "Fal", "se", ".\"_", "%_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "allow", "s", "Result", "Caching", "_", "(_", "self_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "allow", "s", "Caching", "_", "(_", "parameters_", ")_", ":_", "\\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_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "disable", "\\u", "results", "\\u", "caching", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "._", "\\u\\u", "get", "Bin", "ary", "Attr_", "(_", "\"", "disable", "\\u", "results", "\\u", "caching", "\"_", ",_", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "self_", ",_", "\"", "disable", "\\u", "result", "\\u", "caching", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "._", "\\u\\u", "get", "Bin", "ary", "Attr_", "(_", "\"", "disable", "\\u", "result", "\\u", "caching", "\"_", ",_", "parameters_", ")_", "\\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_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "allow", "s", "Caching", "_", "(_", "self_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "\"", "disable", "\\u", "caching", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "._", "\\u\\u", "get", "Bin", "ary", "Attr_", "(_", "\"", "disable", "\\u", "caching", "\"_", ",_", "parameters_", ")_", "\\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_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\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", "set", "Results_", "(_", "self_", ",_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "local", "\\u", "results_", "=_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "destroy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", "s", " ", "the", " ", "the", " ", "GC", " ", "easi", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "local", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "container", "\\u", "map_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Modul", "e", " ", "%", "s", " ", "destroy", "ed", ".\"_", "%_", "self_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "pno", "de_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "pno", "de_", ",_", "parameters_", ",_", "results_", ",_", "modules_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "pno", "de_", "=_", "pno", "de_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "log_", "._", "info_", "(_", "'", "Initializ", "ing", " ", "Modul", "e", " ", "%", "s", ".'_", "%_", "self_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parameters_", "=_", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p_", "=_", "parameters_", "[_", "self_", "._", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "results_", "=_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "modules_", "=_", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "container", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "call", " ", "the", " ", "per", "-", "class", " ", "setup", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Modul", "e", " ", "%", "s", " ", "set", " ", "up", ".\"_", "%_", "self_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "`", "setup", "()`", " ", "is", " ", "call", "ed", " ", "whe", "neve", "r", " ", "the", " ", "process", "ing", " ", "module", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "initialize", "d", ",", " ", "rega", "rd", "less", " ", "of", " ", "whe", "ther", " ", "the", " ", "results", " ", "are", " ", "request", "ed", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "not", ".", " ", " ", "It", " ", "is", " ", "the", " ", "proper", " ", "place", " ", "to", " ", "put", " ", "all", " ", "code", " ", "tha", "t", " ", "sets", " ", "up", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "module", " ", "and", " ", "is", " ", "need", "ed", " ", "to", " ", "be", " ", "accesse", "d", " ", "from", " ", "other", " ", "module", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "return", " ", "value", " ", "is", " ", "discard", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", ":", "ref", ":`", "run", "`", " ", "is", " ", "call", "ed", " ", "only", " ", "if", " ", "matchi", "ng", " ", "results", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "in", " ", "the", " ", "cache", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\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_", "report", "Results_", "(_", "cls_", ",_", "parameters_", ",_", "p_", ",_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", "ed", " ", "after", " ", "results", " ", "are", " ", "eit", "her", " ", "load", "ed", " ", "from", " ", "cache", " ", "or", " ", "produce", "d", "\\", "10", ";", " ", " ", " ", " ", "by", " ", ":", "ref", ":`", "run", "`", " ", "to", " ", "allow", " ", "for", " ", "reporting", " ", "informati", "on", " ", "abo", "ut", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "results", " ", "to", " ", "the", " ", "log", ".", " ", " ", "Sin", "ce", " ", "this", " ", "method", " ", "is", " ", "a", " ", "class", " ", "method", ",", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "cann", "ot", " ", "depend", " ", "on", " ", ":", "ref", ":`", "setup", "`", " ", "or", " ", ":", "ref", ":`", "run", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "parameter", "s", "`", " ", "is", " ", "the", " ", "full", " ", "parameter", " ", "tree", ",", " ", "`", "p", "`", " ", "is", " ", "the", " ", "branch", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "parameter", " ", "tree", " ", "specific", " ", "to", " ", "this", " ", "module", ",", " ", "and", " ", "`", "r", "`", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "tree", " ", "produce", "d", " ", "by", " ", "a", " ", "previ", "ous", " ", "call", " ", "to", " ", "`", "run", "`", " ", "or", " ", "load", "ed", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "cache", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "results", " ", "shou", "ld", " ", "normal", "ly", " ", "be", " ", "reporte", "d", " ", "usi", "ng", " ", "the", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "attribute", " ", "`", "cls", ".", "log", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "log_", "._", "debug_", "(_", "\"", "Null", " ", "Result", " ", "Report", "ing", " ", "function", " ", "for", " ", "%", "s", ".\"_", "%_", "cls_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "primary", " ", "method", " ", "to", " ", "produce", " ", "results", ".", " ", " ", "It", " ", "may", " ", "return", " ", "eit", "her", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", " ", "(", "no", " ", "results", " ", "produce", "d", ")", " ", "or", " ", "a", " ", "Tree", "Dict", " ", "instance", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "results", " ", "store", "d", " ", "in", " ", "it", ".", " ", " ", "Thi", "s", " ", "Tree", "Dict", " ", "instance", " ", "is", " ", "saved", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "cache", " ", "if", " ", "caching", " ", "is", " ", "enable", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "class", " ", "attribute", " ", "`", "disable", "\\u", "results", "\\u", "caching", "`", " ", "is", " ", "set", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", ",", " ", "or", " ", "the", " ", "return", " ", "result", " ", "is", " ", "Non", "e", ",", " ", "then", " ", "the", " ", "results", " ", "are", " ", "neve", "r", "\\", "10", ";", " ", " ", " ", " ", "saved", " ", "to", " ", "cache", " ", "and", " ", "this", " ", "method", " ", "is", " ", "alw", "ay", "s", " ", "call", "ed", " ", "whe", "n", " ", "results", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "the", " ", "module", " ", "are", " ", "request", "ed", ".", " ", " ", "Ot", "her", "wis", "e", ",", " ", "the", "y", " ", "are", " ", "load", "ed", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "cache", " ", "if", " ", "possib", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "Hash_", "(_", "self_", ",_", "*_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "\\", "10", ";", "\t", "Return", "s", " ", "a", " ", "hash", " ", "of", " ", "arbitra", "ry", " ", "items", ".", " ", " ", "Thi", "s", " ", "is", " ", "inten", "ded", " ", "to", " ", "be", "\\", "10", ";", "\t", "used", " ", "for", " ", "fine", "-", "grain", "ed", " ", "control", " ", "of", " ", "dependen", "cies", " ", "on", " ", "parameter", "s", ";", "\\", "10", ";", "\t", "the", " ", "result", "ing", " ", "value", " ", "can", " ", "pass", "ed", " ", "to", " ", ":", "ref", ":`", "in", "Cache", "`", ",", "\\", "10", ";", "\t", ":", "ref", ":`", "load", "Fro", "m", "Cache", "`", ",", " ", "and", " ", ":", "ref", ":`", "save", "To", "Cache", "`.", " ", " ", "For", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "key", " ", "=", " ", "self", ".", "item", "Hash", "(", "self", ".", "p", ".", "x1", ",", " ", "self", ".", "p", ".", "x2", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", "if", " ", "self", ".", "in", "Cache", "(", "key", "):", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "return", " ", "self", ".", "load", "Fro", "m", "Cache", "(", "key", ")", "\\", "10", ";", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "#", " ", "process", ",", " ", "create", " ", "obj", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "self", ".", "save", "To", "Cache", "(", "key", ",", " ", "obj", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "most", " ", "of", " ", "this", " ", "functional", "it", "y", " ", "is", " ", "provided", " ", "by", " ", "speci", "fy", "ing", "\\", "10", ";", " ", " ", " ", " ", "`", "items", "`", " ", "as", " ", "a", " ", "tuple", " ", "to", " ", "the", " ", "key", " ", "argu", "ment", " ", "of", " ", ":", "ref", ":", "in", "Cache", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "ref", ":", "load", "Fro", "m", "Cache", ",", " ", "or", " ", ":", "ref", ":", "save", "To", "Cache", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "Tree", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", ",_", "it_", "in_", "enumerate_", "(_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "t_", "[_", "\"", "b", "%", "d", "\"_", "%_", "n_", "]_", "=_", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "t_", "._", "hash_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cache", "Action_", "(_", "self_", ",_", "action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj", "\\u", "name_", ",_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "module_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "local_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dependencies_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "disk", "\\u", "writable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "persistent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creati", "on", "\\u", "function_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "Tree", "Dict_", "(_", "key_", "=_", "key_", ")_", "._", "hash_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d\\u", "key_", "=_", "(_", "obj", "\\u", "name_", ",_", "key_", ",_", "ignore", "\\u", "module_", ",_", "ignore", "\\u", "local_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dependencies_", ",_", "is", "\\u", "persistent_", ")_", "\\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 ", " _", "container_", "=_", "self_", "._", "\\u\\u", "container", "\\u", "map_", "[_", "d\\u", "key_", "]_", "\\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 ", " _", "container_", "=_", "self_", "._", "\\u\\u", "container", "\\u", "map_", "[_", "d\\u", "key_", "]_", "=_", "self_", "._", "\\u", "pno", "de_", "._", "get", "Cache", "Container_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "obj", "\\u", "name_", ",_", "key_", ",_", "ignore", "\\u", "module_", ",_", "ignore", "\\u", "local_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dependencies_", ",_", "is", "\\u", "disk", "\\u", "writable_", ",_", "is", "\\u", "persistent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "disk", "\\u", "writable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "container_", "._", "disable", "Disk", "Writ", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "action_", "==_", "\"", "query", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "container_", "._", "object", "Is", "Load", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "action_", "==_", "\"", "load", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "container_", "._", "object", "Is", "Load", "ed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "creati", "on", "\\u", "function_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Run", "time", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "creati", "on", "\\u", "function", " ", "must", " ", "be", " ", "supplie", "d", " ", "if", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", " ", "is", " ", "not", " ", "avail", "able", " ", "in", " ", "the", " ", "cache", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "container_", "._", "set", "Object_", "(_", "creati", "on", "\\u", "function_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "container_", "._", "get", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "action_", "==_", "\"", "save", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "container_", "._", "set", "Object_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "action_", "==_", "\"", "key", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "container_", "._", "get", "Key", "As", "String_", "(_", ")_", "\\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 ", " _", "assert_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\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_", "in", "Cache_", "(_", "self_", ",_", "obj", "\\u", "name_", ",_", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "module_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "local_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "writable_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dependencies_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "an", " ", "object", " ", "with", " ", "key", " ", "`", "obj", "\\u", "name", "`", " ", "can", " ", "be", " ", "load", "ed", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "cache", " ", "and", " ", "Fal", "se", " ", "other", "wis", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "key", "`", " ", "is", " ", "not", " ", "Non", "e", ",", " ", "a", " ", "hash", " ", "is", " ", "take", "n", " ", "of", " ", "all", " ", "the", " ", "values", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "`", "key", "`", " ", "and", " ", "append", "ed", " ", "to", " ", "`", "obj", "\\u", "name", "`", " ", "to", " ", "speci", "fy", " ", "the", " ", "name", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "object", ".", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "easy", " ", "and", " ", "robust", " ", "way", " ", "of", " ", "speci", "fy", "ing", "\\", "10", ";", " ", " ", " ", " ", "dependen", "cies", " ", "on", " ", "parameter", "s", ".", " ", " ", "It", " ", "can", " ", "be", " ", "alm", "ost", " ", "any", " ", "python", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "(", "the", " ", "Tree", "Dict", " ", "hash", "()", " ", "function", " ", "is", " ", "used", " ", "to", " ", "generat", "e", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "hash", ").", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "module", "`", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "specific", " ", "module", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "ignore", "d", " ", "whe", "n", " ", "caching", " ", "the", " ", "object", ".", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "for", " ", "shar", "ing", "\\", "10", ";", " ", " ", " ", " ", "object", "s", " ", "bet", "ween", " ", "module", "s", " ", "(", "whe", "n", " ", "the", " ", "exist", "ing", " ", "dependen", "cy", " ", "system", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "ina", "deq", "uat", "e", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "local", "`", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "local", " ", "branch", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "central", " ", "parameter", " ", "tree", " ", "is", " ", "ignore", "d", " ", "in", " ", "calculati", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "dependen", "cies", ".", " ", "Thi", "s", " ", "allow", "s", " ", "for", " ", "fine", "-", "grain", "ed", " ", "control", " ", "over", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "local", " ", "parameter", "s", " ", "the", " ", "object", " ", "depend", "s", " ", "on", ".", " ", " ", "For", " ", "example", ",", " ", "per", "hap", "s", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "object", " ", "only", " ", "depend", "s", " ", "on", " ", "the", " ", "local", " ", "parameter", "s", " ", "`", "x", "`", " ", "and", " ", "`", "y", "`", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "results", " ", "from", " ", "anot", "her", " ", "module", ".", " ", " ", "The", " ", "proper", " ", "way", " ", "to", " ", "query", " ", "suc", "h", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "wou", "ld", " ", "be", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "self", ".", "in", "Cache", "(\\\\\"", "myo", "bj", "\\\\\",", " ", "ignore", "\\u", "local", " ", "=", " ", "Tru", "e", ",", " ", "key", " ", "=", " ", "(", "self", ".", "p", ".", "x", ",", " ", "self", ".", "p", ".", "y", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "dependen", "cies", "`", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "parameter", "s", " ", "(", "and", "\\", "10", ";", " ", " ", " ", " ", "PM", "odule", " ", "version", "s", ")", " ", "of", " ", "all", " ", "specified", " ", "dependen", "cies", " ", "are", " ", "ignore", "d", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "generat", "ing", " ", "the", " ", "key", " ", "for", " ", "the", " ", "queried", " ", "object", ".", " ", " ", "For", " ", "example", ",", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "an", " ", "object", " ", "only", " ", "depend", "s", " ", "on", " ", "the", " ", "values", " ", "of", " ", "the", " ", "local", " ", "parameter", "\\", "10", ";", " ", " ", " ", " ", "branch", " ", "and", " ", "is", " ", "independent", " ", "of", " ", "the", " ", "results", " ", "of", " ", "dependent", " ", "module", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "it", " ", "can", " ", "be", " ", "store", "d", " ", "and", " ", "load", "ed", " ", "from", " ", "cache", " ", "more", " ", "frequent", "ly", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "speci", "fy", "ing", " ", "``", "ignore", "\\u", "dependen", "cies", "=", "Tru", "e", "``)", ".", "\\", "10", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "cache", "Action_", "(_", "\"", "query", "\"_", ",_", "obj", "\\u", "name_", ",_", "key_", ",_", "ignore", "\\u", "module_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "local_", ",_", "ignore", "\\u", "dependencies_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Fro", "m", "Cache_", "(_", "self_", ",_", "obj", "\\u", "name_", ",_", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "module_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "local_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dependencies_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "writable_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "persistent_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creati", "on", "\\u", "function_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", "s", " ", "the", " ", "specific", " ", "object", " ", "from", " ", "the", " ", "cache", " ", "if", " ", "avail", "able", ".", " ", " ", "If", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "not", " ", "avail", "able", ",", " ", "a", " ", "Run", "time", "Error", " ", "is", " ", "raise", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "key", "`", " ", "is", " ", "not", " ", "Non", "e", ",", " ", "a", " ", "hash", " ", "is", " ", "take", "n", " ", "of", " ", "all", " ", "the", " ", "values", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "`", "key", "`", " ", "and", " ", "append", "ed", " ", "to", " ", "`", "obj", "\\u", "name", "`", " ", "to", " ", "speci", "fy", " ", "the", " ", "name", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "object", ".", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "easy", " ", "and", " ", "robust", " ", "way", " ", "of", " ", "speci", "fy", "ing", "\\", "10", ";", " ", " ", " ", " ", "dependen", "cies", " ", "on", " ", "parameter", "s", ".", " ", " ", "It", " ", "can", " ", "be", " ", "alm", "ost", " ", "any", " ", "python", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "(", "the", " ", "Tree", "Dict", " ", "hash", "()", " ", "function", " ", "is", " ", "used", " ", "to", " ", "generat", "e", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "hash", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "module", "`", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "specific", " ", "module", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "ignore", "d", " ", "whe", "n", " ", "caching", " ", "the", " ", "object", ".", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "for", " ", "shar", "ing", "\\", "10", ";", " ", " ", " ", " ", "object", "s", " ", "bet", "ween", " ", "module", "s", " ", "(", "whe", "n", " ", "the", " ", "exist", "ing", " ", "dependen", "cy", " ", "system", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "ina", "deq", "uat", "e", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "local", "`", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "local", " ", "branch", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "central", " ", "parameter", " ", "tree", " ", "is", " ", "ignore", "d", " ", "in", " ", "calculati", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "dependen", "cies", ".", " ", "Thi", "s", " ", "allow", "s", " ", "for", " ", "fine", "-", "grain", "ed", " ", "control", " ", "over", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "local", " ", "parameter", "s", " ", "the", " ", "object", " ", "depend", "s", " ", "on", ".", " ", " ", "For", " ", "example", ",", " ", "per", "hap", "s", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "object", " ", "only", " ", "depend", "s", " ", "on", " ", "the", " ", "local", " ", "parameter", "s", " ", "`", "x", "`", " ", "and", " ", "`", "y", "`", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "results", " ", "from", " ", "anot", "her", " ", "module", ".", " ", " ", "The", " ", "proper", " ", "way", " ", "to", " ", "load", " ", "suc", "h", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "wou", "ld", " ", "be", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "self", ".", "load", "Fro", "m", "Cache", "(\\\\\"", "myo", "bj", "\\\\\",", " ", "ignore", "\\u", "local", " ", "=", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", " ", "key", " ", "=", " ", "(", "self", ".", "p", ".", "x", ",", " ", "self", ".", "p", ".", "y", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "dependen", "cies", "`", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "parameter", "s", " ", "(", "and", "\\", "10", ";", " ", " ", " ", " ", "PM", "odule", " ", "version", "s", ")", " ", "of", " ", "all", " ", "specified", " ", "dependen", "cies", " ", "are", " ", "ignore", "d", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "generat", "ing", " ", "the", " ", "key", " ", "for", " ", "the", " ", "request", "ed", " ", "object", ".", " ", " ", "For", "\\", "10", ";", " ", " ", " ", " ", "example", ",", " ", "if", " ", "an", " ", "object", " ", "only", " ", "depend", "s", " ", "on", " ", "the", " ", "values", " ", "of", " ", "the", " ", "local", "\\", "10", ";", " ", " ", " ", " ", "parameter", " ", "branch", " ", "and", " ", "is", " ", "independent", " ", "of", " ", "the", " ", "results", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "dependent", " ", "module", "s", ",", " ", "then", " ", "it", " ", "can", " ", "be", " ", "store", "d", " ", "and", " ", "load", "ed", " ", "from", " ", "cache", "\\", "10", ";", " ", " ", " ", " ", "more", " ", "frequent", "ly", " ", "by", " ", "speci", "fy", "ing", " ", "``", "ignore", "\\u", "dependen", "cies", "=", "Tru", "e", "``)", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "persiste", "nt", "`", " ", "is", " ", "Fal", "se", ",", " ", "then", " ", "only", " ", "one", " ", "object", "s", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "name", " ", "ever", " ", "hel", "d", " ", "in", " ", "the", " ", "in", "-", "memory", " ", "cache", " ", "at", " ", "a", " ", "single", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "module", "`", " ", "is", " ", "Tru", "e", ",", " ", "this", " ", "hold", "s", " ", "acro", "ss", " ", "module", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", ",", " ", "it", " ", "hold", "s", " ", "only", " ", "within", " ", "this", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "disk", "\\u", "writ", "able", "`", " ", "is", " ", "Fal", "se", ",", " ", "then", " ", "only", " ", "the", " ", "internal", " ", "memory", "\\", "10", ";", " ", " ", " ", " ", "cache", " ", "is", " ", "used", ";", " ", "the", " ", "object", " ", "is", " ", "neve", "r", " ", "writt", "en", " ", "to", " ", "disk", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "creati", "on", "\\u", "function", "`", " ", "is", " ", "not", " ", "Non", "e", ",", " ", "and", " ", "the", " ", "object", " ", "is", " ", "not", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "cache", ",", " ", "``", "creati", "on", "\\u", "function", "()``", " ", "is", " ", "call", "ed", " ", "to", " ", "create", " ", "an", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "object", ",", " ", "whi", "ch", " ", "is", " ", "then", " ", "store", "d", " ", "in", " ", "cache", " ", "and", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "in", " ", "the", " ", "follow", "ing", " ", "code", ",", " ", "the", " ", "function", " ", "``", "create", "()``", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "call", "ed", " ", "only", " ", "if", " ", "`", "listo", "bj", "`", " ", "is", " ", "not", " ", "in", " ", "the", " ", "cache", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "def", " ", "run", "(", "self", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "#", " ", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "def", " ", "create", "\\u", "listo", "bj", "():", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "return", " ", "[", "Non", "e", "]*", "self", ".", "p", ".", "list", "\\u", "length", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "L", " ", "=", " ", "self", ".", "load", "Fro", "m", "Cache", "(\\\\\"", "listo", "bj", "\\\\\",", " ", "creati", "on", "\\u", "function", " ", "=", " ", "create", "\\u", "listo", "bj", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "cache", "Action_", "(_", "\"", "load", "\"_", ",_", "obj", "\\u", "name_", ",_", "key_", ",_", "ignore", "\\u", "module_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "local_", ",_", "ignore", "\\u", "dependencies_", ",_", "disk", "\\u", "writable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "persistent_", ",_", "creati", "on", "\\u", "function_", "=_", "creati", "on", "\\u", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "To", "Cache_", "(_", "self_", ",_", "obj", "\\u", "name_", ",_", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "module_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "local_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dependencies_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "persistent_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "writable_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Cache", "s", " ", "the", " ", "specific", " ", "object", " ", "`", "obj", "`", " ", "in", " ", "the", " ", "local", " ", "cache", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "key", "`", " ", "is", " ", "not", " ", "Non", "e", ",", " ", "a", " ", "hash", " ", "is", " ", "take", "n", " ", "of", " ", "all", " ", "the", " ", "values", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "`", "key", "`", " ", "and", " ", "append", "ed", " ", "to", " ", "`", "obj", "\\u", "name", "`", " ", "to", " ", "speci", "fy", " ", "the", " ", "name", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "object", ".", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "easy", " ", "and", " ", "robust", " ", "way", " ", "of", " ", "speci", "fy", "ing", "\\", "10", ";", " ", " ", " ", " ", "dependen", "cies", " ", "on", " ", "parameter", "s", ".", " ", " ", "It", " ", "can", " ", "be", " ", "alm", "ost", " ", "any", " ", "python", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "(", "the", " ", "Tree", "Dict", " ", "hash", "()", " ", "function", " ", "is", " ", "used", " ", "to", " ", "generat", "e", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "hash", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "module", "`", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "specific", " ", "module", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "ignore", "d", " ", "whe", "n", " ", "caching", " ", "the", " ", "object", ".", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "for", " ", "shar", "ing", "\\", "10", ";", " ", " ", " ", " ", "object", "s", " ", "bet", "ween", " ", "module", "s", " ", "(", "whe", "n", " ", "the", " ", "exist", "ing", " ", "dependen", "cy", " ", "system", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "ina", "deq", "uat", "e", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "local", "`", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "local", " ", "branch", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "central", " ", "parameter", " ", "tree", " ", "is", " ", "ignore", "d", " ", "in", " ", "calculati", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "dependen", "cies", ".", " ", "Thi", "s", " ", "allow", "s", " ", "for", " ", "fine", "-", "grain", "ed", " ", "control", " ", "over", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "local", " ", "parameter", "s", " ", "the", " ", "object", " ", "depend", "s", " ", "on", ".", " ", " ", "For", " ", "example", ",", " ", "per", "hap", "s", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "object", " ", "only", " ", "depend", "s", " ", "on", " ", "the", " ", "local", " ", "parameter", "s", " ", "`", "x", "`", " ", "and", " ", "`", "y", "`", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "results", " ", "from", " ", "anot", "her", " ", "module", ".", " ", " ", "The", " ", "proper", " ", "way", " ", "to", " ", "save", " ", "suc", "h", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "to", " ", "the", " ", "cache", " ", "wou", "ld", " ", "be", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "self", ".", "save", "To", "Cache", "(\\\\\"", "myo", "bj", "\\\\\",", " ", "ignore", "\\u", "local", " ", "=", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "key", " ", "=", " ", "(", "self", ".", "p", ".", "x", ",", " ", "self", ".", "p", ".", "y", "))\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "dependen", "cies", "`", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "parameter", "s", " ", "(", "and", "\\", "10", ";", " ", " ", " ", " ", "PM", "odule", " ", "version", "s", ")", " ", "of", " ", "all", " ", "specified", " ", "dependen", "cies", " ", "are", " ", "ignore", "d", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "generat", "ing", " ", "the", " ", "key", " ", "for", " ", "the", " ", "request", "ed", " ", "object", ".", " ", " ", "For", "\\", "10", ";", " ", " ", " ", " ", "example", ",", " ", "if", " ", "an", " ", "object", " ", "only", " ", "depend", "s", " ", "on", " ", "the", " ", "values", " ", "of", " ", "the", " ", "local", "\\", "10", ";", " ", " ", " ", " ", "parameter", " ", "branch", " ", "and", " ", "is", " ", "independent", " ", "of", " ", "the", " ", "results", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "dependent", " ", "module", "s", ",", " ", "then", " ", "it", " ", "can", " ", "be", " ", "saved", " ", "and", " ", "load", "ed", " ", "from", " ", "cache", "\\", "10", ";", " ", " ", " ", " ", "more", " ", "frequent", "ly", " ", "by", " ", "speci", "fy", "ing", " ", "``", "ignore", "\\u", "dependen", "cies", "=", "Tru", "e", "``)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "persiste", "nt", "`", " ", "is", " ", "Fal", "se", ",", " ", "then", " ", "only", " ", "one", " ", "object", "s", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "name", " ", "ever", " ", "hel", "d", " ", "in", " ", "the", " ", "in", "-", "memory", " ", "cache", " ", "at", " ", "a", " ", "single", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "ignore", "\\u", "module", "`", " ", "is", " ", "Tru", "e", ",", " ", "this", " ", "hold", "s", " ", "acro", "ss", " ", "module", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "other", "wis", "e", ",", " ", "it", " ", "hold", "s", " ", "only", " ", "within", " ", "this", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "disk", "\\u", "writ", "able", "`", " ", "is", " ", "Fal", "se", ",", " ", "then", " ", "only", " ", "the", " ", "internal", " ", "memory", "\\", "10", ";", " ", " ", " ", " ", "cache", " ", "is", " ", "used", ";", " ", "the", " ", "object", " ", "is", " ", "neve", "r", " ", "writt", "en", " ", "to", " ", "disk", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "cache", "Action_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "save", "\"_", ",_", "obj", "\\u", "name_", ",_", "key_", ",_", "ignore", "\\u", "module_", ",_", "ignore", "\\u", "local_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dependencies_", ",_", "disk", "\\u", "writable_", ",_", "persistent_", ",_", "obj_", "=_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "key_", "(_", "self_", ",_", "obj", "\\u", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "module_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "local_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dependencies_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "unique", " ", "string", " ", "represent", "ing", " ", "the", " ", "state", " ", "of", " ", "the", " ", "current", "\\", "10", ";", " ", " ", " ", " ", "process", "ing", " ", "module", " ", "or", " ", "a", " ", "cert", "ain", " ", "object", ".", " ", " ", "Thi", "s", " ", "string", " ", "is", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "deterministic", " ", "hash", " ", "of", " ", "the", " ", "parameter", "s", ",", " ", "possib", "ly", " ", "inclu", "ding", "\\", "10", ";", " ", " ", " ", " ", "dependen", "cies", ",", " ", "for", " ", "the", " ", "process", "ing", " ", "module", ".", " ", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "cache", "Action_", "(_", "\"", "key", "\"_", ",_", "\"\\u\\u", "null", "\\u\\u\"_", "if_", "obj", "\\u", "name_", "is_", "None_", "else_", "obj", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", ",_", "ignore", "\\u", "module_", ",_", "ignore", "\\u", "local_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "dependencies_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Parameters_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "parameter", " ", "tree", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "pno", "de_", "._", "get", "Specifi", "c_", "(_", "\"", "parameter", "s", "\"_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Results_", "(_", "self_", ",_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "results", " ", "from", " ", "r", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "pno", "de_", "._", "get", "Specifi", "c_", "(_", "\"", "results", "\"_", ",_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PM", "odule_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Module_", "(_", "self_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "pno", "de_", "._", "get", "Specifi", "c_", "(_", "\"", "module", "\"_", ",_", "m_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 1, 1, 1, 1, 1, 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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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 ]
Unused import
makaimc/video-service-flask/create_db.py
[ { "content": "from video import db\nfrom video.models import SupportTicket\ndb.create_all()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from video.models import SupportTicket", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "video_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "video_", "._", "models_", "import_", "Supp", "ort", "Ticket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "all_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
divio/django-filer/filer/utils/files.py
[ { "content": "def handle_upload(request):\n if not request.method == \"POST\":\n raise UploadException(\"AJAX request not valid: must be POST\")\n if request.is_ajax():\n # the file is stored raw in the request\n is_raw = True\n filename = request.GET.get('qqfile', False) or request.GET.get('filename', False) or ''\n\n try:\n content_length = int(request.META['CONTENT_LENGTH'])\n except (IndexError, TypeError, ValueError):\n content_length = None\n\n if content_length < 0:\n # This means we shouldn't continue...raise an error.\n raise UploadException(\"Invalid content length: %r\" % content_length)\n\n upload_handlers = request.upload_handlers\n for handler in upload_handlers:\n handler.handle_raw_input(request,\n request.META,\n content_length,\n None,\n None)\n pass\n\n # For compatibility with low-level network APIs (with 32-bit integers),\n # the chunk size should be < 2^31, but still divisible by 4.\n possible_sizes = [x.chunk_size for x in upload_handlers if x.chunk_size]\n chunk_size = min([2 ** 31 - 4] + possible_sizes)\n\n stream = ChunkIter(request, chunk_size)\n counters = [0] * len(upload_handlers)\n\n try:\n for handler in upload_handlers:\n try:\n handler.new_file(None, filename,\n None, content_length, None)\n except StopFutureHandlers:\n break\n\n for chunk in stream:\n for i, handler in enumerate(upload_handlers):\n chunk_length = len(chunk)\n chunk = handler.receive_data_chunk(chunk,\n counters[i])\n counters[i] += chunk_length\n if chunk is None:\n # If the chunk received by the handler is None, then don't continue.\n break\n\n except SkipFile:\n # Just use up the rest of this file...\n exhaust(stream)\n except StopUpload as e:\n if not e.connection_reset:\n exhaust(request)\n else:\n # Make sure that the request data is all fed\n exhaust(request)\n\n # Signal that the upload has completed.\n for handler in upload_handlers:\n retval = handler.upload_complete()\n if retval:\n break\n\n for i, handler in enumerate(upload_handlers):\n file_obj = handler.file_complete(counters[i])\n if file_obj:\n upload = file_obj\n break\n else:\n if len(request.FILES) == 1:\n upload, filename, is_raw = handle_request_files_upload(request)\n else:\n raise UploadException(\"AJAX request not valid: Bad Upload\")\n return upload, filename, is_raw", "metadata": "root.handle_upload", "header": "['module', '___EOS___']", "index": 23 } ]
[ { "span": "pass", "start_line": 47, "start_column": 12, "end_line": 47, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "upload_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Upload", "Exception_", "(_", "\"", "AJ", "AX", " ", "request", " ", "not", " ", "valid", ":", " ", "must", " ", "be", " ", "POST", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "file", " ", "is", " ", "store", "d", " ", "raw", " ", "in", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "raw_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "qq", "file", "'_", ",_", "False_", ")_", "or_", "request_", "._", "GET_", "._", "get_", "(_", "'", "filename", "'_", ",_", "False_", ")_", "or_", "''_", "\\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 ", " _", "content", "\\u", "length_", "=_", "int_", "(_", "request_", "._", "META_", "[_", "'", "CONTE", "NT", "\\u", "LENGTH", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Index", "Error_", ",_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content", "\\u", "length_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "content", "\\u", "length_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "means", " ", "we", " ", "shou", "ld", "n", "'", "t", " ", "continue", "...", "raise", " ", "an", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Upload", "Exception_", "(_", "\"", "Inva", "lid", " ", "content", " ", "length", ":", " ", "%", "r", "\"_", "%_", "content", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "upload", "\\u", "handlers_", "=_", "request_", "._", "upload", "\\u", "handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "handler_", "in_", "upload", "\\u", "handlers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "._", "handle", "\\u", "raw", "\\u", "input_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "META_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "length_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "compatibility", " ", "with", " ", "low", "-", "level", " ", "network", " ", "API", "s", " ", "(", "with", " ", "32", "-", "bit", " ", "integ", "ers", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "chunk", " ", "size", " ", "shou", "ld", " ", "be", " ", "<", " ", "2", "^", "3", "1", ",", " ", "but", " ", "still", " ", "divisi", "ble", " ", "by", " ", "4._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "possib", "le", "\\u", "sizes_", "=_", "[_", "x_", "._", "chunk", "\\u", "size_", "for_", "x_", "in_", "upload", "\\u", "handlers_", "if_", "x_", "._", "chunk", "\\u", "size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk", "\\u", "size_", "=_", "min_", "(_", "[_", "2_", "**_", "31_", "-_", "4_", "]_", "+_", "possib", "le", "\\u", "sizes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stream_", "=_", "Chunk", "Iter_", "(_", "request_", ",_", "chunk", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counters_", "=_", "[_", "0_", "]_", "*_", "len_", "(_", "upload", "\\u", "handlers_", ")_", "\\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 ", " _", "for_", "handler_", "in_", "upload", "\\u", "handlers_", ":_", "\\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 ", " ", "_", "handler_", "._", "new", "\\u", "file_", "(_", "None_", ",_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "content", "\\u", "length_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Fu", "ture", "Handlers_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "chunk_", "in_", "stream_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "handler_", "in_", "enumerate_", "(_", "upload", "\\u", "handlers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "chunk", "\\u", "length_", "=_", "len_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "handler_", "._", "receive", "\\u", "data\\u", "chunk_", "(_", "chunk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "counters_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counters_", "[_", "i_", "]_", "+=_", "chunk", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chunk_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "chunk", " ", "receive", "d", " ", "by", " ", "the", " ", "handler", " ", "is", " ", "Non", "e", ",", " ", "then", " ", "don", "'", "t", " ", "continue", "._", "\\u\\u\\uNL\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ski", "p", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "use", " ", "up", " ", "the", " ", "rest", " ", "of", " ", "this", " ", "file", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exhaust", "_", "(_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Upload_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "e_", "._", "connecti", "on", "\\u", "reset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exhaust", "_", "(_", "request_", ")_", "\\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_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "the", " ", "request", " ", "data", " ", "is", " ", "all", " ", "fed", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exhaust", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Signal", " ", "tha", "t", " ", "the", " ", "upload", " ", "has", " ", "complete", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "handler_", "in_", "upload", "\\u", "handlers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "handler_", "._", "upload", "\\u", "complete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "retval_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "handler_", "in_", "enumerate_", "(_", "upload", "\\u", "handlers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "obj_", "=_", "handler_", "._", "file", "\\u", "complete_", "(_", "counters_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upload_", "=_", "file", "\\u", "obj_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "request_", "._", "FILES_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upload_", ",_", "filename_", ",_", "is", "\\u", "raw_", "=_", "handle", "\\u", "request", "\\u", "files", "\\u", "upload_", "(_", "request_", ")_", "\\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_", "Upload", "Exception_", "(_", "\"", "AJ", "AX", " ", "request", " ", "not", " ", "valid", ":", " ", "Ba", "d", " ", "Upload", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "upload_", ",_", "filename_", ",_", "is", "\\u", "raw_", "\\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, 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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 ]
Unused local variable
rohe/pyoidc/oidc_example/rp2/oidc.py
[ { "content": " def phaseN(self, environ, query, server_env, session):\n \"\"\"Step 2: Once the consumer has redirected the user back to the\n callback URL you can request the access token the user has\n approved.\"\"\"\n\n client = session['client']\n logger.debug(\"info: %s\", query)\n logger.debug(\"keyjar: %s\", client.keyjar)\n\n authresp = client.parse_response(AuthorizationResponse, query,\n sformat=\"dict\", keyjar=client.keyjar)\n\n if isinstance(authresp, ErrorResponse):\n return False, \"Access denied\"\n try:\n client.id_token = authresp[\"id_token\"]\n except:\n pass\n # session.session_id = msg[\"state\"]\n\n logger.debug(\"callback environ: %s\", environ)\n\n if self.flow_type == \"code\":\n # get the access token\n try:\n tokenresp = self.get_accesstoken(client, authresp)\n except Exception as err:\n logger.error(\"%s\", err)\n raise\n\n if isinstance(tokenresp, ErrorResponse):\n return (False, \"Invalid response %s.\" % tokenresp[\"error\"])\n\n access_token = tokenresp[\"access_token\"]\n else:\n access_token = authresp[\"access_token\"]\n\n userinfo = self.verify_token(client, access_token)\n\n inforesp = self.get_userinfo(client, authresp, access_token)\n\n if isinstance(inforesp, ErrorResponse):\n return False, \"Invalid response %s.\" % inforesp[\"error\"], session\n\n tot_info = userinfo.update(inforesp.to_dict())\n\n logger.debug(\"UserInfo: %s\", inforesp)\n\n return True, userinfo, access_token, client", "metadata": "root.OpenIDConnect.phaseN", "header": "['class', 'OpenIDConnect', '(', 'object', ')', ':', '___EOS___']", "index": 257 } ]
[ { "span": "tot_info ", "start_line": 301, "start_column": 8, "end_line": 301, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Open", "ID", "Connect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "phase", "N_", "(_", "self_", ",_", "environ_", ",_", "query_", ",_", "server", "\\u", "env_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Step", " ", "2", ":", " ", "On", "ce", " ", "the", " ", "consume", "r", " ", "has", " ", "redirected", " ", "the", " ", "user", " ", "back", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "callback", " ", "URL", " ", "you", " ", "can", " ", "request", " ", "the", " ", "access", " ", "token", " ", "the", " ", "user", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "approved", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "session_", "[_", "'", "client", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "info", ":", " ", "%", "s", "\"_", ",_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "key", "jar", ":", " ", "%", "s", "\"_", ",_", "client_", "._", "key", "jar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "resp_", "=_", "client_", "._", "parse", "\\u", "response_", "(_", "Authoriz", "ation", "Response_", ",_", "query_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sfo", "rmat", "_", "=_", "\"", "dict", "\"_", ",_", "key", "jar_", "=_", "client_", "._", "key", "jar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "auth", "resp_", ",_", "Error", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", ",_", "\"", "Access", " ", "deni", "ed", "\"_", "\\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 ", " _", "client_", "._", "id", "\\u", "token_", "=_", "auth", "resp_", "[_", "\"", "id", "\\u", "token", "\"_", "]_", "\\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_", "#", " ", "session", ".", "session", "\\u", "id", " ", "=", " ", "msg", "[\"", "state", "\"]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "callback", " ", "environ", ":", " ", "%", "s", "\"_", ",_", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "flow", "\\u", "type_", "==_", "\"", "code", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "access", " ", "token_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token", "resp_", "=_", "self_", "._", "get", "\\u", "access", "token_", "(_", "client_", ",_", "auth", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"%", "s", "\"_", ",_", "err_", ")_", "\\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_", "if_", "isinstance_", "(_", "token", "resp_", ",_", "Error", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "False_", ",_", "\"", "Inva", "lid", " ", "response", " ", "%", "s", ".\"_", "%_", "token", "resp_", "[_", "\"", "error", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "access", "\\u", "token_", "=_", "token", "resp_", "[_", "\"", "access", "\\u", "token", "\"_", "]_", "\\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 ", " _", "access", "\\u", "token_", "=_", "auth", "resp_", "[_", "\"", "access", "\\u", "token", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "userinfo_", "=_", "self_", "._", "verify", "\\u", "token_", "(_", "client_", ",_", "access", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info", "resp_", "=_", "self_", "._", "get", "\\u", "userinfo_", "(_", "client_", ",_", "auth", "resp_", ",_", "access", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "info", "resp_", ",_", "Error", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", ",_", "\"", "Inva", "lid", " ", "response", " ", "%", "s", ".\"_", "%_", "info", "resp_", "[_", "\"", "error", "\"_", "]_", ",_", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tot", "\\u", "info_", "=_", "userinfo_", "._", "update_", "(_", "info", "resp_", "._", "to", "\\u", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "User", "Info", ":", " ", "%", "s", "\"_", ",_", "info", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "True_", ",_", "userinfo_", ",_", "access", "\\u", "token_", ",_", "client_", "\\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 ]
Unreachable code
rizar/attention-lvcsr/libs/Theano/theano/tensor/tests/test_subtensor.py
[ { "content": " def test_advanced1_inc_and_set(self):\n \"\"\"\n Test advanced increment and set.\n \"\"\"\n rng = numpy.random.RandomState(seed=utt.fetch_seed())\n all_inputs_var = []\n all_inputs_num = []\n all_outputs_var = []\n all_outputs_num = []\n for set_instead_of_inc in (False, True):\n for inplace in (False, True):\n for data_shape in ((10,), (4, 5), (1, 2, 3), (4, 5, 6, 7)):\n data_n_dims = len(data_shape)\n data_size = numpy.product(data_shape)\n # Corresponding numeric variable.\n data_num_init = numpy.arange(data_size, dtype=self.dtype)\n data_num_init = data_num_init.reshape(data_shape)\n inc_shapes = [data_shape[i:]\n for i in xrange(0, len(data_shape) + 1)]\n # Test broadcasting of y.\n inc_shapes += [(1,) + inc_shapes[-1][1:]]\n for inc_shape in inc_shapes:\n inc_n_dims = len(inc_shape)\n # We copy the numeric value to be 100% sure there is no\n # risk of accidentally sharing it.\n data_num = data_num_init.copy()\n # Symbolic variable to be incremented.\n # We create a new one every time in order not to\n # have duplicated variables in the function's inputs\n data_var = self.type(\n broadcastable=[False] * data_n_dims,\n dtype=self.dtype)()\n # Symbolic variable with rows to be incremented.\n idx_var = theano.tensor.vector(dtype='int64')\n n_to_inc = rng.randint(data_shape[0])\n if (n_to_inc == 1 and\n len(inc_shape) > 0 and\n inc_shape[0] == 1 and\n data_shape[0] > 1):\n n_to_inc = 2\n # Corresponding numeric variable.\n idx_num = rng.randint(0, data_shape[0], n_to_inc)\n idx_num = idx_num.astype('int64')\n # Symbolic variable with increment value.\n inc_var = self.type(\n broadcastable=[False] * inc_n_dims,\n dtype=self.dtype)()\n # Trick for the case where `inc_shape` is the same as\n # `data_shape`: what we actually want is the first\n # shape element to be equal to the number of rows to\n # increment.\n if len(inc_shape) == len(data_shape) and (\n len(inc_shapes) == 0 or inc_shape[0] != 1):\n inc_shape = (n_to_inc,) + inc_shape[1:]\n # The param dtype is needed when inc_shape is empty.\n # By default, it would return a float and rng.uniform\n # with NumPy 1.10 will raise a Deprecation warning.\n inc_size = numpy.product(inc_shape, dtype='int')\n # Corresponding numeric variable.\n inc_num = rng.uniform(size=inc_size).astype(self.dtype)\n inc_num = inc_num.reshape(inc_shape)\n # Result of the incrementation.\n # (i) Theano\n if set_instead_of_inc:\n op = set_subtensor\n else:\n op = inc_subtensor\n output = op(data_var[idx_var], inc_var,\n inplace=inplace)\n # (ii) Numpy (note that Numpy increments only once\n # duplicated indices, so we cannot directly use +=).\n data_copy = data_num.copy()\n for j, idx in enumerate(idx_num):\n if len(inc_shape) == len(data_shape):\n if inc_shape[0] == 1:\n # Allow broadcasting of y[0]\n inc_num0 = inc_num[0]\n if set_instead_of_inc:\n data_copy[idx] = inc_num0\n else:\n data_copy[idx] += inc_num0\n else:\n # Special case where there is no broadcasting.\n if set_instead_of_inc:\n data_copy[idx] = inc_num[j]\n else:\n data_copy[idx] += inc_num[j]\n else:\n if set_instead_of_inc:\n data_copy[idx] = inc_num\n else:\n data_copy[idx] += inc_num\n data_var = theano.In(data_var, mutable=True)\n\n # Remember data for the Theano function (see below).\n all_inputs_var += [data_var, idx_var, inc_var]\n all_inputs_num += [data_num, idx_num, inc_num]\n all_outputs_var.append(output)\n all_outputs_num.append(data_copy)\n if False: # Enable for debugging purpose.\n f = self.function([data_var, idx_var, inc_var],\n output, accept_inplace=inplace,\n op=self.adv_incsub1)\n if inplace:\n # Ensure calling `f` will not alter `data_num`.\n data_num = data_num.copy()\n f_out = f(data_num.copy(), idx_num, inc_num)\n assert numpy.allclose(f_out, data_copy)\n if not inplace:\n # Sanity check: `data_num` should be intact.\n assert (data_num == data_num_init).all()\n\n # Actual test (we compile a single Theano function to make it faster).\n orig_warn = theano.config.warn.gpu_set_subtensor1\n try:\n theano.config.warn.gpu_set_subtensor1 = False\n f = self.function(all_inputs_var, all_outputs_var,\n accept_inplace=True,\n op=self.adv_incsub1,\n N=len(all_outputs_var))\n finally:\n theano.config.warn.gpu_set_subtensor1 = orig_warn\n\n f_outs = f(*all_inputs_num)\n assert len(f_outs) == len(all_outputs_num)\n for f_out, output_num in izip(f_outs, all_outputs_num):\n # NB: if this assert fails, it will probably be easier to debug if\n # you enable the debug code above.\n assert numpy.allclose(f_out, output_num)", "metadata": "root.T_subtensor.test_advanced1_inc_and_set", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 921 } ]
[ { "span": "f = self.function([data_var, idx_var, inc_var],\n output, accept_inplace=inplace,\n op=self.adv_incsub1)", "start_line": 1021, "start_column": 28, "end_line": 1023, "end_column": 66 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "advanced", "1", "\\u", "inc", "\\u", "and", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "advanced", " ", "increment", " ", "and", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rng_", "=_", "numpy_", "._", "random_", "._", "Random", "State_", "(_", "seed_", "=_", "utt", "_", "._", "fetch", "\\u", "seed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "inputs", "\\u", "var_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "inputs", "\\u", "num_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "output", "s", "\\u", "var_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "output", "s", "\\u", "num_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "set\\u", "inst", "ead", "\\u", "of", "\\u", "inc_", "in_", "(_", "False_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "inplace_", "in_", "(_", "False_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "data\\u", "shape_", "in_", "(_", "(_", "10_", ",_", ")_", ",_", "(_", "4_", ",_", "5_", ")_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ",_", "(_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data\\u", "n", "\\u", "dims_", "=_", "len_", "(_", "data\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "size_", "=_", "numpy_", "._", "product_", "(_", "data\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Corre", "spon", "ding", " ", "numeri", "c", " ", "variab", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "num", "\\u", "init_", "=_", "numpy_", "._", "arange_", "(_", "data\\u", "size_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "num", "\\u", "init_", "=_", "data\\u", "num", "\\u", "init_", "._", "reshape_", "(_", "data\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inc", "\\u", "shapes_", "=_", "[_", "data\\u", "shape_", "[_", "i_", ":_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "len_", "(_", "data\\u", "shape_", ")_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "broadcast", "ing", " ", "of", " ", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "inc", "\\u", "shapes_", "+=_", "[_", "(_", "1_", ",_", ")_", "+_", "inc", "\\u", "shapes_", "[_", "-_", "1_", "]_", "[_", "1_", ":_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "inc", "\\u", "shape_", "in_", "inc", "\\u", "shapes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inc", "\\u", "n", "\\u", "dims_", "=_", "len_", "(_", "inc", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "copy", " ", "the", " ", "numeri", "c", " ", "value", " ", "to", " ", "be", " ", "100", "%", " ", "sure", " ", "there", " ", "is", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "risk", " ", "of", " ", "accident", "ally", " ", "shar", "ing", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "num_", "=_", "data\\u", "num", "\\u", "init_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Symboli", "c", " ", "variab", "le", " ", "to", " ", "be", " ", "increment", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "create", " ", "a", " ", "new", " ", "one", " ", "every", " ", "time", " ", "in", " ", "order", " ", "not", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "duplicated", " ", "variab", "les", " ", "in", " ", "the", " ", "function", "'", "s", " ", "inputs_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "var_", "=_", "self_", "._", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "broadcast", "able_", "=_", "[_", "False_", "]_", "*_", "data\\u", "n", "\\u", "dims_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Symboli", "c", " ", "variab", "le", " ", "with", " ", "rows", " ", "to", " ", "be", " ", "increment", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "idx", "\\u", "var_", "=_", "theano_", "._", "tensor_", "._", "vector_", "(_", "dtype_", "=_", "'", "int", "64", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "to", "\\u", "inc_", "=_", "rng_", "._", "randint_", "(_", "data\\u", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "n", "\\u", "to", "\\u", "inc_", "==_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "inc", "\\u", "shape_", ")_", ">_", "0_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "inc", "\\u", "shape_", "[_", "0_", "]_", "==_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "shape_", "[_", "0_", "]_", ">_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "n", "\\u", "to", "\\u", "inc_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Corre", "spon", "ding", " ", "numeri", "c", " ", "variab", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "idx", "\\u", "num_", "=_", "rng_", "._", "randint_", "(_", "0_", ",_", "data\\u", "shape_", "[_", "0_", "]_", ",_", "n", "\\u", "to", "\\u", "inc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx", "\\u", "num_", "=_", "idx", "\\u", "num_", "._", "astype_", "(_", "'", "int", "64", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Symboli", "c", " ", "variab", "le", " ", "with", " ", "increment", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "inc", "\\u", "var_", "=_", "self_", "._", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "broadcast", "able_", "=_", "[_", "False_", "]_", "*_", "inc", "\\u", "n", "\\u", "dims_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tri", "ck", " ", "for", " ", "the", " ", "case", " ", "where", " ", "`", "inc", "\\u", "shape", "`", " ", "is", " ", "the", " ", "same", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`", "data\\u", "shape", "`", ":", " ", "what", " ", "we", " ", "actual", "ly", " ", "want", " ", "is", " ", "the", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shape", " ", "element", " ", "to", " ", "be", " ", "equal", " ", "to", " ", "the", " ", "number", " ", "of", " ", "rows", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "increment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "inc", "\\u", "shape_", ")_", "==_", "len_", "(_", "data\\u", "shape_", ")_", "and_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "inc", "\\u", "shapes_", ")_", "==_", "0_", "or_", "inc", "\\u", "shape_", "[_", "0_", "]_", "!=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inc", "\\u", "shape_", "=_", "(_", "n", "\\u", "to", "\\u", "inc_", ",_", ")_", "+_", "inc", "\\u", "shape_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "param", " ", "dt", "ype", " ", "is", " ", "need", "ed", " ", "whe", "n", " ", "inc", "\\u", "shape", " ", "is", " ", "empty", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "default", ",", " ", "it", " ", "wou", "ld", " ", "return", " ", "a", " ", "float", " ", "and", " ", "rng", ".", "uniform_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "Num", "Py", " ", "1.1", "0", " ", "will", " ", "raise", " ", "a", " ", "Dep", "reca", "tion", " ", "warn", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inc", "\\u", "size_", "=_", "numpy_", "._", "product_", "(_", "inc", "\\u", "shape_", ",_", "dtype_", "=_", "'", "int", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Corre", "spon", "ding", " ", "numeri", "c", " ", "variab", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "inc", "\\u", "num_", "=_", "rng_", "._", "uniform_", "(_", "size_", "=_", "inc", "\\u", "size_", ")_", "._", "astype_", "(_", "self_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inc", "\\u", "num_", "=_", "inc", "\\u", "num_", "._", "reshape_", "(_", "inc", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Result", " ", "of", " ", "the", " ", "increment", "ation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "i", ")", " ", "The", "ano", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "set\\u", "inst", "ead", "\\u", "of", "\\u", "inc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "op_", "=_", "set\\u", "subt", "ens", "or_", "\\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 ", " ", " _", "op_", "=_", "inc", "\\u", "subt", "ens", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "op_", "(_", "data\\u", "var_", "[_", "idx", "\\u", "var_", "]_", ",_", "inc", "\\u", "var_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inplace_", "=_", "inplace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "(", "ii", ")", " ", "Num", "py", " ", "(", "note", " ", "tha", "t", " ", "Num", "py", " ", "increment", "s", " ", "only", " ", "once_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "duplicated", " ", "indice", "s", ",", " ", "so", " ", "we", " ", "cann", "ot", " ", "direct", "ly", " ", "use", " ", "+=", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "copy_", "=_", "data\\u", "num_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", ",_", "idx_", "in_", "enumerate_", "(_", "idx", "\\u", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "inc", "\\u", "shape_", ")_", "==_", "len_", "(_", "data\\u", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "inc", "\\u", "shape_", "[_", "0_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", "ow", " ", "broadcast", "ing", " ", "of", " ", "y", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inc", "\\u", "num", "0_", "=_", "inc", "\\u", "num_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "set\\u", "inst", "ead", "\\u", "of", "\\u", "inc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "data\\u", "copy_", "[_", "idx_", "]_", "=_", "inc", "\\u", "num", "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 ", " ", " ", " _", "data\\u", "copy_", "[_", "idx_", "]_", "+=_", "inc", "\\u", "num", "0_", "\\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_", "#", " ", "Special", " ", "case", " ", "where", " ", "there", " ", "is", " ", "no", " ", "broadcast", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "set\\u", "inst", "ead", "\\u", "of", "\\u", "inc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "data\\u", "copy_", "[_", "idx_", "]_", "=_", "inc", "\\u", "num_", "[_", "j_", "]_", "\\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", "copy_", "[_", "idx_", "]_", "+=_", "inc", "\\u", "num_", "[_", "j_", "]_", "\\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 ", " ", " _", "if_", "set\\u", "inst", "ead", "\\u", "of", "\\u", "inc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data\\u", "copy_", "[_", "idx_", "]_", "=_", "inc", "\\u", "num_", "\\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", "copy_", "[_", "idx_", "]_", "+=_", "inc", "\\u", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data\\u", "var_", "=_", "theano_", "._", "In_", "(_", "data\\u", "var_", ",_", "mutable", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reme", "mber", " ", "data", " ", "for", " ", "the", " ", "The", "ano", " ", "function", " ", "(", "see", " ", "belo", "w", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "inputs", "\\u", "var_", "+=_", "[_", "data\\u", "var_", ",_", "idx", "\\u", "var_", ",_", "inc", "\\u", "var_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "inputs", "\\u", "num_", "+=_", "[_", "data\\u", "num_", ",_", "idx", "\\u", "num_", ",_", "inc", "\\u", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "output", "s", "\\u", "var_", "._", "append_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "output", "s", "\\u", "num_", "._", "append_", "(_", "data\\u", "copy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "False_", ":_", "#", " ", "Enable", " ", "for", " ", "debugg", "ing", " ", "purpose", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "=_", "self_", "._", "function_", "(_", "[_", "data\\u", "var_", ",_", "idx", "\\u", "var_", ",_", "inc", "\\u", "var_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output_", ",_", "accept", "\\u", "inplace_", "=_", "inplace_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "=_", "self_", "._", "adv", "\\u", "inc", "sub", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "inplace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "calling", " ", "`", "f", "`", " ", "will", " ", "not", " ", "alter", " ", "`", "data\\u", "num", "`.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data\\u", "num_", "=_", "data\\u", "num_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "out_", "=_", "f_", "(_", "data\\u", "num_", "._", "copy_", "(_", ")_", ",_", "idx", "\\u", "num_", ",_", "inc", "\\u", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "numpy_", "._", "allclose_", "(_", "f", "\\u", "out_", ",_", "data\\u", "copy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "inplace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sanit", "y", " ", "check", ":", " ", "`", "data\\u", "num", "`", " ", "shou", "ld", " ", "be", " ", "inta", "ct", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "assert_", "(_", "data\\u", "num_", "==_", "data\\u", "num", "\\u", "init_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Actual", " ", "test", " ", "(", "we", " ", "compile", " ", "a", " ", "single", " ", "The", "ano", " ", "function", " ", "to", " ", "make", " ", "it", " ", "faste", "r", ").", "_", "\\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_", "orig", "\\u", "warn_", "=_", "theano_", "._", "config_", "._", "warn_", "._", "gpu", "\\u", "set\\u", "subt", "ens", "or", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "theano_", "._", "config_", "._", "warn_", "._", "gpu", "\\u", "set\\u", "subt", "ens", "or", "1_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "self_", "._", "function_", "(_", "all", "\\u", "inputs", "\\u", "var_", ",_", "all", "\\u", "output", "s", "\\u", "var_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "accept", "\\u", "inplace_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "=_", "self_", "._", "adv", "\\u", "inc", "sub", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "N_", "=_", "len_", "(_", "all", "\\u", "output", "s", "\\u", "var_", ")_", ")_", "\\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 ", " _", "theano_", "._", "config_", "._", "warn_", "._", "gpu", "\\u", "set\\u", "subt", "ens", "or", "1_", "=_", "orig", "\\u", "warn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "outs_", "=_", "f_", "(_", "*_", "all", "\\u", "inputs", "\\u", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "f", "\\u", "outs_", ")_", "==_", "len_", "(_", "all", "\\u", "output", "s", "\\u", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f", "\\u", "out_", ",_", "output", "\\u", "num_", "in_", "izip_", "(_", "f", "\\u", "outs_", ",_", "all", "\\u", "output", "s", "\\u", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NB", ":", " ", "if", " ", "this", " ", "assert", " ", "fail", "s", ",", " ", "it", " ", "will", " ", "probab", "ly", " ", "be", " ", "easi", "er", " ", "to", " ", "debug", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "enable", " ", "the", " ", "debug", " ", "code", " ", "above", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "numpy_", "._", "allclose_", "(_", "f", "\\u", "out_", ",_", "output", "\\u", "num_", ")_", "\\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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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 ]
Unused import
FinalTheory/wireless-network-reproduction/macdivert/models.py
[ { "content": "# encoding: utf8\n\nfrom socket import ntohs\nfrom ctypes import (c_uint, c_void_p, c_uint32, c_char_p, ARRAY, c_uint64, c_int32, c_uint16, c_int,\n c_uint8, c_ulong, c_char, c_ubyte, Structure, c_size_t, c_ssize_t)\nfrom enum import Defaults\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def format_structure(instance):\n \"\"\"\n Returns a string representation for the structure\n \"\"\"\n if hasattr(instance, \"_fields_\"):\n out = []\n for field in instance._fields_:\n out.append(\"[%s: %s]\" % (field[0], getattr(instance, field[0], None)))\n return \"\".join(out)\n else:\n raise ValueError(\"Passed argument is not a structure!\")", "metadata": "root.format_structure", "header": "['module', '___EOS___']", "index": 8 }, { "content": "class PacketHeader(Structure):\n \"\"\"\n typedef struct {\n struct ip *ip_hdr;\n struct tcphdr *tcp_hdr;\n struct udphdr *udp_hdr;\n u_char *payload;\n size_t size_ip;\n size_t size_tcp;\n size_t size_udp;\n size_t size_payload;\n } packet_hdrs_t;\n \"\"\"\n _fields_ = [\n (\"ip_hdr\", c_void_p),\n (\"tcp_hdr\", c_void_p),\n (\"udp_hdr\", c_void_p),\n (\"payload\", c_char_p),\n (\"size_ip\", c_ulong),\n (\"size_tcp\", c_ulong),\n (\"size_udp\", c_ulong),\n (\"size_payload\", c_ulong),\n ]", "metadata": "root.PacketHeader", "header": "['module', '___EOS___']", "index": 21 }, { "content": "class IpHeader(Structure):\n \"\"\"\n Ctypes structure for IPv4 header definition.\n struct ip {\n u_char\tip_vhl;\t\t\t/* version << 4 | header length >> 2 */\n u_char\tip_tos;\t\t\t/* type of service */\n u_short\tip_len;\t\t\t/* total length */\n u_short\tip_id;\t\t\t/* identification */\n u_short\tip_off;\t\t\t/* fragment offset field */\n u_char\tip_ttl;\t\t\t/* time to live */\n u_char\tip_p;\t\t\t/* protocol */\n u_short\tip_sum;\t\t\t/* checksum */\n struct\tin_addr ip_src,ip_dst;\t/* source and dest address */\n };\n \"\"\"\n _fields_ = [\n (\"ip_vhl\", c_uint8),\n (\"ip_tos\", c_uint8),\n (\"ip_len\", c_uint16),\n (\"ip_id\", c_uint16),\n (\"ip_off\", c_uint16),\n (\"ip_ttl\", c_uint8),\n (\"ip_p\", c_uint8),\n (\"ip_sum\", c_uint16),\n (\"ip_src\", c_uint32),\n (\"ip_dst\", c_uint32),\n ]\n\n\n", "metadata": "root.IpHeader", "header": "['module', '___EOS___']", "index": 46 }, { "content": " def get_total_length(self):\n return ntohs(self.ip_len)", "metadata": "root.IpHeader.get_total_length", "header": "['class', 'IpHeader', '(', 'Structure', ')', ':', '___EOS___']", "index": 74 }, { "content": " def get_header_length(self):\n return (self.ip_vhl & 0x0f) * 4", "metadata": "root.IpHeader.get_header_length", "header": "['class', 'IpHeader', '(', 'Structure', ')', ':', '___EOS___']", "index": 77 }, { "content": " def __str__(self):\n return format_structure(self)", "metadata": "root.IpHeader.__str__", "header": "['class', 'IpHeader', '(', 'Structure', ')', ':', '___EOS___']", "index": 80 }, { "content": "class ProcInfo(Structure):\n \"\"\"\n typedef struct {\n pid_t pid;\n pid_t epid;\n char comm[MAX_COMM_LEN];\n } proc_info_t;\n \"\"\"\n MAXCOMLEN = 32\n _fields_ = [\n (\"pid\", c_int32),\n (\"epid\", c_int32),\n (\"comm\", c_char * MAXCOMLEN),\n ]\n", "metadata": "root.ProcInfo", "header": "['module', '___EOS___']", "index": 84 }, { "content": " def __str__(self):\n return format_structure(self)", "metadata": "root.ProcInfo.__str__", "header": "['class', 'ProcInfo', '(', 'Structure', ')', ':', '___EOS___']", "index": 99 }, { "content": "class DivertHandleRaw(Structure):\n \"\"\"\n typedef struct {\n u_int32_t flags;\n int divert_fd;\n int kext_fd;\n int ipfw_id;\n int divert_port;\n int pipe_fd[2];\n int exit_fd[2];\n u_char *divert_buffer;\n size_t bufsize;\n packet_buf_t *thread_buffer;\n size_t thread_buffer_size;\n u_int64_t num_unknown;\n u_int64_t num_diverted;\n divert_error_handler_t err_handler;\n divert_callback_t callback;\n void *callback_args;\n volatile u_char is_looping;\n char *ipfw_filter;\n char errmsg[DIVERT_ERRBUF_SIZE];\n } divert_t;\n \"\"\"\n _fields_ = [\n (\"flags\", c_uint32),\n (\"divert_fd\", c_int),\n (\"kext_fd\", c_int),\n (\"ipfw_id\", c_int),\n (\"divert_port\", c_int),\n (\"pipe_fd\", c_int * 2),\n (\"exit_fd\", c_int * 2),\n (\"divert_buffer\", c_char_p),\n (\"bufsize\", c_size_t),\n (\"thread_buffer\", c_void_p),\n (\"thread_buffer_size\", c_size_t),\n (\"num_unknown\", c_uint64),\n (\"num_diverted\", c_uint64),\n (\"err_handler\", c_void_p),\n (\"callback\", c_void_p),\n (\"callback_args\", c_void_p),\n (\"is_looping\", c_ubyte),\n (\"ipfw_filter\", c_char_p),\n (\"errmsg\", c_char * Defaults.DIVERT_ERRBUF_SIZE)\n ]\n", "metadata": "root.DivertHandleRaw", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def __str__(self):\n return format_structure(self)", "metadata": "root.DivertHandleRaw.__str__", "header": "['class', 'DivertHandleRaw', '(', 'Structure', ')', ':', '___EOS___']", "index": 149 } ]
[ { "span": "from ctypes import (c_uint, c_void_p, c_uint32, c_char_p, ARRAY, c_uint64, c_int32, c_uint16, c_int,\n c_uint8, c_ulong, c_char, c_ubyte, Structure, c_size_t, c_ssize_t)", "start_line": 3, "start_column": 0, "end_line": 4, "end_column": 86 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "socket_", "import_", "nto", "hs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ctypes_", "import_", "(_", "c\\u", "uint_", ",_", "c\\u", "voi", "d\\u", "p_", ",_", "c\\u", "uint32_", ",_", "c\\u", "char", "\\u", "p_", ",_", "ARRAY_", ",_", "c\\u", "uint64_", ",_", "c\\u", "int32_", ",_", "c\\u", "uint16_", ",_", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "uint8_", ",_", "c\\u", "ulong_", ",_", "c\\u", "char_", ",_", "c\\u", "ubyte_", ",_", "Structure_", ",_", "c\\u", "size", "\\u", "t_", ",_", "c\\u", "ssi", "ze", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "enum_", "import_", "Defaults_", "\\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\\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_", "format\\u", "structure_", "(_", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "string", " ", "represent", "ation", " ", "for", " ", "the", " ", "structure", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "instance_", ",_", "\"\\u", "fields", "\\u\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "instance_", "._", "\\u", "fields\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "\"[", "%", "s", ":", " ", "%", "s", "]\"_", "%_", "(_", "field_", "[_", "0_", "]_", ",_", "getattr_", "(_", "instance_", ",_", "field_", "[_", "0_", "]_", ",_", "None_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\"_", "._", "join_", "(_", "out_", ")_", "\\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_", "Value", "Error_", "(_", "\"", "Passe", "d", " ", "argu", "ment", " ", "is", " ", "not", " ", "a", " ", "structure", "!\"_", ")_", "\\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_", "Packe", "t", "Header_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "typedef", " ", "struct", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "struct", " ", "ip", " ", "*", "ip", "\\u", "hdr", ";", "\\", "10", ";", " ", " ", " ", " ", "struct", " ", "tcp", "hdr", " ", "*", "tcp", "\\u", "hdr", ";", "\\", "10", ";", " ", " ", " ", " ", "struct", " ", "ud", "ph", "dr", " ", "*", "ud", "p", "\\u", "hdr", ";", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "char", " ", "*", "payload", ";", "\\", "10", ";", " ", " ", " ", " ", "size", "\\u", "t", " ", "size", "\\u", "ip", ";", "\\", "10", ";", " ", " ", " ", " ", "size", "\\u", "t", " ", "size", "\\u", "tcp", ";", "\\", "10", ";", " ", " ", " ", " ", "size", "\\u", "t", " ", "size", "\\u", "ud", "p", ";", "\\", "10", ";", " ", " ", " ", " ", "size", "\\u", "t", " ", "size", "\\u", "payload", ";", "\\", "10", ";", " ", " ", " ", " ", "}", " ", "packet", "\\u", "hdr", "s", "\\u", "t", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "fields\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "hdr", "\"_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "tcp", "\\u", "hdr", "\"_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ud", "p", "\\u", "hdr", "\"_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "payload", "\"_", ",_", "c\\u", "char", "\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "size", "\\u", "ip", "\"_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "size", "\\u", "tcp", "\"_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "size", "\\u", "ud", "p", "\"_", ",_", "c\\u", "ulong_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "size", "\\u", "payload", "\"_", ",_", "c\\u", "ulong_", ")_", ",_", "\\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_", "Ip", "Header_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ct", "ype", "s", " ", "structure", " ", "for", " ", "IP", "v", "4", " ", "header", " ", "definit", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "struct", " ", "ip", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "char", "\t", "ip", "\\u", "vh", "l", ";", "\t\t\t", "/*", " ", "version", " ", "<<", " ", "4", " ", "|", " ", "header", " ", "length", " ", ">>", " ", "2", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "char", "\t", "ip", "\\u", "tos", ";", "\t\t\t", "/*", " ", "type", " ", "of", " ", "service", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "short", "\t", "ip", "\\u", "len", ";", "\t\t\t", "/*", " ", "total", " ", "length", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "short", "\t", "ip", "\\u", "id", ";", "\t\t\t", "/*", " ", "identifica", "tion", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "short", "\t", "ip", "\\u", "off", ";", "\t\t\t", "/*", " ", "fragment", " ", "offset", " ", "field", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "char", "\t", "ip", "\\u", "ttl", ";", "\t\t\t", "/*", " ", "time", " ", "to", " ", "live", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "char", "\t", "ip", "\\u", "p", ";", "\t\t\t", "/*", " ", "protoc", "ol", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "short", "\t", "ip", "\\u", "sum", ";", "\t\t\t", "/*", " ", "checks", "um", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "struct", "\t", "in", "\\u", "addr", " ", "ip", "\\u", "src", ",", "ip", "\\u", "dst", ";", "\t", "/*", " ", "source", " ", "and", " ", "dest", " ", "address", " ", "*/", "\\", "10", ";", " ", " ", " ", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "fields\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "vh", "l", "\"_", ",_", "c\\u", "uint8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "tos", "\"_", ",_", "c\\u", "uint8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "len", "\"_", ",_", "c\\u", "uint16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "id", "\"_", ",_", "c\\u", "uint16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "off", "\"_", ",_", "c\\u", "uint16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "ttl", "\"_", ",_", "c\\u", "uint8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "p", "\"_", ",_", "c\\u", "uint8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "sum", "\"_", ",_", "c\\u", "uint16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "src", "\"_", ",_", "c\\u", "uint32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "\\u", "dst", "\"_", ",_", "c\\u", "uint32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Ip", "Header_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "total", "\\u", "length_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "nto", "hs_", "(_", "self_", "._", "ip", "\\u", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ip", "Header_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "header", "\\u", "length_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "ip", "\\u", "vh", "l_", "&_", "0x0f", "_", ")_", "*_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ip", "Header_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "format\\u", "structure_", "(_", "self_", ")_", "\\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_", "Proc", "Info_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "typedef", " ", "struct", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "pid", "\\u", "t", " ", "pid", ";", "\\", "10", ";", " ", " ", " ", " ", "pid", "\\u", "t", " ", "epi", "d", ";", "\\", "10", ";", " ", " ", " ", " ", "char", " ", "comm", "[", "MAX", "\\u", "COMM", "\\u", "LEN", "];", "\\", "10", ";", " ", " ", " ", " ", "}", " ", "proc", "\\u", "info", "\\u", "t", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "COM", "LEN_", "=_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "fields\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "pid", "\"_", ",_", "c\\u", "int32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "epi", "d", "\"_", ",_", "c\\u", "int32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "comm", "\"_", ",_", "c\\u", "char_", "*_", "MAX", "COM", "LEN_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Proc", "Info_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "format\\u", "structure_", "(_", "self_", ")_", "\\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_", "Dive", "rt", "Handle", "Raw_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", "typedef", " ", "struct", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "int", "32", "\\u", "t", " ", "flags", ";", "\\", "10", ";", " ", " ", " ", " ", "int", " ", "dive", "rt", "\\u", "fd", ";", "\\", "10", ";", " ", " ", " ", " ", "int", " ", "ke", "xt\\u", "fd", ";", "\\", "10", ";", " ", " ", " ", " ", "int", " ", "ip", "fw", "\\u", "id", ";", "\\", "10", ";", " ", " ", " ", " ", "int", " ", "dive", "rt", "\\u", "port", ";", "\\", "10", ";", " ", " ", " ", " ", "int", " ", "pipe", "\\u", "fd", "[", "2", "];", "\\", "10", ";", " ", " ", " ", " ", "int", " ", "exit", "\\u", "fd", "[", "2", "];", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "char", " ", "*", "dive", "rt", "\\u", "buffer", ";", "\\", "10", ";", " ", " ", " ", " ", "size", "\\u", "t", " ", "buf", "size", ";", "\\", "10", ";", " ", " ", " ", " ", "packet", "\\u", "buf", "\\u", "t", " ", "*", "thread", "\\u", "buffer", ";", "\\", "10", ";", " ", " ", " ", " ", "size", "\\u", "t", " ", "thread", "\\u", "buffer", "\\u", "size", ";", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "int", "64", "\\u", "t", " ", "num", "\\u", "unknown", ";", "\\", "10", ";", " ", " ", " ", " ", "u\\u", "int", "64", "\\u", "t", " ", "num", "\\u", "dive", "rted", ";", "\\", "10", ";", " ", " ", " ", " ", "dive", "rt", "\\u", "error", "\\u", "handler", "\\u", "t", " ", "err", "\\u", "handler", ";", "\\", "10", ";", " ", " ", " ", " ", "dive", "rt", "\\u", "callback", "\\u", "t", " ", "callback", ";", "\\", "10", ";", " ", " ", " ", " ", "voi", "d", " ", "*", "callback", "\\u", "args", ";", "\\", "10", ";", " ", " ", " ", " ", "volatile", " ", "u\\u", "char", " ", "is", "\\u", "looping", ";", "\\", "10", ";", " ", " ", " ", " ", "char", " ", "*", "ip", "fw", "\\u", "filter", ";", "\\", "10", ";", " ", " ", " ", " ", "char", " ", "err", "msg", "[", "DIV", "ERT", "\\u", "ERR", "BUF", "\\u", "SIZE", "];", "\\", "10", ";", " ", " ", " ", " ", "}", " ", "dive", "rt", "\\u", "t", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "fields\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "flags", "\"_", ",_", "c\\u", "uint32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "dive", "rt", "\\u", "fd", "\"_", ",_", "c\\u", "int_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ke", "xt\\u", "fd", "\"_", ",_", "c\\u", "int_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "fw", "\\u", "id", "\"_", ",_", "c\\u", "int_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "dive", "rt", "\\u", "port", "\"_", ",_", "c\\u", "int_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "pipe", "\\u", "fd", "\"_", ",_", "c\\u", "int_", "*_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "exit", "\\u", "fd", "\"_", ",_", "c\\u", "int_", "*_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "dive", "rt", "\\u", "buffer", "\"_", ",_", "c\\u", "char", "\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "buf", "size", "\"_", ",_", "c\\u", "size", "\\u", "t_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "thread", "\\u", "buffer", "\"_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "thread", "\\u", "buffer", "\\u", "size", "\"_", ",_", "c\\u", "size", "\\u", "t_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "num", "\\u", "unknown", "\"_", ",_", "c\\u", "uint64_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "num", "\\u", "dive", "rted", "\"_", ",_", "c\\u", "uint64_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "err", "\\u", "handler", "\"_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "callback", "\"_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "callback", "\\u", "args", "\"_", ",_", "c\\u", "voi", "d\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "is", "\\u", "looping", "\"_", ",_", "c\\u", "ubyte_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ip", "fw", "\\u", "filter", "\"_", ",_", "c\\u", "char", "\\u", "p_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "err", "msg", "\"_", ",_", "c\\u", "char_", "*_", "Defaults_", "._", "DIV", "ERT", "\\u", "ERR", "BUF", "\\u", "SIZE_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dive", "rt", "Handle", "Raw_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "format\\u", "structure_", "(_", "self_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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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.py
[ { "content": "def import_sources( source_list, o ):\n \"\"\"Import Verilog source from all Verilog files source_list, as well\n as any source files specified by `include within those files.\n \"\"\"\n\n if not source_list:\n return\n\n # For now we assume the first file in the sources_list is top?\n\n top_verilog_file = source_list[0]\n\n # All verilog includes are relative to the root of the PyMTL project.\n # We identify the root of the PyMTL project by looking for the special\n # .pymtl-python-path file.\n\n _path = os.path.dirname( top_verilog_file )\n special_file_found = False\n include_path = os.path.dirname( os.path.abspath( top_verilog_file ) )\n while include_path != \"/\":\n if os.path.exists( include_path + os.path.sep + \".pymtl-python-path\" ):\n special_file_found = True\n sys.path.insert(0,include_path)\n break\n include_path = os.path.dirname(include_path)\n\n # If we could not find the special .pymtl-python-path file, then assume\n # the include directory is the same as the directory that contains the\n # verilog file.\n\n if not special_file_found:\n include_path = os.path.dirname( os.path.abspath( top_verilog_file ) )\n\n # Regex to extract verilog filenames from `include statements\n\n include_re = re.compile( r'\"(?P<filename>[\\w/\\.-]*)\"' )\n\n # Iterate through all source files and add any `include files to the\n # list of source files to import.\n\n output_verilog_file( o, include_path, source_list[0] )\n\n # for verilog_file in source_list:\n #\n # print(verilog_file)\n # with open( verilog_file, 'r' ) as fp:\n # for line in fp:\n # if '`include' in line:\n # filename = include_re.search( line ).group( 'filename' )\n # fullname = os.path.join( include_path, filename )\n # if fullname not in source_list:\n # source_list.append( fullname )\n\n # Iterate through all source files in reverse order and write out all\n # source code from imported/`included verilog files. Do this in reverse\n # order to (hopefully) resolve any `define dependencies, and remove any\n # lines with `include statements.\n\n # for verilog_file in reversed( source_list ):\n #\n # # We remove the include directory from the verilog file name to make\n # # error reporting by Verilator more succinct. -cbatten\n #\n # short_verilog_file = verilog_file\n # if verilog_file.startswith( include_path+\"/\" ):\n # short_verilog_file = verilog_file[len(include_path+\"/\"):]\n #\n # src = '`line 1 \"{}\" 0\\n'.format( short_verilog_file )\n #\n # with open( verilog_file, 'r' ) as fp:\n # for line in fp:\n # if '`include' not in line:\n # src += line\n # else:\n # src += \"// \" + line\n #\n # print( src, file=o )", "metadata": "root.import_sources", "header": "['module', '___EOS___']", "index": 237 } ]
[ { "span": "_path ", "start_line": 253, "start_column": 2, "end_line": 253, "end_column": 7 }, { "span": "include_re ", "start_line": 272, "start_column": 2, "end_line": 272, "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "sources_", "(_", "source", "\\u", "list_", ",_", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Import", " ", "Veri", "log", " ", "source", " ", "from", " ", "all", " ", "Veri", "log", " ", "files", " ", "source", "\\u", "list", ",", " ", "as", " ", "well", "\\", "10", ";", " ", " ", "as", " ", "any", " ", "source", " ", "files", " ", "specified", " ", "by", " ", "`", "include", " ", "within", " ", "tho", "se", " ", "files", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "source", "\\u", "list_", ":_", "\\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_", "#", " ", "For", " ", "now", " ", "we", " ", "assume", " ", "the", " ", "first", " ", "file", " ", "in", " ", "the", " ", "source", "s", "\\u", "list", " ", "is", " ", "top", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "top", "\\u", "veri", "log", "\\u", "file_", "=_", "source", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "veri", "log", " ", "include", "s", " ", "are", " ", "relative", " ", "to", " ", "the", " ", "root", " ", "of", " ", "the", " ", "Py", "MT", "L", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "identify", " ", "the", " ", "root", " ", "of", " ", "the", " ", "Py", "MT", "L", " ", "project", " ", "by", " ", "look", "ing", " ", "for", " ", "the", " ", "special_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "pym", "tl", "-", "python", "-", "path", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "top", "\\u", "veri", "log", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "special", "\\u", "file", "\\u", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "include", "\\u", "path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "top", "\\u", "veri", "log", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "include", "\\u", "path_", "!=_", "\"/\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "include", "\\u", "path_", "+_", "os_", "._", "path_", "._", "sep_", "+_", "\".", "pym", "tl", "-", "python", "-", "path", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "special", "\\u", "file", "\\u", "found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "include", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "include", "\\u", "path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "include", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "coul", "d", " ", "not", " ", "find", " ", "the", " ", "special", " ", ".", "pym", "tl", "-", "python", "-", "path", " ", "file", ",", " ", "then", " ", "assume", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "include", " ", "director", "y", " ", "is", " ", "the", " ", "same", " ", "as", " ", "the", " ", "director", "y", " ", "tha", "t", " ", "contain", "s", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "veri", "log", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "special", "\\u", "file", "\\u", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "\\u", "path_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "top", "\\u", "veri", "log", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rege", "x", " ", "to", " ", "extract", " ", "veri", "log", " ", "filename", "s", " ", "from", " ", "`", "include", " ", "statements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "include", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'\"", "(?", "P", "<", "filename", ">[", "\\\\", "w", "/\\\\", ".-", "]*)", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "through", " ", "all", " ", "source", " ", "files", " ", "and", " ", "add", " ", "any", " ", "`", "include", " ", "files", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "of", " ", "source", " ", "files", " ", "to", " ", "import", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "veri", "log", "\\u", "file_", "(_", "o_", ",_", "include", "\\u", "path_", ",_", "source", "\\u", "list_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "veri", "log", "\\u", "file", " ", "in", " ", "source", "\\u", "list", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "print", "(", "veri", "log", "\\u", "file", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", " ", "open", "(", " ", "veri", "log", "\\u", "file", ",", " ", "'", "r", "'", " ", ")", " ", "as", " ", "fp", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "line", " ", "in", " ", "fp", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "if", " ", "'`", "include", "'", " ", "in", " ", "line", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "filename", " ", "=", " ", "include", "\\u", "re", ".", "search", "(", " ", "line", " ", ").", "group", "(", " ", "'", "filename", "'", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "full", "name", " ", "=", " ", "os", ".", "path", ".", "join", "(", " ", "include", "\\u", "path", ",", " ", "filename", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "full", "name", " ", "not", " ", "in", " ", "source", "\\u", "list", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "source", "\\u", "list", ".", "append", "(", " ", "full", "name", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "through", " ", "all", " ", "source", " ", "files", " ", "in", " ", "reverse", " ", "order", " ", "and", " ", "write", " ", "out", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "source", " ", "code", " ", "from", " ", "import", "ed", "/", "`", "include", "d", " ", "veri", "log", " ", "files", ".", " ", "Do", " ", "this", " ", "in", " ", "reverse_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "order", " ", "to", " ", "(", "hop", "efu", "ll", "y", ")", " ", "resolve", " ", "any", " ", "`", "defin", "e", " ", "dependen", "cies", ",", " ", "and", " ", "remove", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lines", " ", "with", " ", "`", "include", " ", "statem", "ents", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "veri", "log", "\\u", "file", " ", "in", " ", "reverse", "d", "(", " ", "source", "\\u", "list", " ", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "#", " ", "We", " ", "remove", " ", "the", " ", "include", " ", "director", "y", " ", "from", " ", "the", " ", "veri", "log", " ", "file", " ", "name", " ", "to", " ", "make_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "#", " ", "error", " ", "reporting", " ", "by", " ", "Veri", "lator", " ", "more", " ", "succ", "inc", "t", ".", " ", "-", "cba", "tte", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "short", "\\u", "veri", "log", "\\u", "file", " ", "=", " ", "veri", "log", "\\u", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "if", " ", "veri", "log", "\\u", "file", ".", "startswith", "(", " ", "include", "\\u", "path", "+\"", "/\"", " ", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "short", "\\u", "veri", "log", "\\u", "file", " ", "=", " ", "veri", "log", "\\u", "file", "[", "len", "(", "include", "\\u", "path", "+\"", "/\"", "):", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "src", " ", "=", " ", "'`", "line", " ", "1", " ", "\"{}\"", " ", "0", "\\\\", "n", "'.", "format", "(", " ", "short", "\\u", "veri", "log", "\\u", "file", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", " ", "open", "(", " ", "veri", "log", "\\u", "file", ",", " ", "'", "r", "'", " ", ")", " ", "as", " ", "fp", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "line", " ", "in", " ", "fp", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "if", " ", "'`", "include", "'", " ", "not", " ", "in", " ", "line", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "src", " ", "+=", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "src", " ", "+=", " ", "\"//", " ", "\"", " ", "+", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "print", "(", " ", "src", ",", " ", "file", "=", "o", " ", ")_", "\\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, 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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 ]
Imprecise assert
RobotWebTools/rosbridge_suite/rosbridge_library/test/internal/publishers/test_publisher_manager.py
[ { "content": " def test_register_publisher(self):\n \"\"\" Register a publisher on a clean topic with a good msg type \"\"\"\n topic = \"/test_register_publisher\"\n msg_type = \"std_msgs/String\"\n client = \"client_test_register_publisher\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n manager.register(client, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n\n manager.unregister(client, topic)\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))", "metadata": "root.TestPublisherManager.test_register_publisher", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_register_publisher_multiclient(self):\n topic = \"/test_register_publisher_multiclient\"\n msg_type = \"std_msgs/String\"\n client1 = \"client_test_register_publisher_1\"\n client2 = \"client_test_register_publisher_2\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n manager.register(client1, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.register(client2, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.unregister(client1, topic)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.unregister(client2, topic)\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))", "metadata": "root.TestPublisherManager.test_register_publisher_multiclient", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def test_register_publisher_conflicting_types(self):\n topic = \"/test_register_publisher_conflicting_types\"\n msg_type = \"std_msgs/String\"\n msg_type_bad = \"std_msgs/Int32\"\n client = \"client_test_register_publisher_conflicting_types\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n manager.register(client, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n\n self.assertRaises(TypeConflictException, manager.register, \"client2\", topic, msg_type_bad)", "metadata": "root.TestPublisherManager.test_register_publisher_conflicting_types", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_register_multiple_publishers(self):\n topic1 = \"/test_register_multiple_publishers1\"\n topic2 = \"/test_register_multiple_publishers2\"\n msg_type = \"std_msgs/String\"\n client = \"client_test_register_multiple_publishers\"\n\n self.assertFalse(topic1 in manager._publishers)\n self.assertFalse(topic2 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic1))\n self.assertFalse(self.is_topic_published(topic2))\n manager.register(client, topic1, msg_type)\n self.assertTrue(topic1 in manager._publishers)\n self.assertTrue(self.is_topic_published(topic1))\n self.assertFalse(topic2 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic2))\n manager.register(client, topic2, msg_type)\n self.assertTrue(topic1 in manager._publishers)\n self.assertTrue(self.is_topic_published(topic1))\n self.assertTrue(topic2 in manager._publishers)\n self.assertTrue(self.is_topic_published(topic2))\n\n manager.unregister(client, topic1)\n self.assertFalse(topic1 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic1))\n self.assertTrue(topic2 in manager._publishers)\n self.assertTrue(self.is_topic_published(topic2))\n\n manager.unregister(client, topic2)\n self.assertFalse(topic1 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic1))\n self.assertFalse(topic2 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic2))", "metadata": "root.TestPublisherManager.test_register_multiple_publishers", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_register_no_msgtype(self):\n topic = \"/test_register_no_msgtype\"\n client = \"client_test_register_no_msgtype\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n self.assertRaises(TopicNotEstablishedException, manager.register, client, topic)", "metadata": "root.TestPublisherManager.test_register_no_msgtype", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test_register_infer_topictype(self):\n topic = \"/test_register_infer_topictype\"\n client = \"client_test_register_infer_topictype\"\n\n self.assertFalse(self.is_topic_published(topic))\n\n rospy.Publisher(topic, String)\n\n self.assertTrue(self.is_topic_published(topic))\n self.assertFalse(topic in manager._publishers)\n manager.register(client, topic)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n\n manager.unregister(client, topic)\n self.assertFalse(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))", "metadata": "root.TestPublisherManager.test_register_infer_topictype", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 114 }, { "content": " def test_register_multiple_notopictype(self):\n topic = \"/test_register_multiple_notopictype\"\n msg_type = \"std_msgs/String\"\n client1 = \"client_test_register_multiple_notopictype_1\"\n client2 = \"client_test_register_multiple_notopictype_2\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n manager.register(client1, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.register(client2, topic)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.unregister(client1, topic)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.unregister(client2, topic)\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))", "metadata": "root.TestPublisherManager.test_register_multiple_notopictype", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 132 }, { "content": " def test_publish_not_registered(self):\n topic = \"/test_publish_not_registered\"\n msg = {\"data\": \"test publish not registered\"}\n client = \"client_test_publish_not_registered\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n self.assertRaises(TopicNotEstablishedException, manager.publish, client, topic, msg)", "metadata": "root.TestPublisherManager.test_publish_not_registered", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 153 } ]
[ { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 28, "start_column": 8, "end_line": 28, "end_column": 54 }, { "span": "self.assertTrue(topic in manager._publishers)", "start_line": 31, "start_column": 8, "end_line": 31, "end_column": 53 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 35, "start_column": 8, "end_line": 35, "end_column": 54 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 54 }, { "span": "self.assertTrue(topic in manager._publishers)", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 53 }, { "span": "self.assertTrue(topic in manager._publishers)", "start_line": 50, "start_column": 8, "end_line": 50, "end_column": 53 }, { "span": "self.assertTrue(topic in manager._publishers)", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 53 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 54 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 54 }, { "span": "self.assertTrue(topic in manager._publishers)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 53 }, { "span": "self.assertFalse(topic1 in manager._publishers)", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 55 }, { "span": "self.assertFalse(topic2 in manager._publishers)", "start_line": 80, "start_column": 8, "end_line": 80, "end_column": 55 }, { "span": "self.assertTrue(topic1 in manager._publishers)", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 54 }, { "span": "self.assertFalse(topic2 in manager._publishers)", "start_line": 86, "start_column": 8, "end_line": 86, "end_column": 55 }, { "span": "self.assertTrue(topic1 in manager._publishers)", "start_line": 89, "start_column": 8, "end_line": 89, "end_column": 54 }, { "span": "self.assertTrue(topic2 in manager._publishers)", "start_line": 91, "start_column": 8, "end_line": 91, "end_column": 54 }, { "span": "self.assertFalse(topic1 in manager._publishers)", "start_line": 95, "start_column": 8, "end_line": 95, "end_column": 55 }, { "span": "self.assertTrue(topic2 in manager._publishers)", "start_line": 97, "start_column": 8, "end_line": 97, "end_column": 54 }, { "span": "self.assertFalse(topic1 in manager._publishers)", "start_line": 101, "start_column": 8, "end_line": 101, "end_column": 55 }, { "span": "self.assertFalse(topic2 in manager._publishers)", "start_line": 103, "start_column": 8, "end_line": 103, "end_column": 55 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 110, "start_column": 8, "end_line": 110, "end_column": 54 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 123, "start_column": 8, "end_line": 123, "end_column": 54 }, { "span": "self.assertTrue(topic in manager._publishers)", "start_line": 125, "start_column": 8, "end_line": 125, "end_column": 53 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 129, "start_column": 8, "end_line": 129, "end_column": 54 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 138, "start_column": 8, "end_line": 138, "end_column": 54 }, { "span": "self.assertTrue(topic in manager._publishers)", "start_line": 141, "start_column": 8, "end_line": 141, "end_column": 53 }, { "span": "self.assertTrue(topic in manager._publishers)", "start_line": 144, "start_column": 8, "end_line": 144, "end_column": 53 }, { "span": "self.assertTrue(topic in manager._publishers)", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 53 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 150, "start_column": 8, "end_line": 150, "end_column": 54 }, { "span": "self.assertFalse(topic in manager._publishers)", "start_line": 158, "start_column": 8, "end_line": 158, "end_column": 54 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "publisher_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Register", " ", "a", " ", "publi", "sher", " ", "on", " ", "a", " ", "clean", " ", "topic", " ", "with", " ", "a", " ", "good", " ", "msg", " ", "type", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "publi", "sher", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "publi", "sher", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "publi", "sher", "\\u", "multic", "lient_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "publi", "sher", "\\u", "multic", "lien", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "1_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "publi", "sher", "\\u", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "publi", "sher", "\\u", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client", "1_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client", "2_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client", "1_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client", "2_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "publi", "sher", "\\u", "conflicting", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "publi", "sher", "\\u", "conflicting", "\\u", "types", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type", "\\u", "bad_", "=_", "\"", "std", "\\u", "msgs", "/", "Int", "32", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "publi", "sher", "\\u", "conflicting", "\\u", "types", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Confl", "ict", "Exception_", ",_", "manager_", "._", "register_", ",_", "\"", "client", "2", "\"_", ",_", "topic_", ",_", "msg", "\\u", "type", "\\u", "bad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "multiple", "\\u", "publishers", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic", "1_", "=_", "\"/", "test\\u", "register", "\\u", "multiple", "\\u", "publishers", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic", "2_", "=_", "\"/", "test\\u", "register", "\\u", "multiple", "\\u", "publishers", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "multiple", "\\u", "publishers", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic", "1_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic", "2_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client_", ",_", "topic", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client_", ",_", "topic", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "no", "\\u", "msgt", "ype_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "no", "\\u", "msgt", "ype", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "no", "\\u", "msgt", "ype", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Topic", "Not", "Esta", "blis", "hed", "Exception_", ",_", "manager_", "._", "register_", ",_", "client_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "infer", "\\u", "topic", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "infer", "\\u", "topic", "type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "infer", "\\u", "topic", "type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rospy_", "._", "Publisher_", "(_", "topic_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "multiple", "\\u", "not", "opi", "ctype_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "multiple", "\\u", "not", "opi", "ctype", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "1_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "multiple", "\\u", "not", "opi", "ctype", "\\u", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "multiple", "\\u", "not", "opi", "ctype", "\\u", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client", "1_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client", "2_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client", "1_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client", "2_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "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", "sh", "\\u", "not", "\\u", "registered_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "publi", "sh", "\\u", "not", "\\u", "register", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "{_", "\"", "data", "\"_", ":_", "\"", "test", " ", "publi", "sh", " ", "not", " ", "register", "ed", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "publi", "sh", "\\u", "not", "\\u", "register", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Topic", "Not", "Esta", "blis", "hed", "Exception_", ",_", "manager_", "._", "publish_", ",_", "client_", ",_", "topic_", ",_", "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, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 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, 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,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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, 2, 2, 2, 2, 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, 2, 2, 2, 2, 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, 2, 2, 2, 2, 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, 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, 0, 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 ]
Unused import
open-cloud/xos/xos/core/admin.py
[ { "content": "import threading\nfrom cgi import escape as html_escape\n\nfrom core.models import *\nfrom core.models import Site\nfrom django import forms\nfrom django.contrib import admin, messages\nfrom django.contrib.admin.widgets import (AdminTextareaWidget,\n FilteredSelectMultiple)\nfrom django.contrib.auth.admin import UserAdmin\nfrom django.contrib.auth.forms import (AdminPasswordChangeForm,\n ReadOnlyPasswordHashField)\nfrom django.contrib.auth.models import Group\nfrom django.contrib.auth.signals import user_logged_in\nfrom django.contrib.contenttypes import generic\nfrom django.core.exceptions import PermissionDenied, ValidationError\nfrom django.core.urlresolvers import NoReverseMatch, resolve, reverse\nfrom django.forms.utils import flatatt, to_current_timezone\nfrom django.utils import timezone\nfrom django.utils.encoding import force_text, python_2_unicode_compatible\nfrom django.utils.html import conditional_escape, format_html\nfrom django.utils.safestring import mark_safe\nfrom django.utils.text import capfirst\nfrom openstack.manager import OpenStackManager\nfrom suit.widgets import LinkedSelect\n\n# thread locals necessary to work around a django-suit issue\n_thread_locals = threading.local()\n\nICON_URLS = {\"success\": \"/static/admin/img/icon_success.gif\",\n \"clock\": \"/static/admin/img/icon_clock.gif\",\n \"error\": \"/static/admin/img/icon_error.gif\"}\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\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\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\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n# class ContainerPortInline(XOSTabularInline):\n# fields = ['backend_status_icon', 'network', 'container', 'ip', 'mac', 'segmentation_id']\n# readonly_fields = (\"backend_status_icon\", \"ip\", \"mac\", \"segmentation_id\")\n# model = Port\n# selflink_fieldname = \"network\"\n# extra = 0\n# verbose_name_plural = \"Ports\"\n# verbose_name = \"Port\"\n# suit_classes = 'suit-tab suit-tab-ports'\n\n# class ContainerAdmin(XOSBaseAdmin):\n# fieldsets = [\n# ('Container Details', {'fields': ['backend_status_text', 'slice', 'node', 'docker_image', 'volumes', 'no_sync'], 'classes': ['suit-tab suit-tab-general'], })\n# ]\n# readonly_fields = ('backend_status_text', )\n# list_display = ['backend_status_icon', 'id']\n# list_display_links = ('backend_status_icon', 'id', )\n#\n# suit_form_tabs =(('general', 'Container Details'), ('ports', 'Ports'))\n#\n# inlines = [TagInline, ContainerPortInline]\n#\n# def formfield_for_foreignkey(self, db_field, request, **kwargs):\n# if db_field.name == 'slice':\n# kwargs['queryset'] = Slice.select_by_user(request.user)\n#\n# return super(ContainerAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)\n#\n# def queryset(self, request):\n# # admins can see all instances. Users can only see instances of\n# # the slices they belong to.\n# return Container.select_by_user(request.user)\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# register a signal that caches the user's credentials when they log in\n\n\nuser_logged_in.connect(cache_credentials)\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# Now register the new UserAdmin...\nadmin.site.register(User, UserAdmin)\n# ... and, since we're not using Django's builtin permissions,\n# unregister the Group model from admin.\n# admin.site.unregister(Group)\n\n# When debugging it is often easier to see all the classes, but for regular use\n# only the top-levels should be displayed\nshowAll = False\n\nadmin.site.register(Deployment, DeploymentAdmin)\nadmin.site.register(Controller, ControllerAdmin)\nadmin.site.register(Site, SiteAdmin)\nadmin.site.register(Slice, SliceAdmin)\nadmin.site.register(Service, ServiceAdmin)\n#admin.site.register(Reservation, ReservationAdmin)\nadmin.site.register(Network, NetworkAdmin)\nadmin.site.register(Port, PortAdmin)\nadmin.site.register(Router, RouterAdmin)\nadmin.site.register(NetworkTemplate, NetworkTemplateAdmin)\nadmin.site.register(Program, ProgramAdmin)\n#admin.site.register(Account, AccountAdmin)\n#admin.site.register(Invoice, InvoiceAdmin)\n\nif True:\n admin.site.register(NetworkParameterType, NetworkParameterTypeAdmin)\n admin.site.register(ServiceClass, ServiceClassAdmin)\n admin.site.register(Tag, TagAdmin)\n admin.site.register(ControllerRole)\n admin.site.register(SiteRole)\n admin.site.register(SliceRole)\n admin.site.register(Node, NodeAdmin)\n admin.site.register(NodeLabel, NodeLabelAdmin)\n #admin.site.register(SlicePrivilege, SlicePrivilegeAdmin)\n #admin.site.register(SitePrivilege, SitePrivilegeAdmin)\n admin.site.register(Instance, InstanceAdmin)\n admin.site.register(Image, ImageAdmin)\n admin.site.register(DashboardView, DashboardViewAdmin)\n admin.site.register(Flavor, FlavorAdmin)\n admin.site.register(TenantRoot, TenantRootAdmin)\n admin.site.register(TenantRootRole, TenantRootRoleAdmin)\n admin.site.register(TenantRole, TenantRoleAdmin)\n admin.site.register(TenantAttribute, TenantAttributeAdmin)\n admin.site.register(AddressPool, AddressPoolAdmin)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def backend_icon(obj):\n (icon, tooltip) = obj.get_backend_icon()\n\n icon_url = ICON_URLS.get(icon, \"unknown\")\n\n (exponent, last_success, last_failure, failures) = obj.get_backend_details()\n\n # FIXME: Need to clean this up by separating Javascript from Python\n if (obj.pk):\n script = \"\"\"\n <script type=\"text/javascript\">$(document).ready(function () {$(\"#show_details_%d\").click(function () {$(\"#status%d\").dialog({modal: true, height: 200, width: 200 });});});</script>\n \"\"\" % (obj.pk, obj.pk)\n\n div = \"\"\"\n <div style=\"display:none;\" id=\"status%d\" title=\"Details\">\n <p>Backoff Exponent: %r</p>\n <p>Last Success: %r</p>\n <p>Failures: %r</p>\n <p>Last Failure: %r</p>\n </div>\n \"\"\" % (obj.pk, exponent, last_success, failures, last_failure)\n a = '<a id=\"show_details_%d\" href=\"#\">' % obj.pk\n astop = '</a>'\n else:\n div = ''\n script = ''\n a = ''\n astop = ''\n\n if tooltip:\n return '%s %s <span style=\"min-width:16px;\" title=\"%s\">%s<img src=\"%s\">%s</span>' % (script, div, tooltip, a, icon_url, astop)\n else:\n return '<span style=\"min-width:16px;\"><img src=\"%s\"></span>' % icon_url", "metadata": "root.backend_icon", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def backend_text(obj):\n (icon, tooltip) = obj.get_backend_icon()\n icon_url = ICON_URLS.get(icon, \"unknown\")\n\n return '<img src=\"%s\"> %s' % (icon_url, tooltip)", "metadata": "root.backend_text", "header": "['module', '___EOS___']", "index": 69 }, { "content": "class UploadTextareaWidget(AdminTextareaWidget):\n", "metadata": "root.UploadTextareaWidget", "header": "['module', '___EOS___']", "index": 76 }, { "content": " def render(self, name, value, attrs=None):\n if value is None:\n value = ''\n final_attrs = self.build_attrs(attrs, name=name)\n return format_html('<input type=\"file\" style=\"width: 0; height: 0\" id=\"btn_upload_%s\" onChange=\"uploadTextarea(event,\\'%s\\');\">'\n '<button onClick=\"$(\\'#btn_upload_%s\\').click(); return false;\">Upload</button>'\n '<br><textarea{0}>\\r\\n{1}</textarea>' % (\n attrs[\"id\"], attrs[\"id\"], attrs[\"id\"]),\n flatatt(final_attrs),\n force_text(value))", "metadata": "root.UploadTextareaWidget.render", "header": "['class', 'UploadTextareaWidget', '(', 'AdminTextareaWidget', ')', ':', '___EOS___']", "index": 78 }, { "content": "class SliderWidget(forms.HiddenInput):\n", "metadata": "root.SliderWidget", "header": "['module', '___EOS___']", "index": 90 }, { "content": " def render(self, name, value, attrs=None):\n if value is None:\n value = '0'\n final_attrs = self.build_attrs(attrs, name=name)\n attrs = attrs or attrs[:]\n attrs[\"name\"] = name\n attrs[\"value\"] = value\n html = \"\"\"<div style=\"width:640px\"><span id=\"%(id)s_label\">%(value)s</span><div id=\"%(id)s_slider\" style=\"float:right;width:610px;margin-top:5px\"></div></div>\n <script>\n $(function() {\n $(\"#%(id)s_slider\").slider({\n value: %(value)s,\n slide: function(event, ui) { $(\"#%(id)s\").val( ui.value ); $(\"#%(id)s_label\").html(ui.value); },\n });\n });\n </script>\n <input type=\"hidden\" id=\"%(id)s\" name=\"%(name)s\" value=\"%(value)s\"></input>\n \"\"\" % attrs\n html = html.replace(\"{\", \"{{\").replace(\"}\", \"}}\")\n return format_html(html,\n flatatt(final_attrs),\n force_text(value))", "metadata": "root.SliderWidget.render", "header": "['class', 'SliderWidget', '(', 'forms', '.', 'HiddenInput', ')', ':', '___EOS___']", "index": 92 }, { "content": "class PlainTextWidget(forms.HiddenInput):\n input_type = 'hidden'\n", "metadata": "root.PlainTextWidget", "header": "['module', '___EOS___']", "index": 116 }, { "content": " def render(self, name, value, attrs=None):\n if value is None:\n value = ''\n return mark_safe(str(value) + super(PlainTextWidget, self).render(name, value, attrs))", "metadata": "root.PlainTextWidget.render", "header": "['class', 'PlainTextWidget', '(', 'forms', '.', 'HiddenInput', ')', ':', '___EOS___']", "index": 119 }, { "content": "class XOSAdminMixin(object):\n # call save_by_user and delete_by_user instead of save and delete\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n backend_status_icon.short_description = \"\"\n\n", "metadata": "root.XOSAdminMixin", "header": "['module', '___EOS___']", "index": 125 }, { "content": " def has_add_permission(self, request, obj=None):\n return (not self.__user_is_readonly(request))", "metadata": "root.XOSAdminMixin.has_add_permission", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 128 }, { "content": " def has_delete_permission(self, request, obj=None):\n return (not self.__user_is_readonly(request))", "metadata": "root.XOSAdminMixin.has_delete_permission", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 131 }, { "content": " def save_model(self, request, obj, form, change):\n if self.__user_is_readonly(request):\n # this 'if' might be redundant if save_by_user is implemented right\n raise PermissionDenied\n\n # reset exponential backoff\n if hasattr(obj, \"backend_register\"):\n obj.backend_register = \"{}\"\n\n obj.caller = request.user\n # update openstack connection to use this site/tenant\n obj.save_by_user(request.user)", "metadata": "root.XOSAdminMixin.save_model", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 134 }, { "content": " def delete_model(self, request, obj):\n obj.delete_by_user(request.user)", "metadata": "root.XOSAdminMixin.delete_model", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 147 }, { "content": " def save_formset(self, request, form, formset, change):\n instances = formset.save(commit=False)\n for instance in instances:\n instance.caller = request.user\n instance.save_by_user(request.user)\n\n # BUG in django 1.7? Objects are not deleted by formset.save if\n # commit is False. So let's delete them ourselves.\n #\n # code from forms/models.py save_existing_objects()\n try:\n forms_to_delete = formset.deleted_forms\n except AttributeError:\n forms_to_delete = []\n if formset.initial_forms:\n for form in formset.initial_forms:\n obj = form.instance\n if form in forms_to_delete:\n if obj.pk is None:\n continue\n formset.deleted_objects.append(obj)\n obj.delete()\n\n formset.save_m2m()", "metadata": "root.XOSAdminMixin.save_formset", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 150 }, { "content": " def get_actions(self, request):\n actions = super(XOSAdminMixin, self).get_actions(request)\n\n if self.__user_is_readonly(request):\n if 'delete_selected' in actions:\n del actions['delete_selected']\n\n return actions", "metadata": "root.XOSAdminMixin.get_actions", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 175 }, { "content": " def url_for_model_changelist(self, request, model):\n # used in add_extra_context\n return reverse('admin:%s_%s_changelist' % (model._meta.app_label, model._meta.model_name), current_app=model._meta.app_label)", "metadata": "root.XOSAdminMixin.url_for_model_changelist", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 184 }, { "content": " def add_extra_context(self, request, extra_context):\n # allow custom application breadcrumb url and name\n extra_context[\"custom_app_breadcrumb_url\"] = getattr(\n self, \"custom_app_breadcrumb_url\", None)\n extra_context[\"custom_app_breadcrumb_name\"] = getattr(\n self, \"custom_app_breadcrumb_name\", None)\n extra_context[\"custom_changelist_breadcrumb_url\"] = getattr(\n self, \"custom_changelist_breadcrumb_url\", None)\n\n # for Service admins to render their Administration page\n if getattr(self, \"extracontext_registered_admins\", False):\n admins = []\n for model, model_admin in admin.site._registry.items():\n if model == self.model:\n continue\n if model._meta.app_label == self.model._meta.app_label:\n info = {\"app\": model._meta.app_label,\n \"model\": model._meta.model_name,\n \"name\": capfirst(model._meta.verbose_name_plural),\n \"url\": self.url_for_model_changelist(request, model)}\n admins.append(info)\n extra_context[\"registered_admins\"] = admins", "metadata": "root.XOSAdminMixin.add_extra_context", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 188 }, { "content": " def change_view(self, request, object_id, extra_context=None):\n extra_context = extra_context or {}\n\n if self.__user_is_readonly(request):\n if not hasattr(self, \"readonly_save\"):\n # save the original readonly fields\n self.readonly_save = self.readonly_fields\n self.inlines_save = self.inlines\n if hasattr(self, \"user_readonly_fields\"):\n self.readonly_fields = self.user_readonly_fields\n if hasattr(self, \"user_readonly_inlines\"):\n self.inlines = self.user_readonly_inlines\n else:\n if hasattr(self, \"readonly_save\"):\n # restore the original readonly fields\n self.readonly_fields = self.readonly_save\n if hasattr(self, \"inlines_save\"):\n self.inlines = self.inlines_save\n\n self.add_extra_context(request, extra_context)\n\n try:\n return super(XOSAdminMixin, self).change_view(request, object_id, extra_context=extra_context)\n except PermissionDenied:\n pass\n except ValidationError as e:\n if (e.params is None):\n # Validation errors that don't reference a specific field will\n # often throw a non-descriptive 500 page to the user. The code\n # below will cause an error message to be printed and the\n # page refreshed instead.\n # As a side-effect it turns the request back into a 'GET' which\n # may wipe anything the user had changed on the page. But, at\n # least the user gets a real error message.\n # TODO: revisit this and display some kind of error view\n request.method = 'GET'\n messages.error(request, e.message)\n return super(XOSAdminMixin, self).change_view(request, object_id, extra_context=extra_context)\n else:\n raise\n if request.method == 'POST':\n raise PermissionDenied\n request.readonly = True\n return super(XOSAdminMixin, self).change_view(request, object_id, extra_context=extra_context)", "metadata": "root.XOSAdminMixin.change_view", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 211 }, { "content": " def changelist_view(self, request, extra_context=None):\n extra_context = extra_context or {}\n\n self.add_extra_context(request, extra_context)\n\n return super(XOSAdminMixin, self).changelist_view(request, extra_context=extra_context)", "metadata": "root.XOSAdminMixin.changelist_view", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 256 }, { "content": " def add_view(self, request, form_url='', extra_context=None):\n extra_context = extra_context or {}\n\n self.add_extra_context(request, extra_context)\n\n return super(XOSAdminMixin, self).add_view(request, form_url, extra_context=extra_context)", "metadata": "root.XOSAdminMixin.add_view", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 263 }, { "content": " def __user_is_readonly(self, request):\n return request.user.isReadOnlyUser()", "metadata": "root.XOSAdminMixin.__user_is_readonly", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 270 }, { "content": " def backend_status_text(self, obj):\n return mark_safe(backend_text(obj))", "metadata": "root.XOSAdminMixin.backend_status_text", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 273 }, { "content": " def backend_status_icon(self, obj):\n return mark_safe(backend_icon(obj))", "metadata": "root.XOSAdminMixin.backend_status_icon", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 276 }, { "content": " def get_form(self, request, obj=None, **kwargs):\n # Save obj and request in thread-local storage, so suit_form_tabs can\n # use it to determine whether we're in edit or add mode, and can\n # determine whether the user is an admin.\n _thread_locals.request = request\n _thread_locals.obj = obj\n return super(XOSAdminMixin, self).get_form(request, obj, **kwargs)", "metadata": "root.XOSAdminMixin.get_form", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 280 }, { "content": " def get_inline_instances(self, request, obj=None):\n inlines = super(XOSAdminMixin, self).get_inline_instances(request, obj)\n\n # inlines that should only be shown to an admin user\n if request.user.is_admin:\n for inline_class in getattr(self, \"admin_inlines\", []):\n inlines.append(inline_class(self.model, self.admin_site))\n\n return inlines", "metadata": "root.XOSAdminMixin.get_inline_instances", "header": "['class', 'XOSAdminMixin', '(', 'object', ')', ':', '___NEWLINE___', '# call save_by_user and delete_by_user instead of save and delete', '___NL___', '___EOS___']", "index": 288 }, { "content": "class ReadOnlyAwareAdmin(XOSAdminMixin, admin.ModelAdmin):\n # Note: Make sure XOSAdminMixin is listed before\n # admin.ModelAdmin in the class declaration.\n\n pass", "metadata": "root.ReadOnlyAwareAdmin", "header": "['module', '___EOS___']", "index": 299 }, { "content": "class XOSBaseAdmin(ReadOnlyAwareAdmin):\n save_on_top = False", "metadata": "root.XOSBaseAdmin", "header": "['module', '___EOS___']", "index": 306 }, { "content": "class SingletonAdmin (ReadOnlyAwareAdmin):\n", "metadata": "root.SingletonAdmin", "header": "['module', '___EOS___']", "index": 310 }, { "content": " def has_add_permission(self, request):\n if not super(SingletonAdmin, self).has_add_permission(request):\n return False\n\n num_objects = self.model.objects.count()\n if num_objects >= 1:\n return False\n else:\n return True", "metadata": "root.SingletonAdmin.has_add_permission", "header": "['class', 'SingletonAdmin', '(', 'ReadOnlyAwareAdmin', ')', ':', '___EOS___']", "index": 312 }, { "content": "class ServiceAppAdmin (SingletonAdmin):\n extracontext_registered_admins = True", "metadata": "root.ServiceAppAdmin", "header": "['module', '___EOS___']", "index": 323 }, { "content": "class XOSTabularInline(admin.TabularInline):\n\n\n\n\n\n\n\n selflink.allow_tags = True\n selflink.short_description = \"Details\"\n\n\n\n backend_status_icon.short_description = \"\"", "metadata": "root.XOSTabularInline", "header": "['module', '___EOS___']", "index": 327 }, { "content": " def __init__(self, *args, **kwargs):\n super(XOSTabularInline, self).__init__(*args, **kwargs)\n\n # InlineModelAdmin as no get_fields() method, so in order to add\n # the selflink field, we override __init__ to modify self.fields and\n # self.readonly_fields.\n\n self.setup_selflink()", "metadata": "root.XOSTabularInline.__init__", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 329 }, { "content": " @property\n def selflink_model(self):\n if hasattr(self, \"selflink_fieldname\"):\n \"\"\" self.selflink_model can be defined to punch through a relation\n to its target object. For example, in SliceNetworkInline, set\n selflink_model = \"network\", and the URL will lead to the Network\n object instead of trying to bring up a change view of the\n SliceNetwork object.\n \"\"\"\n return getattr(self.model, self.selflink_fieldname).field.rel.to\n else:\n return self.model", "metadata": "root.XOSTabularInline.selflink_model", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 338 }, { "content": " @property\n def selflink_reverse_path(self):\n return \"admin:%s_change\" % (self.selflink_model._meta.db_table)", "metadata": "root.XOSTabularInline.selflink_reverse_path", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 351 }, { "content": " def get_change_url(self, id):\n \"\"\" Get the URL to a change form in the admin for this model \"\"\"\n reverse_path = self.selflink_reverse_path # \"admin:%s_change\" % (self.selflink_model._meta.db_table)\n try:\n url = reverse(reverse_path, args=(id,))\n except NoReverseMatch:\n return None\n\n return url", "metadata": "root.XOSTabularInline.get_change_url", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 355 }, { "content": " def setup_selflink(self):\n url = self.get_change_url(0)\n\n # We don't have an admin for this object, so don't create the\n # selflink.\n if (url == None):\n return\n\n # Since we need to add \"selflink\" to the field list, we need to create\n # self.fields if it is None.\n if (self.fields is None):\n self.fields = []\n for f in self.model._meta.fields:\n if f.editable and f.name != \"id\":\n self.fields.append(f.name)\n\n self.fields = tuple(self.fields) + (\"selflink\", )\n\n if self.readonly_fields is None:\n self.readonly_fields = ()\n\n self.readonly_fields = tuple(self.readonly_fields) + (\"selflink\", )", "metadata": "root.XOSTabularInline.setup_selflink", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 365 }, { "content": " def selflink(self, obj):\n if hasattr(self, \"selflink_fieldname\"):\n obj = getattr(obj, self.selflink_fieldname)\n\n if obj.id:\n url = self.get_change_url(obj.id)\n return \"<a href='%s'>Details</a>\" % str(url)\n else:\n return \"Not present\"", "metadata": "root.XOSTabularInline.selflink", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 388 }, { "content": " def has_add_permission(self, request):\n return not request.user.isReadOnlyUser()", "metadata": "root.XOSTabularInline.has_add_permission", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 401 }, { "content": " def get_readonly_fields(self, request, obj=None):\n readonly_fields = list(self.readonly_fields)[:]\n if request.user.isReadOnlyUser():\n for field in self.fields:\n if not field in readonly_fields:\n readonly_fields.append(field)\n return readonly_fields", "metadata": "root.XOSTabularInline.get_readonly_fields", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 404 }, { "content": " def backend_status_icon(self, obj):\n return mark_safe(backend_icon(obj))", "metadata": "root.XOSTabularInline.backend_status_icon", "header": "['class', 'XOSTabularInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 412 }, { "content": "class PlStackGenericTabularInline(generic.GenericTabularInline):\n\n\n\n backend_status_icon.short_description = \"\"", "metadata": "root.PlStackGenericTabularInline", "header": "['module', '___EOS___']", "index": 417 }, { "content": " def has_add_permission(self, request):\n return not request.user.isReadOnlyUser()", "metadata": "root.PlStackGenericTabularInline.has_add_permission", "header": "['class', 'PlStackGenericTabularInline', '(', 'generic', '.', 'GenericTabularInline', ')', ':', '___EOS___']", "index": 419 }, { "content": " def get_readonly_fields(self, request, obj=None):\n readonly_fields = list(self.readonly_fields)[:]\n if request.user.isReadOnlyUser():\n for field in self.fields:\n if not field in readonly_fields:\n readonly_fields.append(field)\n return readonly_fields", "metadata": "root.PlStackGenericTabularInline.get_readonly_fields", "header": "['class', 'PlStackGenericTabularInline', '(', 'generic', '.', 'GenericTabularInline', ')', ':', '___EOS___']", "index": 422 }, { "content": " def backend_status_icon(self, obj):\n return mark_safe(backend_icon(obj))", "metadata": "root.PlStackGenericTabularInline.backend_status_icon", "header": "['class', 'PlStackGenericTabularInline', '(', 'generic', '.', 'GenericTabularInline', ')', ':', '___EOS___']", "index": 430 }, { "content": "class ReservationInline(XOSTabularInline):\n model = Reservation\n extra = 0\n suit_classes = 'suit-tab suit-tab-reservations'\n", "metadata": "root.ReservationInline", "header": "['module', '___EOS___']", "index": 435 }, { "content": " def queryset(self, request):\n return Reservation.select_by_user(request.user)", "metadata": "root.ReservationInline.queryset", "header": "['class', 'ReservationInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 440 }, { "content": "class TagInline(PlStackGenericTabularInline):\n model = Tag\n extra = 0\n suit_classes = 'suit-tab suit-tab-tags'\n fields = ['service', 'name', 'value']\n", "metadata": "root.TagInline", "header": "['module', '___EOS___']", "index": 444 }, { "content": " def queryset(self, request):\n return Tag.select_by_user(request.user)", "metadata": "root.TagInline.queryset", "header": "['class', 'TagInline', '(', 'PlStackGenericTabularInline', ')', ':', '___EOS___']", "index": 450 }, { "content": "class InstanceInline(XOSTabularInline):\n model = Instance\n fields = ['backend_status_icon', 'all_ips_string', 'instance_id',\n 'instance_name', 'slice', 'deployment', 'flavor', 'image', 'node']\n extra = 0\n max_num = 0\n readonly_fields = ['backend_status_icon', 'all_ips_string', 'instance_id',\n 'instance_name', 'slice', 'deployment', 'flavor', 'image', 'node']\n suit_classes = 'suit-tab suit-tab-instances'\n\n", "metadata": "root.InstanceInline", "header": "['module', '___EOS___']", "index": 454 }, { "content": " def queryset(self, request):\n return Instance.select_by_user(request.user)", "metadata": "root.InstanceInline.queryset", "header": "['class', 'InstanceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 464 }, { "content": " def formfield_for_foreignkey(self, db_field, request=None, **kwargs):\n if db_field.name == 'deployment':\n kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(\n sitedeployments__nodes__isnull=False).distinct()\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_deployment_changed(this);\"})\n if db_field.name == 'flavor':\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_flavor_changed(this);\"})\n\n field = super(InstanceInline, self).formfield_for_foreignkey(\n db_field, request, **kwargs)\n\n return field", "metadata": "root.InstanceInline.formfield_for_foreignkey", "header": "['class', 'InstanceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 467 }, { "content": "class CordInstanceInline(XOSTabularInline):\n model = Instance\n fields = ['backend_status_icon', 'all_ips_string', 'instance_id',\n 'instance_name', 'slice', 'flavor', 'image', 'node']\n extra = 0\n readonly_fields = ['backend_status_icon',\n 'all_ips_string', 'instance_id', 'instance_name']\n suit_classes = 'suit-tab suit-tab-instances'\n\n", "metadata": "root.CordInstanceInline", "header": "['module', '___EOS___']", "index": 483 }, { "content": " def queryset(self, request):\n return Instance.select_by_user(request.user)", "metadata": "root.CordInstanceInline.queryset", "header": "['class', 'CordInstanceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 492 }, { "content": " def formfield_for_foreignkey(self, db_field, request=None, **kwargs):\n if db_field.name == 'deployment':\n\n kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(\n sitedeployments__nodes__isnull=False).distinct()\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_deployment_changed(this);\"})\n if db_field.name == 'flavor':\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_flavor_changed(this);\"})\n\n field = super(CordInstanceInline, self).formfield_for_foreignkey(\n db_field, request, **kwargs)\n\n return field", "metadata": "root.CordInstanceInline.formfield_for_foreignkey", "header": "['class', 'CordInstanceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 495 }, { "content": "class SiteInline(XOSTabularInline):\n model = Site\n extra = 0\n suit_classes = 'suit-tab suit-tab-sites'\n", "metadata": "root.SiteInline", "header": "['module', '___EOS___']", "index": 512 }, { "content": " def queryset(self, request):\n return Site.select_by_user(request.user)", "metadata": "root.SiteInline.queryset", "header": "['class', 'SiteInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 517 }, { "content": "class SiteHostsNodesInline(SiteInline):\n", "metadata": "root.SiteHostsNodesInline", "header": "['module', '___EOS___']", "index": 521 }, { "content": " def queryset(self, request):\n return Site.select_by_user(request.user).filter(hosts_nodes=True)", "metadata": "root.SiteHostsNodesInline.queryset", "header": "['class', 'SiteHostsNodesInline', '(', 'SiteInline', ')', ':', '___EOS___']", "index": 523 }, { "content": "class SiteHostsUsersInline(SiteInline):\n", "metadata": "root.SiteHostsUsersInline", "header": "['module', '___EOS___']", "index": 527 }, { "content": " def queryset(self, request):\n return Site.select_by_user(request.user).filter(hosts_users=True)", "metadata": "root.SiteHostsUsersInline.queryset", "header": "['class', 'SiteHostsUsersInline', '(', 'SiteInline', ')', ':', '___EOS___']", "index": 529 }, { "content": "class UserInline(XOSTabularInline):\n model = User\n fields = ['backend_status_icon', 'email', 'firstname', 'lastname']\n readonly_fields = ('backend_status_icon', )\n extra = 0\n suit_classes = 'suit-tab suit-tab-users'\n", "metadata": "root.UserInline", "header": "['module', '___EOS___']", "index": 533 }, { "content": " def queryset(self, request):\n return User.select_by_user(request.user)", "metadata": "root.UserInline.queryset", "header": "['class', 'UserInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 540 }, { "content": "class SliceInline(XOSTabularInline):\n model = Slice\n fields = ['backend_status_icon', 'name', 'site', 'serviceClass', 'service']\n readonly_fields = ('backend_status_icon', )\n extra = 0\n suit_classes = 'suit-tab suit-tab-slices'\n", "metadata": "root.SliceInline", "header": "['module', '___EOS___']", "index": 544 }, { "content": " def queryset(self, request):\n return Slice.select_by_user(request.user)", "metadata": "root.SliceInline.queryset", "header": "['class', 'SliceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 551 }, { "content": "class NodeInline(XOSTabularInline):\n model = Node\n extra = 0\n suit_classes = 'suit-tab suit-tab-nodes'\n fields = ['backend_status_icon', 'name', 'site_deployment']\n readonly_fields = ('backend_status_icon', )", "metadata": "root.NodeInline", "header": "['module', '___EOS___']", "index": 555 }, { "content": "class DeploymentPrivilegeInline(XOSTabularInline):\n model = DeploymentPrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-deploymentprivileges'\n fields = ['backend_status_icon', 'user', 'role', 'deployment']\n readonly_fields = ('backend_status_icon', )\n", "metadata": "root.DeploymentPrivilegeInline", "header": "['module', '___EOS___']", "index": 563 }, { "content": " def queryset(self, request):\n return DeploymentPrivilege.select_by_user(request.user)", "metadata": "root.DeploymentPrivilegeInline.queryset", "header": "['class', 'DeploymentPrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 570 }, { "content": "class ControllerSiteInline(XOSTabularInline):\n model = ControllerSite\n extra = 0\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['controller', 'site', 'tenant_id']", "metadata": "root.ControllerSiteInline", "header": "['module', '___EOS___']", "index": 574 }, { "content": "class SitePrivilegeInline(XOSTabularInline):\n model = SitePrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-siteprivileges'\n fields = ['backend_status_icon', 'user', 'site', 'role']\n readonly_fields = ('backend_status_icon', )\n\n", "metadata": "root.SitePrivilegeInline", "header": "['module', '___EOS___']", "index": 581 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'site':\n kwargs['queryset'] = Site.select_by_user(request.user)\n\n if db_field.name == 'user':\n kwargs['queryset'] = User.select_by_user(request.user)\n return super(SitePrivilegeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SitePrivilegeInline.formfield_for_foreignkey", "header": "['class', 'SitePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 588 }, { "content": " def queryset(self, request):\n return SitePrivilege.select_by_user(request.user)", "metadata": "root.SitePrivilegeInline.queryset", "header": "['class', 'SitePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 596 }, { "content": "class ServicePrivilegeInline(XOSTabularInline):\n model = ServicePrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-serviceprivileges'\n fields = ['backend_status_icon', 'user', 'service', 'role']\n readonly_fields = ('backend_status_icon', )\n\n", "metadata": "root.ServicePrivilegeInline", "header": "['module', '___EOS___']", "index": 600 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'service':\n kwargs['queryset'] = Service.select_by_user(request.user)\n if db_field.name == 'user':\n kwargs['queryset'] = User.select_by_user(request.user)\n return super(ServicePrivilegeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.ServicePrivilegeInline.formfield_for_foreignkey", "header": "['class', 'ServicePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 607 }, { "content": " def queryset(self, request):\n return ServicePrivilege.select_by_user(request.user)", "metadata": "root.ServicePrivilegeInline.queryset", "header": "['class', 'ServicePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 614 }, { "content": "class SiteDeploymentInline(XOSTabularInline):\n model = SiteDeployment\n extra = 0\n suit_classes = 'suit-tab suit-tab-sitedeployments'\n fields = ['backend_status_icon', 'deployment', 'site', 'controller']\n readonly_fields = ('backend_status_icon', )\n\n", "metadata": "root.SiteDeploymentInline", "header": "['module', '___EOS___']", "index": 618 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'site':\n kwargs['queryset'] = Site.select_by_user(request.user)\n\n if db_field.name == 'deployment':\n kwargs['queryset'] = Deployment.select_by_user(request.user)\n\n if db_field.name == 'controller':\n if len(resolve(request.path).args) > 0:\n kwargs['queryset'] = Controller.select_by_user(request.user).filter(\n deployment__id=int(resolve(request.path).args[0]))\n\n return super(SiteDeploymentInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SiteDeploymentInline.formfield_for_foreignkey", "header": "['class', 'SiteDeploymentInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 625 }, { "content": " def queryset(self, request):\n return SiteDeployment.select_by_user(request.user)", "metadata": "root.SiteDeploymentInline.queryset", "header": "['class', 'SiteDeploymentInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 639 }, { "content": "class SlicePrivilegeInline(XOSTabularInline):\n model = SlicePrivilege\n suit_classes = 'suit-tab suit-tab-sliceprivileges'\n extra = 0\n fields = ('backend_status_icon', 'user', 'slice', 'role')\n readonly_fields = ('backend_status_icon', )\n\n", "metadata": "root.SlicePrivilegeInline", "header": "['module', '___EOS___']", "index": 643 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'slice':\n kwargs['queryset'] = Slice.select_by_user(request.user)\n if db_field.name == 'user':\n # all users are available to be granted SlicePrivilege\n kwargs['queryset'] = User.objects.all()\n\n return super(SlicePrivilegeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SlicePrivilegeInline.formfield_for_foreignkey", "header": "['class', 'SlicePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 650 }, { "content": " def queryset(self, request):\n return SlicePrivilege.select_by_user(request.user)", "metadata": "root.SlicePrivilegeInline.queryset", "header": "['class', 'SlicePrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 659 }, { "content": "class SliceNetworkInline(XOSTabularInline):\n model = Network.slices.through\n selflink_fieldname = \"network\"\n extra = 0\n verbose_name = \"Network Connection\"\n verbose_name_plural = \"Network Connections\"\n suit_classes = 'suit-tab suit-tab-slicenetworks'\n fields = ['backend_status_icon', 'network']\n readonly_fields = ('backend_status_icon', )", "metadata": "root.SliceNetworkInline", "header": "['module', '___EOS___']", "index": 663 }, { "content": "class ImageDeploymentsInline(XOSTabularInline):\n model = ImageDeployments\n extra = 0\n verbose_name = \"Image Deployments\"\n verbose_name_plural = \"Image Deployments\"\n suit_classes = 'suit-tab suit-tab-imagedeployments'\n fields = ['backend_status_icon', 'image', 'deployment']\n readonly_fields = ['backend_status_icon']", "metadata": "root.ImageDeploymentsInline", "header": "['module', '___EOS___']", "index": 674 }, { "content": "class ControllerImagesInline(XOSTabularInline):\n model = ControllerImages\n extra = 0\n verbose_name = \"Controller Images\"\n verbose_name_plural = \"Controller Images\"\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['backend_status_icon', 'image', 'controller', 'glance_image_id']\n readonly_fields = ['backend_status_icon', 'glance_image_id']", "metadata": "root.ControllerImagesInline", "header": "['module', '___EOS___']", "index": 684 }, { "content": "class SliceRoleAdmin(XOSBaseAdmin):\n model = SliceRole\n pass", "metadata": "root.SliceRoleAdmin", "header": "['module', '___EOS___']", "index": 694 }, { "content": "class SiteRoleAdmin(XOSBaseAdmin):\n model = SiteRole\n pass", "metadata": "root.SiteRoleAdmin", "header": "['module', '___EOS___']", "index": 699 }, { "content": "class DeploymentAdminForm(forms.ModelForm):\n images = forms.ModelMultipleChoiceField(\n queryset=Image.objects.all(),\n required=False,\n help_text=\"Select which images should be deployed on this deployment\",\n widget=FilteredSelectMultiple(\n verbose_name=('Images'), is_stacked=False\n )\n )\n flavors = forms.ModelMultipleChoiceField(\n queryset=Flavor.objects.all(),\n required=False,\n help_text=\"Select which flavors should be usable on this deployment\",\n widget=FilteredSelectMultiple(\n verbose_name=('Flavors'), is_stacked=False\n )\n )\n\n class Meta:\n model = Deployment\n many_to_many = [\"flavors\", ]\n\n\n", "metadata": "root.DeploymentAdminForm", "header": "['module', '___EOS___']", "index": 704 }, { "content": " def __init__(self, *args, **kwargs):\n request = kwargs.pop('request', None)\n super(DeploymentAdminForm, self).__init__(*args, **kwargs)\n\n self.fields['accessControl'].initial = \"allow site \" + \\\n request.user.site.name\n\n if self.instance and self.instance.pk:\n self.fields['images'].initial = [\n x.image for x in self.instance.imagedeployments.all()]\n self.fields['flavors'].initial = self.instance.flavors.all()", "metadata": "root.DeploymentAdminForm.__init__", "header": "['class', 'DeploymentAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 726 }, { "content": " def manipulate_m2m_objs(self, this_obj, selected_objs, all_relations, relation_class, local_attrname, foreign_attrname):\n \"\"\" helper function for handling m2m relations from the MultipleChoiceField\n\n this_obj: the source object we want to link from\n\n selected_objs: a list of destination objects we want to link to\n\n all_relations: the full set of relations involving this_obj, including ones we don't want\n\n relation_class: the class that implements the relation from source to dest\n\n local_attrname: field name representing this_obj in relation_class\n\n foreign_attrname: field name representing selected_objs in relation_class\n\n This function will remove all newobjclass relations from this_obj\n that are not contained in selected_objs, and add any relations that\n are in selected_objs but don't exist in the data model yet.\n \"\"\"\n\n existing_dest_objs = []\n for relation in list(all_relations):\n if getattr(relation, foreign_attrname) not in selected_objs:\n # print \"deleting site\", sdp.site\n relation.delete()\n else:\n existing_dest_objs.append(getattr(relation, foreign_attrname))\n\n for dest_obj in selected_objs:\n if dest_obj not in existing_dest_objs:\n # print \"adding site\", site\n kwargs = {foreign_attrname: dest_obj, local_attrname: this_obj}\n relation = relation_class(**kwargs)\n relation.save()", "metadata": "root.DeploymentAdminForm.manipulate_m2m_objs", "header": "['class', 'DeploymentAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 738 }, { "content": " def save(self, commit=True):\n deployment = super(DeploymentAdminForm, self).save(commit=False)\n\n if commit:\n deployment.save()\n # this has to be done after save() if/when a deployment is first\n # created\n deployment.flavors = self.cleaned_data['flavors']\n\n if deployment.pk:\n # save_m2m() doesn't seem to work with 'through' relations. So we\n # create/destroy the through models ourselves. There has to be\n # a better way...\n\n self.manipulate_m2m_objs(deployment, self.cleaned_data[\n 'images'], deployment.imagedeployments.all(), ImageDeployments, \"deployment\", \"image\")\n # manipulate_m2m_objs doesn't work for Flavor/Deployment relationship\n # so well handle that manually here\n for flavor in deployment.flavors.all():\n if getattr(flavor, 'name') not in self.cleaned_data['flavors']:\n deployment.flavors.remove(flavor)\n for flavor in self.cleaned_data['flavors']:\n if flavor not in deployment.flavors.all():\n flavor.deployments.add(deployment)\n\n self.save_m2m()\n\n return deployment", "metadata": "root.DeploymentAdminForm.save", "header": "['class', 'DeploymentAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 773 }, { "content": "class DeploymentAdminROForm(DeploymentAdminForm):\n", "metadata": "root.DeploymentAdminROForm", "header": "['module', '___EOS___']", "index": 803 }, { "content": " def save(self, commit=True):\n raise PermissionDenied", "metadata": "root.DeploymentAdminROForm.save", "header": "['class', 'DeploymentAdminROForm', '(', 'DeploymentAdminForm', ')', ':', '___EOS___']", "index": 805 }, { "content": "class SiteAssocInline(XOSTabularInline):\n model = Site.deployments.through\n extra = 0\n suit_classes = 'suit-tab suit-tab-sites'", "metadata": "root.SiteAssocInline", "header": "['module', '___EOS___']", "index": 809 }, { "content": "class DeploymentAdmin(XOSBaseAdmin):\n model = Deployment\n fieldList = ['backend_status_text', 'name',\n 'images', 'flavors', 'accessControl']\n fieldsets = [\n (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]\n # node no longer directly connected to deployment\n #inlines = [DeploymentPrivilegeInline,NodeInline,TagInline,ImageDeploymentsInline]\n inlines = [DeploymentPrivilegeInline, TagInline,\n ImageDeploymentsInline, SiteDeploymentInline]\n list_display = ['backend_status_icon', 'name']\n list_display_links = ('backend_status_icon', 'name', )\n readonly_fields = ('backend_status_text', )\n\n user_readonly_fields = ['name']\n\n # nodes no longer direclty connected to deployments\n suit_form_tabs = (('general', 'Deployment Details'),\n ('deploymentprivileges', 'Privileges'), ('sitedeployments', 'Sites'))\n", "metadata": "root.DeploymentAdmin", "header": "['module', '___EOS___']", "index": 815 }, { "content": " def get_form(self, request, obj=None, **kwargs):\n if request.user.isReadOnlyUser() or not request.user.is_admin:\n kwargs[\"form\"] = DeploymentAdminROForm\n else:\n kwargs[\"form\"] = DeploymentAdminForm\n adminForm = super(DeploymentAdmin, self).get_form(\n request, obj, **kwargs)\n\n # from stackexchange: pass the request object into the form\n\n class AdminFormMetaClass(adminForm):\n\n def __new__(cls, *args, **kwargs):\n kwargs['request'] = request\n return adminForm(*args, **kwargs)\n\n return AdminFormMetaClass", "metadata": "root.DeploymentAdmin.get_form", "header": "['class', 'DeploymentAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 835 }, { "content": "class ControllerAdminForm(forms.ModelForm):\n backend_disabled = forms.BooleanField(required=False)\n\n class Meta:\n model = Controller\n\n", "metadata": "root.ControllerAdminForm", "header": "['module', '___EOS___']", "index": 854 }, { "content": " def __init__(self, *args, **kwargs):\n request = kwargs.pop('request', None)\n super(ControllerAdminForm, self).__init__(*args, **kwargs)\n\n if self.instance and self.instance.pk:\n self.fields['backend_disabled'].initial = self.instance.get_backend_register(\n 'disabled', False)\n else:\n # defaults when adding new controller\n self.fields['backend_disabled'].initial = False", "metadata": "root.ControllerAdminForm.__init__", "header": "['class', 'ControllerAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 860 }, { "content": " def save(self, commit=True):\n self.instance.set_backend_register(\n \"disabled\", self.cleaned_data[\"backend_disabled\"])\n return super(ControllerAdminForm, self).save(commit=commit)", "metadata": "root.ControllerAdminForm.save", "header": "['class', 'ControllerAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 871 }, { "content": "class ControllerAdmin(XOSBaseAdmin):\n model = Controller\n fieldList = ['deployment', 'name', 'backend_type', 'backend_disabled', 'version', 'auth_url', 'admin_user',\n 'admin_tenant', 'admin_password', 'domain', 'rabbit_host', 'rabbit_user', 'rabbit_password']\n fieldsets = [\n (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]\n inlines = [ControllerSiteInline] # ,ControllerImagesInline]\n list_display = ['backend_status_icon', 'name', 'version', 'backend_type']\n list_display_links = ('backend_status_icon', 'name', )\n readonly_fields = ('backend_status_text',)\n form = ControllerAdminForm\n\n user_readonly_fields = []\n\n\n\n", "metadata": "root.ControllerAdmin", "header": "['module', '___EOS___']", "index": 877 }, { "content": " def save_model(self, request, obj, form, change):\n # update openstack connection to use this site/tenant\n obj.save_by_user(request.user)", "metadata": "root.ControllerAdmin.save_model", "header": "['class', 'ControllerAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 891 }, { "content": " def delete_model(self, request, obj):\n obj.delete_by_user(request.user)", "metadata": "root.ControllerAdmin.delete_model", "header": "['class', 'ControllerAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 895 }, { "content": " def queryset(self, request):\n return Controller.select_by_user(request.user)", "metadata": "root.ControllerAdmin.queryset", "header": "['class', 'ControllerAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 898 }, { "content": " @property\n def suit_form_tabs(self):\n tabs = [('general', 'Controller Details'),\n ]\n\n request = getattr(_thread_locals, \"request\", None)\n if request and request.user.is_admin:\n tabs.append(('admin-only', 'Admin-Only'))\n\n return tabs", "metadata": "root.ControllerAdmin.suit_form_tabs", "header": "['class', 'ControllerAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 901 }, { "content": "class TenantAttributeAdmin(XOSBaseAdmin):\n model = TenantAttribute\n list_display = ('backend_status_icon', 'tenant', 'name', 'value')\n list_display_links = ('backend_status_icon', 'name')\n fieldList = ('backend_status_text', 'tenant', 'name', 'value', )\n fieldsets = [\n (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]\n readonly_fields = ('backend_status_text', )\n\n suit_form_tabs = (('general', 'Tenant Root Details'),\n )", "metadata": "root.TenantAttributeAdmin", "header": "['module', '___EOS___']", "index": 913 }, { "content": "class TenantAttrAsTabInline(XOSTabularInline):\n model = TenantAttribute\n fields = ['name', 'value']\n extra = 0\n suit_classes = 'suit-tab suit-tab-tenantattrs'", "metadata": "root.TenantAttrAsTabInline", "header": "['module', '___EOS___']", "index": 926 }, { "content": "class TenantRootRoleAdmin(XOSBaseAdmin):\n model = TenantRootRole\n fields = ('role',)", "metadata": "root.TenantRootRoleAdmin", "header": "['module', '___EOS___']", "index": 933 }, { "content": "class TenantRootTenantInline(XOSTabularInline):\n model = Tenant\n fields = ['provider_service', 'subscriber_root']\n extra = 0\n suit_classes = 'suit-tab suit-tab-tenantroots'\n fk_name = 'subscriber_root'\n verbose_name = 'subscribed tenant'\n verbose_name_plural = 'subscribed tenants'\n\n # def queryset(self, request):\n # qs = super(TenantRootTenantInline, self).queryset(request)\n # return qs.filter(kind=\"coarse\")", "metadata": "root.TenantRootTenantInline", "header": "['module', '___EOS___']", "index": 938 }, { "content": "class TenantRootPrivilegeInline(XOSTabularInline):\n model = TenantRootPrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-tenantrootprivileges'\n fields = ['backend_status_icon', 'user', 'role', 'tenant_root']\n readonly_fields = ('backend_status_icon', )\n", "metadata": "root.TenantRootPrivilegeInline", "header": "['module', '___EOS___']", "index": 952 }, { "content": " def queryset(self, request):\n return TenantRootPrivilege.select_by_user(request.user)", "metadata": "root.TenantRootPrivilegeInline.queryset", "header": "['class', 'TenantRootPrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 959 }, { "content": "class TenantRootAdmin(XOSBaseAdmin):\n model = TenantRoot\n list_display = ('backend_status_icon', 'name', 'kind')\n list_display_links = ('backend_status_icon', 'name')\n fieldList = ('backend_status_text', 'name', 'kind', )\n fieldsets = [\n (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]\n inlines = (TenantRootTenantInline, TenantRootPrivilegeInline)\n readonly_fields = ('backend_status_text', )\n\n suit_form_tabs = (('general', 'Tenant Root Details'),\n ('tenantroots', 'Tenancy'),\n ('tenantrootprivileges', 'Privileges')\n )", "metadata": "root.TenantRootAdmin", "header": "['module', '___EOS___']", "index": 963 }, { "content": "class TenantRoleAdmin(XOSBaseAdmin):\n \"\"\"Admin for TenantRoles.\"\"\"\n model = TenantRole\n fields = ('role',)", "metadata": "root.TenantRoleAdmin", "header": "['module', '___EOS___']", "index": 979 }, { "content": "class TenantPrivilegeInline(XOSTabularInline):\n \"\"\"Inline for adding a TenantPrivilege to a Tenant.\"\"\"\n model = TenantPrivilege\n extra = 0\n suit_classes = 'suit-tab suit-tab-tenantprivileges'\n fields = ['backend_status_icon', 'user', 'role', 'tenant']\n readonly_fields = ('backend_status_icon', )\n", "metadata": "root.TenantPrivilegeInline", "header": "['module', '___EOS___']", "index": 985 }, { "content": " def queryset(self, request):\n return TenantPrivilege.select_by_user(request.user)", "metadata": "root.TenantPrivilegeInline.queryset", "header": "['class', 'TenantPrivilegeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 993 }, { "content": "class ProviderTenantInline(XOSTabularInline):\n model = CoarseTenant\n fields = ['provider_service', 'subscriber_service', 'connect_method']\n extra = 0\n suit_classes = 'suit-tab suit-tab-servicetenants'\n fk_name = 'provider_service'\n verbose_name = 'provided tenant'\n verbose_name_plural = 'provided tenants'\n", "metadata": "root.ProviderTenantInline", "header": "['module', '___EOS___']", "index": 997 }, { "content": " def queryset(self, request):\n qs = super(ProviderTenantInline, self).queryset(request)\n return qs.filter(kind=\"coarse\")", "metadata": "root.ProviderTenantInline.queryset", "header": "['class', 'ProviderTenantInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1006 }, { "content": "class SubscriberTenantInline(XOSTabularInline):\n model = CoarseTenant\n fields = ['provider_service', 'subscriber_service', 'connect_method']\n extra = 0\n suit_classes = 'suit-tab suit-tab-servicetenants'\n fk_name = 'subscriber_service'\n verbose_name = 'subscribed tenant'\n verbose_name_plural = 'subscribed tenants'\n", "metadata": "root.SubscriberTenantInline", "header": "['module', '___EOS___']", "index": 1011 }, { "content": " def queryset(self, request):\n qs = super(SubscriberTenantInline, self).queryset(request)\n return qs.filter(kind=\"coarse\")", "metadata": "root.SubscriberTenantInline.queryset", "header": "['class', 'SubscriberTenantInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1020 }, { "content": "class ServiceAttrAsTabInline(XOSTabularInline):\n model = ServiceAttribute\n fields = ['name', 'value']\n extra = 0\n suit_classes = 'suit-tab suit-tab-serviceattrs'", "metadata": "root.ServiceAttrAsTabInline", "header": "['module', '___EOS___']", "index": 1025 }, { "content": "class ServiceAdmin(XOSBaseAdmin):\n list_display = (\"backend_status_icon\", \"name\", \"kind\",\n \"versionNumber\", \"enabled\", \"published\")\n list_display_links = ('backend_status_icon', 'name', )\n fieldList = [\"backend_status_text\", \"name\", \"kind\", \"description\", \"versionNumber\", \"enabled\", \"published\",\n \"view_url\", \"icon_url\", \"public_key\", \"private_key_fn\", \"service_specific_attribute\", \"service_specific_id\"]\n fieldsets = [\n (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]\n inlines = [ServiceAttrAsTabInline, SliceInline, ProviderTenantInline,\n SubscriberTenantInline, ServicePrivilegeInline]\n readonly_fields = ('backend_status_text', )\n\n user_readonly_fields = fieldList\n\n suit_form_tabs = (('general', 'Service Details'),\n ('slices', 'Slices'),\n ('serviceattrs', 'Additional Attributes'),\n ('servicetenants', 'Tenancy'),\n ('serviceprivileges', 'Privileges')\n )", "metadata": "root.ServiceAdmin", "header": "['module', '___EOS___']", "index": 1032 }, { "content": "class SiteNodeInline(XOSTabularInline):\n model = Node\n fields = ['name', 'site_deployment']\n extra = 0\n suit_classes = 'suit-tab suit-tab-nodes'\n", "metadata": "root.SiteNodeInline", "header": "['module', '___EOS___']", "index": 1054 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n # only display site deployments associated with this site\n if db_field.name == 'site_deployment':\n kwargs['queryset'] = SiteDeployment.objects.filter(\n site__id=int(request.path.split('/')[-2]))\n\n return super(SiteNodeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SiteNodeInline.formfield_for_foreignkey", "header": "['class', 'SiteNodeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1060 }, { "content": "class SiteAdmin(XOSBaseAdmin):\n #fieldList = ['backend_status_text', 'name', 'site_url', 'enabled', 'is_public', 'login_base', 'accountLink','location']\n fieldList = ['backend_status_text', 'name', 'site_url', 'enabled',\n 'login_base', 'location', 'is_public', 'hosts_nodes', 'hosts_users']\n fieldsets = [\n (None, {'fields': fieldList, 'classes': [\n 'suit-tab suit-tab-general']}),\n #('Deployment Networks', {'fields': ['deployments'], 'classes':['suit-tab suit-tab-deployments']}),\n ]\n #readonly_fields = ['backend_status_text', 'accountLink']\n readonly_fields = ['backend_status_text']\n\n #user_readonly_fields = ['name', 'deployments','site_url', 'enabled', 'is_public', 'login_base', 'accountLink']\n user_readonly_fields = ['name', 'deployments', 'site_url',\n 'enabled', 'is_public', 'login_base', 'hosts_nodes', 'hosts_users']\n\n list_display = ('backend_status_icon', 'name',\n 'login_base', 'site_url', 'enabled')\n list_display_links = ('backend_status_icon', 'name', )\n filter_horizontal = ('deployments',)\n inlines = [SliceInline, UserInline, TagInline,\n SitePrivilegeInline, SiteNodeInline]\n admin_inlines = [ControllerSiteInline]\n search_fields = ['name']\n\n\n\n\n accountLink.allow_tags = True\n accountLink.short_description = \"Billing\"\n\n", "metadata": "root.SiteAdmin", "header": "['module', '___EOS___']", "index": 1069 }, { "content": " @property\n def suit_form_tabs(self):\n tabs = [('general', 'Site Details'),\n ('users', 'Users'),\n ('siteprivileges', 'Privileges'),\n ('slices', 'Slices'),\n ('nodes', 'Nodes'),\n ]\n\n request = getattr(_thread_locals, \"request\", None)\n if request and request.user.is_admin:\n tabs.append(('admin-only', 'Admin-Only'))\n\n return tabs", "metadata": "root.SiteAdmin.suit_form_tabs", "header": "['class', 'SiteAdmin', '(', 'XOSBaseAdmin', ')', ':', '___NEWLINE___', \"#fieldList = ['backend_status_text', 'name', 'site_url', 'enabled', 'is_public', 'login_base', 'accountLink','location']\", '___NL___', '___EOS___']", "index": 1094 }, { "content": " def queryset(self, request):\n return Site.select_by_user(request.user)", "metadata": "root.SiteAdmin.queryset", "header": "['class', 'SiteAdmin', '(', 'XOSBaseAdmin', ')', ':', '___NEWLINE___', \"#fieldList = ['backend_status_text', 'name', 'site_url', 'enabled', 'is_public', 'login_base', 'accountLink','location']\", '___NL___', '___EOS___']", "index": 1109 }, { "content": " def get_formsets(self, request, obj=None):\n for inline in self.get_inline_instances(request, obj):\n # hide MyInline in the add view\n if obj is None:\n continue\n if isinstance(inline, InstanceInline):\n inline.model.caller = request.user\n yield inline.get_formset(request, obj)", "metadata": "root.SiteAdmin.get_formsets", "header": "['class', 'SiteAdmin', '(', 'XOSBaseAdmin', ')', ':', '___NEWLINE___', \"#fieldList = ['backend_status_text', 'name', 'site_url', 'enabled', 'is_public', 'login_base', 'accountLink','location']\", '___NL___', '___EOS___']", "index": 1112 }, { "content": " def accountLink(self, obj):\n link_obj = obj.accounts.all()\n if link_obj:\n reverse_path = \"admin:core_account_change\"\n url = reverse(reverse_path, args=(link_obj[0].id,))\n return \"<a href='%s'>%s</a>\" % (url, \"view billing details\")\n else:\n return \"no billing data for this site\"", "metadata": "root.SiteAdmin.accountLink", "header": "['class', 'SiteAdmin', '(', 'XOSBaseAdmin', ')', ':', '___NEWLINE___', \"#fieldList = ['backend_status_text', 'name', 'site_url', 'enabled', 'is_public', 'login_base', 'accountLink','location']\", '___NL___', '___EOS___']", "index": 1121 }, { "content": " def save_model(self, request, obj, form, change):\n # update openstack connection to use this site/tenant\n obj.save_by_user(request.user)", "metadata": "root.SiteAdmin.save_model", "header": "['class', 'SiteAdmin', '(', 'XOSBaseAdmin', ')', ':', '___NEWLINE___', \"#fieldList = ['backend_status_text', 'name', 'site_url', 'enabled', 'is_public', 'login_base', 'accountLink','location']\", '___NL___', '___EOS___']", "index": 1132 }, { "content": " def delete_model(self, request, obj):\n obj.delete_by_user(request.user)", "metadata": "root.SiteAdmin.delete_model", "header": "['class', 'SiteAdmin', '(', 'XOSBaseAdmin', ')', ':', '___NEWLINE___', \"#fieldList = ['backend_status_text', 'name', 'site_url', 'enabled', 'is_public', 'login_base', 'accountLink','location']\", '___NL___', '___EOS___']", "index": 1136 }, { "content": "class SitePrivilegeAdmin(XOSBaseAdmin):\n fieldList = ['backend_status_text', 'user', 'site', 'role']\n fieldsets = [\n (None, {'fields': fieldList, 'classes': ['collapse']})\n ]\n readonly_fields = ('backend_status_text', )\n list_display = ('backend_status_icon', 'user', 'site', 'role')\n list_display_links = list_display\n user_readonly_fields = fieldList\n user_readonly_inlines = []\n\n", "metadata": "root.SitePrivilegeAdmin", "header": "['module', '___EOS___']", "index": 1140 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'site':\n if not request.user.is_admin:\n # only show sites where user is an admin or pi\n sites = set()\n for site_privilege in SitePrivilege.objects.filer(user=request.user):\n if site_privilege.role.role_type in ['admin', 'pi']:\n sites.add(site_privilege.site)\n kwargs['queryset'] = Site.objects.filter(site__in=list(sites))\n\n if db_field.name == 'user':\n if not request.user.is_admin:\n # only show users from sites where caller has admin or pi role\n roles = Role.objects.filter(role_type__in=['admin', 'pi'])\n site_privileges = SitePrivilege.objects.filter(\n user=request.user).filter(role__in=roles)\n sites = [site_privilege.site for site_privilege in site_privileges]\n site_privileges = SitePrivilege.objects.filter(site__in=sites)\n emails = [\n site_privilege.user.email for site_privilege in site_privileges]\n users = User.objects.filter(email__in=emails)\n kwargs['queryset'] = users\n\n return super(SitePrivilegeAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SitePrivilegeAdmin.formfield_for_foreignkey", "header": "['class', 'SitePrivilegeAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1151 }, { "content": " def queryset(self, request):\n # admins can see all privileges. Users can only see privileges at sites\n # where they have the admin role or pi role.\n qs = super(SitePrivilegeAdmin, self).queryset(request)\n # if not request.user.is_admin:\n # roles = Role.objects.filter(role_type__in=['admin', 'pi'])\n # site_privileges = SitePrivilege.objects.filter(user=request.user).filter(role__in=roles)\n # login_bases = [site_privilege.site.login_base for site_privilege in site_privileges]\n # sites = Site.objects.filter(login_base__in=login_bases)\n # qs = qs.filter(site__in=sites)\n return qs", "metadata": "root.SitePrivilegeAdmin.queryset", "header": "['class', 'SitePrivilegeAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1176 }, { "content": "class SliceForm(forms.ModelForm):\n\n class Meta:\n model = Slice\n widgets = {\n 'service': LinkedSelect\n }\n", "metadata": "root.SliceForm", "header": "['module', '___EOS___']", "index": 1189 }, { "content": " def clean(self):\n cleaned_data = super(SliceForm, self).clean()\n name = cleaned_data.get('name')\n site = cleaned_data.get('site')\n slice_id = self.instance.id\n if not site and slice_id:\n site = Slice.objects.get(id=slice_id).site\n if (not isinstance(site, Site)):\n # previous code indicates 'site' could be a site_id and not a site?\n site = Slice.objects.get(id=site.id)\n if not name.startswith(site.login_base):\n raise forms.ValidationError(\n 'slice name must begin with %s' % site.login_base)\n return cleaned_data", "metadata": "root.SliceForm.clean", "header": "['class', 'SliceForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 1197 }, { "content": "class ControllerSliceInline(XOSTabularInline):\n model = ControllerSlice\n extra = 0\n verbose_name = \"Controller Slices\"\n verbose_name_plural = \"Controller Slices\"\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['backend_status_icon', 'controller', 'tenant_id']\n readonly_fields = ('backend_status_icon', 'controller')", "metadata": "root.ControllerSliceInline", "header": "['module', '___EOS___']", "index": 1213 }, { "content": "class SliceAdmin(XOSBaseAdmin):\n form = SliceForm\n fieldList = ['backend_status_text', 'site', 'name', 'serviceClass', 'enabled',\n 'description', 'service', 'slice_url', 'max_instances', \"default_isolation\", \"network\"]\n fieldsets = [('Slice Details', {'fields': fieldList, 'classes': [\n 'suit-tab suit-tab-general']}), ]\n readonly_fields = ('backend_status_text', )\n list_display = ('backend_status_icon', 'name', 'site',\n 'serviceClass', 'slice_url', 'max_instances')\n list_display_links = ('backend_status_icon', 'name', )\n normal_inlines = [SlicePrivilegeInline, InstanceInline,\n TagInline, ReservationInline, SliceNetworkInline]\n inlines = normal_inlines\n admin_inlines = [ControllerSliceInline]\n suit_form_includes = (('slice_instance_tab.html', 'bottom', 'instances'),)\n\n user_readonly_fields = fieldList\n\n\n\n\n\n\n\n\n", "metadata": "root.SliceAdmin", "header": "['module', '___EOS___']", "index": 1223 }, { "content": " @property\n def suit_form_tabs(self):\n tabs = [('general', 'Slice Details'),\n ('slicenetworks', 'Networks'),\n ('sliceprivileges', 'Privileges'),\n ('instances', 'Instances'),\n #('reservations','Reservations'),\n ('tags', 'Tags'),\n ]\n\n request = getattr(_thread_locals, \"request\", None)\n if request and request.user.is_admin:\n tabs.append(('admin-only', 'Admin-Only'))\n\n return tabs", "metadata": "root.SliceAdmin.suit_form_tabs", "header": "['class', 'SliceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1241 }, { "content": " def add_view(self, request, form_url='', extra_context=None):\n # Ugly hack for CORD\n self.inlines = self.normal_inlines\n # revert to default read-only fields\n self.readonly_fields = ('backend_status_text',)\n return super(SliceAdmin, self).add_view(request, form_url, extra_context=extra_context)", "metadata": "root.SliceAdmin.add_view", "header": "['class', 'SliceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1257 }, { "content": " def change_view(self, request, object_id, form_url='', extra_context=None):\n # cannot change the site of an existing slice so make the site field\n # read only\n if object_id:\n self.readonly_fields = ('backend_status_text', 'site')\n\n return super(SliceAdmin, self).change_view(request, object_id, form_url)", "metadata": "root.SliceAdmin.change_view", "header": "['class', 'SliceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1264 }, { "content": " def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):\n deployment_nodes = []\n for node in Node.objects.all():\n deployment_nodes.append(\n (node.site_deployment.deployment.id, node.id, node.name))\n\n deployment_flavors = []\n for flavor in Flavor.objects.all():\n for deployment in flavor.deployments.all():\n deployment_flavors.append(\n (deployment.id, flavor.id, flavor.name))\n\n deployment_images = []\n for image in Image.objects.all():\n for deployment_image in image.imagedeployments.all():\n deployment_images.append(\n (deployment_image.deployment.id, image.id, image.name))\n\n site_login_bases = []\n for site in Site.objects.all():\n site_login_bases.append((site.id, site.login_base))\n\n context[\"deployment_nodes\"] = deployment_nodes\n context[\"deployment_flavors\"] = deployment_flavors\n context[\"deployment_images\"] = deployment_images\n context[\"site_login_bases\"] = site_login_bases\n return super(SliceAdmin, self).render_change_form(request, context, add, change, form_url, obj)", "metadata": "root.SliceAdmin.render_change_form", "header": "['class', 'SliceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1272 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'site':\n kwargs['queryset'] = Site.select_by_user(\n request.user).filter(hosts_users=True)\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"update_slice_prefix(this, $($(this).closest('fieldset')[0]).find('.field-name input')[0].id)\"})\n\n return super(SliceAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SliceAdmin.formfield_for_foreignkey", "header": "['class', 'SliceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1300 }, { "content": " def queryset(self, request):\n # admins can see all keys. Users can only see slices they belong to.\n return Slice.select_by_user(request.user)", "metadata": "root.SliceAdmin.queryset", "header": "['class', 'SliceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1309 }, { "content": " def get_formsets(self, request, obj=None):\n for inline in self.get_inline_instances(request, obj):\n # hide MyInline in the add view\n if obj is None:\n continue\n if isinstance(inline, InstanceInline):\n inline.model.caller = request.user\n yield inline.get_formset(request, obj)", "metadata": "root.SliceAdmin.get_formsets", "header": "['class', 'SliceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1313 }, { "content": " def add_extra_context(self, request, extra_context):\n super(SliceAdmin, self).add_extra_context(request, extra_context)\n # set context[\"slice_id\"] to the PK passed in the URL to this view\n if len(request.resolver_match.args) > 0:\n extra_context[\"slice_id\"] = request.resolver_match.args[0]", "metadata": "root.SliceAdmin.add_extra_context", "header": "['class', 'SliceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1322 }, { "content": " def UNUSED_get_inline_instances(self, request, obj=None):\n # HACK for CORD to do something special on vcpe slice page\n # this was a good idea, but failed miserably, as something still\n # expects there to be a deployment field.\n # XXX this approach is better than clobbering self.inlines, so\n # try to make this work post-demo.\n if (obj is not None) and (obj.name == \"mysite_vcpe\"):\n cord_vcpe_inlines = [SlicePrivilegeInline, CordInstanceInline,\n TagInline, ReservationInline, SliceNetworkInline]\n\n inlines = []\n for inline_class in cord_vcpe_inlines:\n inlines.append(inline_class(self.model, self.admin_site))\n else:\n inlines = super(SliceAdmin, self).get_inline_instances(\n request, obj)\n\n return inlines", "metadata": "root.SliceAdmin.UNUSED_get_inline_instances", "header": "['class', 'SliceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1328 }, { "content": "class SlicePrivilegeAdmin(XOSBaseAdmin):\n fieldsets = [\n (None, {'fields': ['backend_status_text', 'user', 'slice', 'role']})\n ]\n readonly_fields = ('backend_status_text', )\n list_display = ('backend_status_icon', 'user', 'slice', 'role')\n list_display_links = list_display\n\n user_readonly_fields = ['user', 'slice', 'role']\n user_readonly_inlines = []\n\n\n\n", "metadata": "root.SlicePrivilegeAdmin", "header": "['module', '___EOS___']", "index": 1348 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'slice':\n kwargs['queryset'] = Slice.select_by_user(request.user)\n\n if db_field.name == 'user':\n kwargs['queryset'] = User.select_by_user(request.user)\n\n return super(SlicePrivilegeAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.SlicePrivilegeAdmin.formfield_for_foreignkey", "header": "['class', 'SlicePrivilegeAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1359 }, { "content": " def queryset(self, request):\n # admins can see all memberships. Users can only see memberships of\n # slices where they have the admin role.\n return SlicePrivilege.select_by_user(request.user)", "metadata": "root.SlicePrivilegeAdmin.queryset", "header": "['class', 'SlicePrivilegeAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1368 }, { "content": " def save_model(self, request, obj, form, change):\n # update openstack connection to use this site/tenant\n auth = request.session.get('auth', {})\n auth['tenant'] = obj.slice.slicename\n obj.os_manager = OpenStackManager(auth=auth, caller=request.user)\n obj.save()", "metadata": "root.SlicePrivilegeAdmin.save_model", "header": "['class', 'SlicePrivilegeAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1373 }, { "content": " def delete_model(self, request, obj):\n # update openstack connection to use this site/tenant\n auth = request.session.get('auth', {})\n auth['tenant'] = obj.slice.slicename\n obj.os_manager = OpenStackManager(auth=auth, caller=request.user)\n obj.delete()", "metadata": "root.SlicePrivilegeAdmin.delete_model", "header": "['class', 'SlicePrivilegeAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1380 }, { "content": "class ImageAdmin(XOSBaseAdmin):\n\n fieldsets = [('Image Details',\n {'fields': ['backend_status_text', 'name', 'kind', 'disk_format', 'container_format', 'tag', 'path'],\n 'classes': ['suit-tab suit-tab-general']})\n ]\n readonly_fields = ('backend_status_text', )\n\n suit_form_tabs = (('general', 'Image Details'), ('instances', 'Instances'),\n ('imagedeployments', 'Deployments'), ('admin-only', 'Admin-Only'))\n\n inlines = [InstanceInline, ControllerImagesInline]\n\n user_readonly_fields = ['name', 'disk_format',\n 'container_format', 'tag', 'path']\n\n list_display = ['backend_status_icon', 'name', 'kind']\n list_display_links = ('backend_status_icon', 'name', )", "metadata": "root.ImageAdmin", "header": "['module', '___EOS___']", "index": 1388 }, { "content": "class NodeForm(forms.ModelForm):\n nodelabels = forms.ModelMultipleChoiceField(\n queryset=NodeLabel.objects.all(),\n required=False,\n help_text=\"Select which labels apply to this node\",\n widget=FilteredSelectMultiple(\n verbose_name=('Labels'), is_stacked=False\n )\n )\n\n class Meta:\n model = Node\n widgets = {\n 'site': LinkedSelect,\n 'deployment': LinkedSelect\n }\n\n", "metadata": "root.NodeForm", "header": "['module', '___EOS___']", "index": 1408 }, { "content": " def __init__(self, *args, **kwargs):\n request = kwargs.pop('request', None)\n super(NodeForm, self).__init__(*args, **kwargs)\n\n if self.instance and self.instance.pk:\n self.fields['nodelabels'].initial = self.instance.nodelabels.all()", "metadata": "root.NodeForm.__init__", "header": "['class', 'NodeForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 1425 }, { "content": " def save(self, commit=True):\n node = super(NodeForm, self).save(commit=False)\n\n node.nodelabels = self.cleaned_data['nodelabels']\n\n if commit:\n node.save()\n\n return node", "metadata": "root.NodeForm.save", "header": "['class', 'NodeForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 1432 }, { "content": "class NodeLabelAdmin(XOSBaseAdmin):\n list_display = ('name',)\n list_display_links = ('name', )\n\n fields = ('name', )", "metadata": "root.NodeLabelAdmin", "header": "['module', '___EOS___']", "index": 1443 }, { "content": "class NodeAdmin(XOSBaseAdmin):\n form = NodeForm\n list_display = ('backend_status_icon', 'name', 'site_deployment')\n list_display_links = ('backend_status_icon', 'name', )\n list_filter = ('site_deployment',)\n\n inlines = [TagInline, InstanceInline]\n fieldsets = [('Node Details', {'fields': ['backend_status_text', 'name', 'site_deployment'], 'classes':['suit-tab suit-tab-details']}),\n ('Labels', {'fields': ['nodelabels'], 'classes':['suit-tab suit-tab-labels']})]\n readonly_fields = ('backend_status_text', )\n\n user_readonly_fields = ['name', 'site_deployment']\n user_readonly_inlines = [TagInline, InstanceInline]\n\n suit_form_tabs = (('details', 'Node Details'), ('instances',\n 'Instances'), ('labels', 'Labels'), ('tags', 'Tags'))\n", "metadata": "root.NodeAdmin", "header": "['module', '___EOS___']", "index": 1450 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'site':\n kwargs['queryset'] = Site.select_by_user(\n request.user).filter(hosts_nodes=True)\n\n field = super(NodeAdmin, self).formfield_for_foreignkey(\n db_field, request, **kwargs)\n\n return field", "metadata": "root.NodeAdmin.formfield_for_foreignkey", "header": "['class', 'NodeAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1467 }, { "content": "class InstanceForm(forms.ModelForm):\n\n class Meta:\n model = Instance\n ip = forms.CharField(widget=PlainTextWidget)\n instance_name = forms.CharField(widget=PlainTextWidget)\n widgets = {\n 'ip': PlainTextWidget(),\n 'instance_name': PlainTextWidget(),\n 'instance_id': PlainTextWidget(),\n 'slice': LinkedSelect,\n 'deployment': LinkedSelect,\n 'node': LinkedSelect,\n 'image': LinkedSelect\n }", "metadata": "root.InstanceForm", "header": "['module', '___EOS___']", "index": 1478 }, { "content": "class TagAdmin(XOSBaseAdmin):\n list_display = ['backend_status_icon', 'service',\n 'name', 'value', 'content_type', 'content_object', ]\n list_display_links = list_display\n user_readonly_fields = ['service', 'name',\n 'value', 'content_type', 'content_object', ]\n user_readonly_inlines = []", "metadata": "root.TagAdmin", "header": "['module', '___EOS___']", "index": 1495 }, { "content": "class InstancePortInline(XOSTabularInline):\n fields = ['backend_status_icon', 'network', 'instance', 'ip', 'mac']\n readonly_fields = (\"backend_status_icon\", \"ip\", \"mac\")\n model = Port\n #selflink_fieldname = \"network\"\n extra = 0\n verbose_name_plural = \"Ports\"\n verbose_name = \"Port\"\n suit_classes = 'suit-tab suit-tab-ports'", "metadata": "root.InstancePortInline", "header": "['module', '___EOS___']", "index": 1504 }, { "content": "class InstanceAdmin(XOSBaseAdmin):\n form = InstanceForm\n fieldsets = [\n ('Instance Details', {'fields': ['backend_status_text', 'slice', 'deployment', 'isolation', 'flavor', 'image', 'node',\n 'parent', 'all_ips_string', 'instance_id', 'instance_name', 'ssh_command', ], 'classes': ['suit-tab suit-tab-general'], }),\n ('Container Settings', {'fields': ['volumes'], 'classes': [\n 'suit-tab suit-tab-container'], }),\n ]\n readonly_fields = ('backend_status_text', 'ssh_command', 'all_ips_string')\n list_display = ['backend_status_icon', 'all_ips_string', 'instance_id',\n 'instance_name', 'isolation', 'slice', 'flavor', 'image', 'node', 'deployment']\n list_display_links = ('backend_status_icon',\n 'all_ips_string', 'instance_id', )\n\n suit_form_tabs = (('general', 'Instance Details'), ('ports', 'Ports'),\n ('container', 'Container Settings'), ('tags', 'Tags'))\n\n inlines = [TagInline, InstancePortInline]\n\n user_readonly_fields = ['slice', 'deployment',\n 'node', 'ip', 'instance_name', 'flavor', 'image']\n\n\n\n\n\n\n\n\n # def save_model(self, request, obj, form, change):\n # # update openstack connection to use this site/tenant\n # auth = request.session.get('auth', {})\n # auth['tenant'] = obj.slice.name\n # obj.os_manager = OpenStackManager(auth=auth, caller=request.user)\n # obj.creator = request.user\n # obj.save()\n\n # def delete_model(self, request, obj):\n # # update openstack connection to use this site/tenant\n # auth = request.session.get('auth', {})\n # auth['tenant'] = obj.slice.name\n # obj.os_manager = OpenStackManager(auth=auth, caller=request.user)\n # obj.delete()", "metadata": "root.InstanceAdmin", "header": "['module', '___EOS___']", "index": 1515 }, { "content": " def ssh_command(self, obj):\n ssh_command = obj.get_ssh_command()\n if ssh_command:\n return ssh_command\n else:\n return \"(not available)\"", "metadata": "root.InstanceAdmin.ssh_command", "header": "['class', 'InstanceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1537 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'slice':\n kwargs['queryset'] = Slice.select_by_user(request.user)\n\n return super(InstanceAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.InstanceAdmin.formfield_for_foreignkey", "header": "['class', 'InstanceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1544 }, { "content": " def queryset(self, request):\n # admins can see all instances. Users can only see instances of\n # the slices they belong to.\n return Instance.select_by_user(request.user)", "metadata": "root.InstanceAdmin.queryset", "header": "['class', 'InstanceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1550 }, { "content": " def add_view(self, request, form_url='', extra_context=None):\n self.readonly_fields = ('backend_status_text',\n 'ssh_command', 'all_ips_string')\n return super(InstanceAdmin, self).add_view(request, form_url, extra_context)", "metadata": "root.InstanceAdmin.add_view", "header": "['class', 'InstanceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1555 }, { "content": " def change_view(self, request, object_id, extra_context=None):\n self.readonly_fields = ('backend_status_text', 'ssh_command',\n 'all_ips_string', 'deployment', 'slice', 'flavor', 'image', 'node')\n # for XOSAdminMixin.change_view's user_readonly_fields switching code\n self.readonly_save = self.readonly_fields\n return super(InstanceAdmin, self).change_view(request, object_id, extra_context)", "metadata": "root.InstanceAdmin.change_view", "header": "['class', 'InstanceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1560 }, { "content": " def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):\n deployment_nodes = []\n# for node in Node.objects.all():\n for node in Node.objects.order_by(\"name\"):\n deployment_nodes.append(\n (node.site_deployment.deployment.id, node.id, node.name))\n\n deployment_flavors = []\n for flavor in Flavor.objects.all():\n for deployment in flavor.deployments.all():\n deployment_flavors.append(\n (deployment.id, flavor.id, flavor.name))\n\n deployment_images = []\n for image in Image.objects.all():\n for deployment_image in image.imagedeployments.all():\n deployment_images.append(\n (deployment_image.deployment.id, image.id, image.name))\n\n site_login_bases = []\n for site in Site.objects.all():\n site_login_bases.append((site.id, site.login_base))\n\n context[\"deployment_nodes\"] = deployment_nodes\n context[\"deployment_flavors\"] = deployment_flavors\n context[\"deployment_images\"] = deployment_images\n context[\"site_login_bases\"] = site_login_bases\n return super(InstanceAdmin, self).render_change_form(request, context, add, change, form_url, obj)", "metadata": "root.InstanceAdmin.render_change_form", "header": "['class', 'InstanceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1567 }, { "content": " def formfield_for_foreignkey(self, db_field, request=None, **kwargs):\n if db_field.name == 'deployment':\n kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(\n sitedeployments__nodes__isnull=False).distinct()\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_deployment_changed(this);\"})\n if db_field.name == 'flavor':\n kwargs['widget'] = forms.Select(\n attrs={'onChange': \"instance_flavor_changed(this);\"})\n\n field = super(InstanceAdmin, self).formfield_for_foreignkey(\n db_field, request, **kwargs)\n\n return field", "metadata": "root.InstanceAdmin.formfield_for_foreignkey", "header": "['class', 'InstanceAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1596 }, { "content": "class UserCreationForm(forms.ModelForm):\n \"\"\"A form for creating new users. Includes all the required\n fields, plus a repeated password.\"\"\"\n password1 = forms.CharField(label='Password', widget=forms.PasswordInput)\n password2 = forms.CharField(\n label='Password confirmation', widget=forms.PasswordInput)\n\n class Meta:\n model = User\n fields = ('email', 'firstname', 'lastname', 'phone', 'public_key')\n\n", "metadata": "root.UserCreationForm", "header": "['module', '___EOS___']", "index": 1660 }, { "content": " def clean_password2(self):\n # Check that the two password entries match\n password1 = self.cleaned_data.get(\"password1\")\n password2 = self.cleaned_data.get(\"password2\")\n if password1 and password2 and password1 != password2:\n raise forms.ValidationError(\"Passwords don't match\")\n return password2", "metadata": "root.UserCreationForm.clean_password2", "header": "['class', 'UserCreationForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 1671 }, { "content": " def save(self, commit=True):\n # Save the provided password in hashed format\n user = super(UserCreationForm, self).save(commit=False)\n user.password = self.cleaned_data[\"password1\"]\n # user.set_password(self.cleaned_data[\"password1\"])\n if commit:\n user.save()\n return user", "metadata": "root.UserCreationForm.save", "header": "['class', 'UserCreationForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 1679 }, { "content": "class UserChangeForm(forms.ModelForm):\n \"\"\"A form for updating users. Includes all the fields on\n the user, but replaces the password field with admin's\n password hash display field.\n \"\"\"\n password = ReadOnlyPasswordHashField(label='Password',\n help_text='<a href=\\\"password/\\\">Change Password</a>.')\n\n PROFILE_CHOICES = ((None, '------'), ('regular',\n 'Regular user'), ('cp', 'Content Provider'))\n profile = forms.ChoiceField(\n choices=PROFILE_CHOICES, required=False, label=\"Quick Profile\")\n\n class Meta:\n model = User\n widgets = {'public_key': UploadTextareaWidget, }\n\n", "metadata": "root.UserChangeForm", "header": "['module', '___EOS___']", "index": 1689 }, { "content": " def clean_password(self):\n # Regardless of what the user provides, return the initial value.\n # This is done here, rather than on the field, because the\n # field does not have access to the initial value\n return self.initial[\"password\"]", "metadata": "root.UserChangeForm.clean_password", "header": "['class', 'UserChangeForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 1706 }, { "content": " def save(self, *args, **kwargs):\n if self.cleaned_data['profile']:\n self.instance.apply_profile(self.cleaned_data['profile'])\n\n return super(UserChangeForm, self).save(*args, **kwargs)", "metadata": "root.UserChangeForm.save", "header": "['class', 'UserChangeForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 1712 }, { "content": "class UserDashboardViewInline(XOSTabularInline):\n model = UserDashboardView\n extra = 0\n suit_classes = 'suit-tab suit-tab-dashboards'\n fields = ['user', 'dashboardView', 'order']", "metadata": "root.UserDashboardViewInline", "header": "['module', '___EOS___']", "index": 1719 }, { "content": "class ControllerUserInline(XOSTabularInline):\n model = ControllerUser\n extra = 0\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['controller', 'user', 'kuser_id']", "metadata": "root.ControllerUserInline", "header": "['module', '___EOS___']", "index": 1726 }, { "content": "class UserAdmin(XOSAdminMixin, UserAdmin):\n # Note: Make sure XOSAdminMixin is listed before\n # admin.ModelAdmin in the class declaration.\n\n class Meta:\n app_label = \"core\"\n\n # The forms to add and change user instances\n form = UserChangeForm\n add_form = UserCreationForm\n\n # The fields to be used in displaying the User model.\n # These override the definitions on the base UserAdmin\n # that reference specific fields on auth.User.\n list_display = ('backend_status_icon', 'email',\n 'firstname', 'lastname', 'site', 'last_login')\n list_display_links = (\"email\",)\n list_filter = ('site',)\n inlines = [SlicePrivilegeInline, SitePrivilegeInline]\n admin_inlines = [ControllerUserInline]\n fieldListLoginDetails = ['backend_status_text', 'email', 'site', 'password', 'is_active',\n 'is_readonly', 'is_admin', 'is_appuser', 'public_key', 'login_page', 'profile']\n fieldListContactInfo = ['firstname', 'lastname', 'phone', 'timezone']\n\n fieldsets = (\n ('Login Details', {'fields': ['backend_status_text', 'email', 'site', 'password', 'is_active',\n 'is_readonly', 'is_admin', 'is_appuser', 'public_key'], 'classes': ['suit-tab suit-tab-general']}),\n ('Contact Information', {'fields': (\n 'firstname', 'lastname', 'phone', 'timezone'), 'classes': ['suit-tab suit-tab-contact']}),\n #('Important dates', {'fields': ('last_login',)}),\n )\n add_fieldsets = (\n (None, {\n 'classes': ('wide',),\n 'fields': ('site', 'email', 'firstname', 'lastname', 'is_admin', 'is_readonly', 'is_appuser', 'phone', 'public_key', 'password1', 'password2')},\n ),\n )\n readonly_fields = ('backend_status_text', )\n search_fields = ('email',)\n ordering = ('email',)\n filter_horizontal = ()\n\n user_readonly_fields = fieldListLoginDetails + fieldListContactInfo\n\n\n\n", "metadata": "root.UserAdmin", "header": "['module', '___EOS___']", "index": 1733 }, { "content": " @property\n def suit_form_tabs(self):\n if getattr(_thread_locals, \"obj\", None) is None:\n return []\n else:\n tabs = [('general', 'Login Details'),\n ('contact', 'Contact Information'),\n ('sliceprivileges', 'Slice Privileges'),\n ('siteprivileges', 'Site Privileges')]\n\n request = getattr(_thread_locals, \"request\", None)\n if request and request.user.is_admin:\n tabs.append(('admin-only', 'Admin-Only'))\n\n return tabs", "metadata": "root.UserAdmin.suit_form_tabs", "header": "['class', 'UserAdmin', '(', 'XOSAdminMixin', ',', 'UserAdmin', ')', ':', '___NEWLINE___', '# Note: Make sure XOSAdminMixin is listed before', '___NL___', '# admin.ModelAdmin in the class declaration.', '___NL___', '___EOS___']", "index": 1777 }, { "content": " def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'site':\n kwargs['queryset'] = Site.select_by_user(\n request.user).filter(hosts_users=True)\n\n return super(UserAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)", "metadata": "root.UserAdmin.formfield_for_foreignkey", "header": "['class', 'UserAdmin', '(', 'XOSAdminMixin', ',', 'UserAdmin', ')', ':', '___NEWLINE___', '# Note: Make sure XOSAdminMixin is listed before', '___NL___', '# admin.ModelAdmin in the class declaration.', '___NL___', '___EOS___']", "index": 1793 }, { "content": " def queryset(self, request):\n return User.select_by_user(request.user)", "metadata": "root.UserAdmin.queryset", "header": "['class', 'UserAdmin', '(', 'XOSAdminMixin', ',', 'UserAdmin', ')', ':', '___NEWLINE___', '# Note: Make sure XOSAdminMixin is listed before', '___NL___', '# admin.ModelAdmin in the class declaration.', '___NL___', '___EOS___']", "index": 1800 }, { "content": " def get_form(self, request, obj=None, **kwargs):\n # copy login details list\n login_details_fields = list(self.fieldListLoginDetails)\n if not request.user.is_admin:\n # only admins can see 'is_admin' and 'is_readonly' fields\n if 'is_admin' in login_details_fields:\n login_details_fields.remove('is_admin')\n if 'is_readonly' in login_details_fields:\n login_details_fields.remove('is_readonly')\n if 'is_appuser' in login_details_fields:\n login_details_fields.remove('is_admin')\n if 'profile' in login_details_fields:\n login_details_fields.remove('profile')\n # if len(request.user.siteprivileges.filter(role__role = 'pi')) > 0:\n # only admins and pis can change a user's site\n # self.readonly_fields = ('backend_status_text', 'site')\n self.fieldsets = (\n ('Login Details', {'fields': login_details_fields,\n 'classes': ['suit-tab suit-tab-general']}),\n ('Contact Information', {\n 'fields': self.fieldListContactInfo, 'classes': ['suit-tab suit-tab-contact']}),\n )\n return super(UserAdmin, self).get_form(request, obj, **kwargs)", "metadata": "root.UserAdmin.get_form", "header": "['class', 'UserAdmin', '(', 'XOSAdminMixin', ',', 'UserAdmin', ')', ':', '___NEWLINE___', '# Note: Make sure XOSAdminMixin is listed before', '___NL___', '# admin.ModelAdmin in the class declaration.', '___NL___', '___EOS___']", "index": 1803 }, { "content": "class ControllerDashboardViewInline(XOSTabularInline):\n model = ControllerDashboardView\n extra = 0\n fields = [\"controller\", \"url\"]\n suit_classes = 'suit-tab suit-tab-controllers'", "metadata": "root.ControllerDashboardViewInline", "header": "['module', '___EOS___']", "index": 1828 }, { "content": "class DashboardViewAdmin(XOSBaseAdmin):\n fieldsets = [('Dashboard View Details',\n {'fields': ['backend_status_text', 'name', 'url', 'enabled', 'deployments'],\n 'classes': ['suit-tab suit-tab-general']})\n ]\n list_display = [\"name\", \"enabled\", \"url\"]\n readonly_fields = ('backend_status_text', )\n inlines = [ControllerDashboardViewInline]\n\n suit_form_tabs = (('general', 'Dashboard View Details'),\n ('controllers', 'Per-controller Dashboard Details'))", "metadata": "root.DashboardViewAdmin", "header": "['module', '___EOS___']", "index": 1835 }, { "content": "class ServiceResourceInline(XOSTabularInline):\n model = ServiceResource\n extra = 0", "metadata": "root.ServiceResourceInline", "header": "['module', '___EOS___']", "index": 1848 }, { "content": "class ServiceClassAdmin(XOSBaseAdmin):\n list_display = ('backend_status_icon', 'name',\n 'commitment', 'membershipFee')\n list_display_links = ('backend_status_icon', 'name', )\n inlines = [ServiceResourceInline]\n\n user_readonly_fields = ['name', 'commitment', 'membershipFee']\n user_readonly_inlines = []", "metadata": "root.ServiceClassAdmin", "header": "['module', '___EOS___']", "index": 1853 }, { "content": "class ReservedResourceInline(XOSTabularInline):\n model = ReservedResource\n extra = 0\n suit_classes = 'suit-tab suit-tab-reservedresources'\n\n", "metadata": "root.ReservedResourceInline", "header": "['module', '___EOS___']", "index": 1863 }, { "content": " def formfield_for_foreignkey(self, db_field, request=None, **kwargs):\n field = super(ReservedResourceInline, self).formfield_for_foreignkey(\n db_field, request, **kwargs)\n\n if db_field.name == 'resource':\n # restrict resources to those that the slice's service class allows\n if request._slice is not None:\n field.queryset = field.queryset.filter(\n serviceClass=request._slice.serviceClass, calendarReservable=True)\n if len(field.queryset) > 0:\n field.initial = field.queryset.all()[0]\n else:\n field.queryset = field.queryset.none()\n elif db_field.name == 'instance':\n # restrict instances to those that belong to the slice\n if request._slice is not None:\n field.queryset = field.queryset.filter(slice=request._slice)\n else:\n field.queryset = field.queryset.none()\n\n return field", "metadata": "root.ReservedResourceInline.formfield_for_foreignkey", "header": "['class', 'ReservedResourceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1868 }, { "content": " def queryset(self, request):\n return ReservedResource.select_by_user(request.user)", "metadata": "root.ReservedResourceInline.queryset", "header": "['class', 'ReservedResourceInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 1890 }, { "content": "class ReservationChangeForm(forms.ModelForm):\n\n class Meta:\n model = Reservation\n widgets = {\n 'slice': LinkedSelect\n }", "metadata": "root.ReservationChangeForm", "header": "['module', '___EOS___']", "index": 1894 }, { "content": "class ReservationAddForm(forms.ModelForm):\n slice = forms.ModelChoiceField(queryset=Slice.objects.all(), widget=forms.Select(\n attrs={\"onChange\": \"document.getElementById('id_refresh').value=1; submit()\"}))\n refresh = forms.CharField(widget=forms.HiddenInput())\n\n class Media:\n css = {'all': ('xos.css',)} # .field-refresh { display: none; }\n\n\n class Meta:\n model = Reservation\n widgets = {\n 'slice': LinkedSelect\n }", "metadata": "root.ReservationAddForm", "header": "['module', '___EOS___']", "index": 1903 }, { "content": " def clean_slice(self):\n slice = self.cleaned_data.get(\"slice\")\n x = ServiceResource.objects.filter(\n serviceClass=slice.serviceClass, calendarReservable=True)\n if len(x) == 0:\n raise forms.ValidationError(\n \"The slice you selected does not have a service class that allows reservations\")\n return slice", "metadata": "root.ReservationAddForm.clean_slice", "header": "['class', 'ReservationAddForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 1911 }, { "content": "class ReservationAddRefreshForm(ReservationAddForm):\n \"\"\" This form is displayed when the Reservation Form receives an update\n from the Slice dropdown onChange handler. It doesn't validate the\n data and doesn't save the data. This will cause the form to be\n redrawn.\n \"\"\"\n\n \"\"\" don't validate anything other than slice \"\"\"\n dont_validate_fields = (\"startTime\", \"duration\")\n\n\n \"\"\" don't save anything \"\"\"\n", "metadata": "root.ReservationAddRefreshForm", "header": "['module', '___EOS___']", "index": 1927 }, { "content": " def full_clean(self):\n result = super(ReservationAddForm, self).full_clean()\n\n for fieldname in self.dont_validate_fields:\n if fieldname in self._errors:\n del self._errors[fieldname]\n\n return result", "metadata": "root.ReservationAddRefreshForm.full_clean", "header": "['class', 'ReservationAddRefreshForm', '(', 'ReservationAddForm', ')', ':', '___EOS___']", "index": 1937 }, { "content": " def is_valid(self):\n return False", "metadata": "root.ReservationAddRefreshForm.is_valid", "header": "['class', 'ReservationAddRefreshForm', '(', 'ReservationAddForm', ')', ':', '___EOS___']", "index": 1948 }, { "content": "class ReservationAdmin(XOSBaseAdmin):\n fieldList = ['backend_status_text', 'slice', 'startTime', 'duration']\n fieldsets = [('Reservation Details', {\n 'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]\n readonly_fields = ('backend_status_text', )\n list_display = ('startTime', 'duration')\n form = ReservationAddForm\n\n suit_form_tabs = (('general', 'Reservation Details'),\n ('reservedresources', 'Reserved Resources'))\n\n inlines = [ReservedResourceInline]\n user_readonly_fields = fieldList\n\n\n\n\n", "metadata": "root.ReservationAdmin", "header": "['module', '___EOS___']", "index": 1952 }, { "content": " def add_view(self, request, form_url='', extra_context=None):\n timezone.activate(request.user.timezone)\n request._refresh = False\n request._slice = None\n if request.method == 'POST':\n # \"refresh\" will be set to \"1\" if the form was submitted due to\n # a change in the Slice dropdown.\n if request.POST.get(\"refresh\", \"1\") == \"1\":\n request._refresh = True\n request.POST[\"refresh\"] = \"0\"\n\n # Keep track of the slice that was selected, so the\n # reservedResource inline can filter items for the slice.\n request._slice = request.POST.get(\"slice\", None)\n if (request._slice is not None):\n request._slice = Slice.objects.get(id=request._slice)\n\n result = super(ReservationAdmin, self).add_view(\n request, form_url, extra_context)\n return result", "metadata": "root.ReservationAdmin.add_view", "header": "['class', 'ReservationAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1966 }, { "content": " def changelist_view(self, request, extra_context=None):\n timezone.activate(request.user.timezone)\n return super(ReservationAdmin, self).changelist_view(request, extra_context)", "metadata": "root.ReservationAdmin.changelist_view", "header": "['class', 'ReservationAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1987 }, { "content": " def get_form(self, request, obj=None, **kwargs):\n request._obj_ = obj\n if obj is not None:\n # For changes, set request._slice to the slice already set in the\n # object.\n request._slice = obj.slice\n self.form = ReservationChangeForm\n else:\n if getattr(request, \"_refresh\", False):\n self.form = ReservationAddRefreshForm\n else:\n self.form = ReservationAddForm\n return super(ReservationAdmin, self).get_form(request, obj, **kwargs)", "metadata": "root.ReservationAdmin.get_form", "header": "['class', 'ReservationAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 1991 }, { "content": " def get_readonly_fields(self, request, obj=None):\n if (obj is not None):\n # Prevent slice from being changed after the reservation has been\n # created.\n return ['slice']\n else:\n return []", "metadata": "root.ReservationAdmin.get_readonly_fields", "header": "['class', 'ReservationAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 2005 }, { "content": " def queryset(self, request):\n return Reservation.select_by_user(request.user)", "metadata": "root.ReservationAdmin.queryset", "header": "['class', 'ReservationAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 2013 }, { "content": "class NetworkParameterTypeAdmin(XOSBaseAdmin):\n list_display = (\"backend_status_icon\", \"name\", )\n list_display_links = ('backend_status_icon', 'name', )\n user_readonly_fields = ['name']\n user_readonly_inlines = []", "metadata": "root.NetworkParameterTypeAdmin", "header": "['module', '___EOS___']", "index": 2017 }, { "content": "class RouterAdmin(XOSBaseAdmin):\n list_display = (\"backend_status_icon\", \"name\", )\n list_display_links = ('backend_status_icon', 'name', )\n user_readonly_fields = ['name']\n user_readonly_inlines = []", "metadata": "root.RouterAdmin", "header": "['module', '___EOS___']", "index": 2024 }, { "content": "class RouterInline(XOSTabularInline):\n model = Router.networks.through\n extra = 0\n verbose_name_plural = \"Routers\"\n verbose_name = \"Router\"\n suit_classes = 'suit-tab suit-tab-routers'", "metadata": "root.RouterInline", "header": "['module', '___EOS___']", "index": 2031 }, { "content": "class NetworkParameterInline(PlStackGenericTabularInline):\n model = NetworkParameter\n extra = 0\n verbose_name_plural = \"Parameters\"\n verbose_name = \"Parameter\"\n suit_classes = 'suit-tab suit-tab-netparams'\n fields = ['backend_status_icon', 'parameter', 'value']\n readonly_fields = ('backend_status_icon', )", "metadata": "root.NetworkParameterInline", "header": "['module', '___EOS___']", "index": 2039 }, { "content": "class NetworkPortInline(XOSTabularInline):\n fields = ['backend_status_icon', 'network', 'instance', 'ip', 'mac']\n readonly_fields = (\"backend_status_icon\", \"ip\", \"mac\")\n model = Port\n #selflink_fieldname = \"instance\"\n extra = 0\n verbose_name_plural = \"Ports\"\n verbose_name = \"Port\"\n suit_classes = 'suit-tab suit-tab-ports'", "metadata": "root.NetworkPortInline", "header": "['module', '___EOS___']", "index": 2049 }, { "content": "class NetworkSlicesInline(XOSTabularInline):\n model = NetworkSlice\n selflink_fieldname = \"slice\"\n extra = 0\n verbose_name_plural = \"Slices\"\n verbose_name = \"Slice\"\n suit_classes = 'suit-tab suit-tab-networkslices'\n fields = ['backend_status_icon', 'network', 'slice']\n readonly_fields = ('backend_status_icon', )", "metadata": "root.NetworkSlicesInline", "header": "['module', '___EOS___']", "index": 2060 }, { "content": "class ControllerNetworkInline(XOSTabularInline):\n model = ControllerNetwork\n extra = 0\n verbose_name_plural = \"Controller Networks\"\n verbose_name = \"Controller Network\"\n suit_classes = 'suit-tab suit-tab-admin-only'\n fields = ['backend_status_icon', 'controller',\n 'net_id', 'subnet_id', 'subnet']\n readonly_fields = ('backend_status_icon', )", "metadata": "root.ControllerNetworkInline", "header": "['module', '___EOS___']", "index": 2071 }, { "content": "class NetworkForm(forms.ModelForm):\n\n class Meta:\n model = Network\n widgets = {\n 'topologyParameters': UploadTextareaWidget,\n 'controllerParameters': UploadTextareaWidget,\n }", "metadata": "root.NetworkForm", "header": "['module', '___EOS___']", "index": 2082 }, { "content": "class NetworkAdmin(XOSBaseAdmin):\n list_display = (\"backend_status_icon\", \"name\", \"subnet\", \"ports\", \"labels\")\n list_display_links = ('backend_status_icon', 'name', )\n readonly_fields = (\"subnet\", )\n inlines = [NetworkParameterInline, NetworkPortInline,\n NetworkSlicesInline, RouterInline]\n admin_inlines = [ControllerNetworkInline]\n\n form = NetworkForm\n\n fieldsets = [\n (None, {'fields': ['backend_status_text', 'name', 'template', 'ports', 'labels',\n 'owner', 'guaranteed_bandwidth', 'permit_all_slices',\n 'permitted_slices', 'network_id', 'router_id', 'subnet_id',\n 'subnet', 'autoconnect'],\n 'classes':['suit-tab suit-tab-general']}),\n (None, {'fields': ['topology_parameters', 'controller_url', 'controller_parameters'],\n 'classes':['suit-tab suit-tab-sdn']}),\n ]\n\n readonly_fields = ('backend_status_text', )\n user_readonly_fields = ['name', 'template', 'ports', 'labels', 'owner', 'guaranteed_bandwidth',\n 'permit_all_slices', 'permitted_slices', 'network_id', 'router_id',\n 'subnet_id', 'subnet', 'autoconnect']\n", "metadata": "root.NetworkAdmin", "header": "['module', '___EOS___']", "index": 2092 }, { "content": " @property\n def suit_form_tabs(self):\n tabs = [('general', 'Network Details'),\n ('sdn', 'SDN Configuration'),\n ('netparams', 'Parameters'),\n ('ports', 'Ports'),\n ('networkslices', 'Slices'),\n ('routers', 'Routers'),\n ]\n\n request = getattr(_thread_locals, \"request\", None)\n if request and request.user.is_admin:\n tabs.append(('admin-only', 'Admin-Only'))\n\n return tabs", "metadata": "root.NetworkAdmin.suit_form_tabs", "header": "['class', 'NetworkAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 2117 }, { "content": "class NetworkTemplateAdmin(XOSBaseAdmin):\n list_display = (\"backend_status_icon\", \"name\",\n \"guaranteed_bandwidth\", \"visibility\")\n list_display_links = ('backend_status_icon', 'name', )\n user_readonly_fields = [\"name\", \"guaranteed_bandwidth\", \"visibility\"]\n user_readonly_inlines = []\n inlines = [NetworkParameterInline, ]\n fieldsets = [\n (None, {'fields': ['name', 'description', 'guaranteed_bandwidth', 'visibility', 'translation', 'access', 'shared_network_name', 'shared_network_id', 'topology_kind', 'controller_kind'],\n 'classes':['suit-tab suit-tab-general']}), ]\n suit_form_tabs = (('general', 'Network Template Details'),\n ('netparams', 'Parameters'))", "metadata": "root.NetworkTemplateAdmin", "header": "['module', '___EOS___']", "index": 2134 }, { "content": "class PortAdmin(XOSBaseAdmin):\n list_display = (\"backend_status_icon\", \"id\", \"ip\")\n list_display_links = ('backend_status_icon', 'id')\n readonly_fields = (\"subnet\", )\n inlines = [NetworkParameterInline]\n\n fieldsets = [\n (None, {'fields': ['backend_status_text', 'network', 'instance', 'ip', 'port_id', 'mac'],\n 'classes':['suit-tab suit-tab-general']}),\n ]\n\n readonly_fields = ('backend_status_text', )\n suit_form_tabs = (('general', 'Port Details'), ('netparams', 'Parameters'))", "metadata": "root.PortAdmin", "header": "['module', '___EOS___']", "index": 2148 }, { "content": "class FlavorAdmin(XOSBaseAdmin):\n list_display = (\"backend_status_icon\", \"name\",\n \"flavor\", \"order\", \"default\")\n list_display_links = (\"backend_status_icon\", \"name\")\n user_readonly_fields = (\"name\", \"flavor\")\n fields = (\"name\", \"description\", \"flavor\", \"order\", \"default\")", "metadata": "root.FlavorAdmin", "header": "['module', '___EOS___']", "index": 2163 }, { "content": "def cache_credentials(sender, user, request, **kwds):\n auth = {'username': request.POST['username'],\n 'password': request.POST['password']}\n request.session['auth'] = auth", "metadata": "root.cache_credentials", "header": "['module', '___EOS___']", "index": 2173 }, { "content": "def dollar_field(fieldName, short_description):\n def newFunc(self, obj):\n try:\n x = \"$ %0.2f\" % float(getattr(obj, fieldName, 0.0))\n except:\n x = getattr(obj, fieldName, 0.0)\n return x\n newFunc.short_description = short_description\n return newFunc", "metadata": "root.dollar_field", "header": "['module', '___EOS___']", "index": 2180 }, { "content": "def right_dollar_field(fieldName, short_description):\n def newFunc(self, obj):\n try:\n #x= '<div align=right style=\"width:6em\">$ %0.2f</div>' % float(getattr(obj, fieldName, 0.0))\n x = '<div align=right>$ %0.2f</div>' % float(\n getattr(obj, fieldName, 0.0))\n except:\n x = getattr(obj, fieldName, 0.0)\n return x\n newFunc.short_description = short_description\n newFunc.allow_tags = True\n return newFunc", "metadata": "root.right_dollar_field", "header": "['module', '___EOS___']", "index": 2191 }, { "content": "class InvoiceChargeInline(XOSTabularInline):\n model = Charge\n extra = 0\n verbose_name_plural = \"Charges\"\n verbose_name = \"Charge\"\n exclude = ['account']\n fields = [\"date\", \"kind\", \"state\", \"object\",\n \"coreHours\", \"dollar_amount\", \"slice\"]\n readonly_fields = [\"date\", \"kind\", \"state\",\n \"object\", \"coreHours\", \"dollar_amount\", \"slice\"]\n can_delete = False\n max_num = 0\n\n dollar_amount = right_dollar_field(\"amount\", \"Amount\")", "metadata": "root.InvoiceChargeInline", "header": "['module', '___EOS___']", "index": 2205 }, { "content": "class InvoiceAdmin(admin.ModelAdmin):\n list_display = (\"date\", \"account\")\n\n inlines = [InvoiceChargeInline]\n\n fields = [\"date\", \"account\", \"dollar_amount\"]\n readonly_fields = [\"date\", \"account\", \"dollar_amount\"]\n\n dollar_amount = dollar_field(\"amount\", \"Amount\")", "metadata": "root.InvoiceAdmin", "header": "['module', '___EOS___']", "index": 2221 }, { "content": "class InvoiceInline(XOSTabularInline):\n model = Invoice\n extra = 0\n verbose_name_plural = \"Invoices\"\n verbose_name = \"Invoice\"\n fields = [\"date\", \"dollar_amount\"]\n readonly_fields = [\"date\", \"dollar_amount\"]\n suit_classes = 'suit-tab suit-tab-accountinvoice'\n can_delete = False\n max_num = 0\n\n dollar_amount = right_dollar_field(\"amount\", \"Amount\")", "metadata": "root.InvoiceInline", "header": "['module', '___EOS___']", "index": 2232 }, { "content": "class PendingChargeInline(XOSTabularInline):\n model = Charge\n extra = 0\n verbose_name_plural = \"Charges\"\n verbose_name = \"Charge\"\n exclude = [\"invoice\"]\n fields = [\"date\", \"kind\", \"state\", \"object\",\n \"coreHours\", \"dollar_amount\", \"slice\"]\n readonly_fields = [\"date\", \"kind\", \"state\",\n \"object\", \"coreHours\", \"dollar_amount\", \"slice\"]\n suit_classes = 'suit-tab suit-tab-accountpendingcharges'\n can_delete = False\n max_num = 0\n\n\n dollar_amount = right_dollar_field(\"amount\", \"Amount\")", "metadata": "root.PendingChargeInline", "header": "['module', '___EOS___']", "index": 2246 }, { "content": " def queryset(self, request):\n qs = super(PendingChargeInline, self).queryset(request)\n qs = qs.filter(state=\"pending\")\n return qs", "metadata": "root.PendingChargeInline.queryset", "header": "['class', 'PendingChargeInline', '(', 'XOSTabularInline', ')', ':', '___EOS___']", "index": 2260 }, { "content": "class PaymentInline(XOSTabularInline):\n model = Payment\n extra = 1\n verbose_name_plural = \"Payments\"\n verbose_name = \"Payment\"\n fields = [\"date\", \"dollar_amount\"]\n readonly_fields = [\"date\", \"dollar_amount\"]\n suit_classes = 'suit-tab suit-tab-accountpayments'\n can_delete = False\n max_num = 0\n\n dollar_amount = right_dollar_field(\"amount\", \"Amount\")", "metadata": "root.PaymentInline", "header": "['module', '___EOS___']", "index": 2268 }, { "content": "class AccountAdmin(admin.ModelAdmin):\n list_display = (\"site\", \"balance_due\")\n\n inlines = [InvoiceInline, PaymentInline, PendingChargeInline]\n\n fieldsets = [\n (None, {'fields': ['site', 'dollar_balance_due', 'dollar_total_invoices', 'dollar_total_payments'], 'classes':['suit-tab suit-tab-general']}), ]\n\n readonly_fields = ['site', 'dollar_balance_due',\n 'dollar_total_invoices', 'dollar_total_payments']\n\n suit_form_tabs = (\n ('general', 'Account Details'),\n ('accountinvoice', 'Invoices'),\n ('accountpayments', 'Payments'),\n ('accountpendingcharges', 'Pending Charges'),\n )\n\n dollar_balance_due = dollar_field(\"balance_due\", \"Balance Due\")\n dollar_total_invoices = dollar_field(\"total_invoices\", \"Total Invoices\")\n dollar_total_payments = dollar_field(\"total_payments\", \"Total Payments\")", "metadata": "root.AccountAdmin", "header": "['module', '___EOS___']", "index": 2282 }, { "content": "class ProgramForm(forms.ModelForm):\n\n class Meta:\n model = Program\n widgets = {\n 'contents': UploadTextareaWidget(attrs={'rows': 20, 'cols': 80, 'class': \"input-xxlarge\"}),\n 'description': forms.Textarea(attrs={'rows': 3, 'cols': 80, 'class': 'input-xxlarge'}),\n 'messages': forms.Textarea(attrs={'rows': 20, 'cols': 80, 'class': 'input-xxlarge'}),\n 'output': forms.Textarea(attrs={'rows': 3, 'cols': 80, 'class': 'input-xxlarge'})\n }", "metadata": "root.ProgramForm", "header": "['module', '___EOS___']", "index": 2305 }, { "content": "class ProgramAdmin(XOSBaseAdmin):\n list_display = (\"name\", \"status\")\n list_display_links = ('name', \"status\")\n\n form = ProgramForm\n\n fieldsets = [\n (None, {'fields': ['name', 'command', 'kind', 'description', 'output', 'status'],\n 'classes':['suit-tab suit-tab-general']}),\n (None, {'fields': ['contents'],\n 'classes':['suit-tab suit-tab-contents']}),\n (None, {'fields': ['messages'],\n 'classes':['suit-tab suit-tab-messages']}),\n ]\n\n readonly_fields = (\"status\",)\n", "metadata": "root.ProgramAdmin", "header": "['module', '___EOS___']", "index": 2317 }, { "content": " @property\n def suit_form_tabs(self):\n tabs = [('general', 'Program Details'),\n ('contents', 'Program Source'),\n ('messages', 'Messages'),\n ]\n\n request = getattr(_thread_locals, \"request\", None)\n if request and request.user.is_admin:\n tabs.append(('admin-only', 'Admin-Only'))\n\n return tabs", "metadata": "root.ProgramAdmin.suit_form_tabs", "header": "['class', 'ProgramAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 2334 }, { "content": "class AddressPoolForm(forms.ModelForm):\n\n class Meta:\n model = Program\n widgets = {\n 'addresses': UploadTextareaWidget(attrs={'rows': 20, 'cols': 80, 'class': \"input-xxlarge\"}),\n }", "metadata": "root.AddressPoolForm", "header": "['module', '___EOS___']", "index": 2348 }, { "content": "class AddressPoolAdmin(XOSBaseAdmin):\n list_display = (\"name\", \"cidr\")\n list_display_links = ('name',)\n\n form = AddressPoolForm\n\n fieldsets = [\n (None, {'fields': ['name', 'cidr', 'gateway_ip', 'gateway_mac', 'addresses', 'inuse', 'service'],\n 'classes':['suit-tab suit-tab-general']}),\n ]\n\n readonly_fields = (\"status\",)\n", "metadata": "root.AddressPoolAdmin", "header": "['module', '___EOS___']", "index": 2357 }, { "content": " @property\n def suit_form_tabs(self):\n tabs = [('general', 'Program Details'),\n ('contents', 'Program Source'),\n ('messages', 'Messages'),\n ]\n\n# request=getattr(_thread_locals, \"request\", None)\n# if request and request.user.is_admin:\n# tabs.append( ('admin-only', 'Admin-Only') )\n\n return tabs", "metadata": "root.AddressPoolAdmin.suit_form_tabs", "header": "['class', 'AddressPoolAdmin', '(', 'XOSBaseAdmin', ')', ':', '___EOS___']", "index": 2370 } ]
[ { "span": "from django.contrib.auth.forms import (AdminPasswordChangeForm,\n ReadOnlyPasswordHashField)", "start_line": 10, "start_column": 0, "end_line": 11, "end_column": 65 }, { "span": "from django.contrib.auth.models import Group", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 44 }, { "span": "from django.forms.utils import flatatt, to_current_timezone", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 59 }, { "span": "from django.utils.encoding import force_text, python_2_unicode_compatible", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 73 }, { "span": "from django.utils.html import conditional_escape, format_html", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 61 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cgi_", "import_", "escape_", "as_", "html", "\\u", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", ",_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "widgets_", "import_", "(_", "Admi", "n", "Text", "area", "Widget_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Filter", "ed", "Select", "Multiple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "admin_", "import_", "User", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "forms_", "import_", "(_", "Admi", "n", "Passw", "ord", "Change", "Form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Read", "On", "ly", "Passw", "ord", "Hash", "Field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "signals_", "import_", "user", "\\u", "logged", "\\u", "in_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "import_", "generic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Permi", "ssion", "Denied_", ",_", "Validat", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "No", "Revers", "e", "Match_", ",_", "resolve_", ",_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "utils_", "import_", "flat", "att_", ",_", "to", "\\u", "current", "\\u", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "force", "\\u", "text_", ",_", "python", "\\u", "2", "\\u", "unicode", "\\u", "compatible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "html_", "import_", "conditional", "\\u", "escape_", ",_", "format\\u", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "safe", "string_", "import_", "mark", "\\u", "safe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "text_", "import_", "cap", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openstack_", "._", "manager_", "import_", "Open", "Stack", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "suit_", "._", "widgets_", "import_", "Linke", "d", "Select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thread", " ", "locals", " ", "necessar", "y", " ", "to", " ", "work", " ", "aro", "und", " ", "a", " ", "django", "-", "suit", " ", "issue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "thread", "\\u", "locals_", "=_", "threading_", "._", "local_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ICON", "\\u", "URLS_", "=_", "{_", "\"", "success", "\"_", ":_", "\"/", "static", "/", "admin", "/", "img", "/", "icon", "\\u", "success", ".", "gif", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "clock", "\"_", ":_", "\"/", "static", "/", "admin", "/", "img", "/", "icon", "\\u", "clock", ".", "gif", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "error", "\"_", ":_", "\"/", "static", "/", "admin", "/", "img", "/", "icon", "\\u", "error", ".", "gif", "\"_", "}_", "\\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\\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\\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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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "Containe", "r", "Port", "In", "line", "(", "XO", "ST", "abu", "lar", "In", "line", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fields", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "icon", "',", " ", "'", "network", "',", " ", "'", "container", "',", " ", "'", "ip", "',", " ", "'", "mac", "',", " ", "'", "segmentation", "\\u", "id", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "read", "only", "\\u", "fields", " ", "=", " ", "(\"", "back", "end", "\\u", "status", "\\u", "icon", "\",", " ", "\"", "ip", "\",", " ", "\"", "mac", "\",", " ", "\"", "segmentation", "\\u", "id", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "model", " ", "=", " ", "Port_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", "link", "\\u", "field", "name", " ", "=", " ", "\"", "network", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "extra", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "verbo", "se", "\\u", "name", "\\u", "plural", " ", "=", " ", "\"", "Port", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "verbo", "se", "\\u", "name", " ", "=", " ", "\"", "Port", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "suit", "\\u", "classe", "s", " ", "=", " ", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "port", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "Containe", "r", "Admi", "n", "(", "XO", "SB", "ase", "Admi", "n", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fieldset", "s", " ", "=", " ", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "('", "Containe", "r", " ", "Det", "ail", "s", "',", " ", "{", "'", "fields", "':", " ", "['", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "slice", "',", " ", "'", "node", "',", " ", "'", "docker", "\\u", "image", "',", " ", "'", "volume", "s", "',", " ", "'", "no", "\\u", "sync", "']", ",", " ", "'", "classe", "s", "':", " ", "['", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "']", ",", " ", "})", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "read", "only", "\\u", "fields", " ", "=", " ", "('", "back", "end", "\\u", "status", "\\u", "text", "',", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "list", "\\u", "display", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "icon", "',", " ", "'", "id", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "list", "\\u", "display", "\\u", "link", "s", " ", "=", " ", "('", "back", "end", "\\u", "status", "\\u", "icon", "',", " ", "'", "id", "',", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "suit", "\\u", "form", "\\u", "tabs", " ", "=(", "('", "genera", "l", "',", " ", "'", "Containe", "r", " ", "Det", "ail", "s", "')", ",", " ", "('", "port", "s", "',", " ", "'", "Port", "s", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "inline", "s", " ", "=", " ", "[", "Ta", "g", "In", "line", ",", " ", "Containe", "r", "Port", "In", "line", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key", "(", "self", ",", " ", "db", "\\u", "field", ",", " ", "request", ",", " ", "**", "kwarg", "s", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "db", "\\u", "field", ".", "name", " ", "==", " ", "'", "slice", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "kwarg", "s", "['", "querys", "et", "']", " ", "=", " ", "Slice", ".", "select", "\\u", "by", "\\u", "user", "(", "request", ".", "user", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "super", "(", "Containe", "r", "Admi", "n", ",", " ", "self", ").", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key", "(", "db", "\\u", "field", ",", " ", "request", ",", " ", "**", "kwarg", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "querys", "et", "(", "self", ",", " ", "request", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "admin", "s", " ", "can", " ", "see", " ", "all", " ", "instance", "s", ".", " ", "User", "s", " ", "can", " ", "only", " ", "see", " ", "instance", "s", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "the", " ", "slice", "s", " ", "the", "y", " ", "belo", "ng", " ", "to", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "Containe", "r", ".", "select", "\\u", "by", "\\u", "user", "(", "request", ".", "user", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u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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\\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\\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_", "#", " ", "register", " ", "a", " ", "signal", " ", "tha", "t", " ", "cache", "s", " ", "the", " ", "user", "'", "s", " ", "cred", "ential", "s", " ", "whe", "n", " ", "the", "y", " ", "log", " ", "in_", "\\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\\uDEDENT\\u\\u\\u_", "user", "\\u", "logged", "\\u", "in_", "._", "connect_", "(_", "cache", "\\u", "credentials_", ")_", "\\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\\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\\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_", "#", " ", "No", "w", " ", "register", " ", "the", " ", "new", " ", "User", "Admi", "n", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "User_", ",_", "User", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "...", " ", "and", ",", " ", "sinc", "e", " ", "we", "'", "re", " ", "not", " ", "usi", "ng", " ", "Dj", "ang", "o", "'", "s", " ", "bui", "lti", "n", " ", "permissi", "ons", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unregister", " ", "the", " ", "Group", " ", "model", " ", "from", " ", "admin", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "admin", ".", "site", ".", "unregister", "(", "Group", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "debugg", "ing", " ", "it", " ", "is", " ", "oft", "en", " ", "easi", "er", " ", "to", " ", "see", " ", "all", " ", "the", " ", "classe", "s", ",", " ", "but", " ", "for", " ", "regular", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "the", " ", "top", "-", "level", "s", " ", "shou", "ld", " ", "be", " ", "displayed_", "\\u\\u\\uNL\\u\\u\\u_", "show", "All_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Deployment", "_", ",_", "Deployment", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Controller_", ",_", "Controlle", "r", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Site_", ",_", "Site", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Slice_", ",_", "Slice", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Service_", ",_", "Service", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "admin", ".", "site", ".", "register", "(", "Reserva", "tion", ",", " ", "Reserva", "tion", "Admi", "n", ")_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Network_", ",_", "Network", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Port_", ",_", "Port", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Router_", ",_", "Route", "r", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Network", "Template_", ",_", "Network", "Templa", "te", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Program_", ",_", "Program", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "admin", ".", "site", ".", "register", "(", "Account", ",", " ", "Account", "Admi", "n", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "admin", ".", "site", ".", "register", "(", "Invoice", ",", " ", "Invoice", "Admi", "n", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin_", "._", "site_", "._", "register_", "(_", "Network", "Parameter", "Type_", ",_", "Network", "Parameter", "Type", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Service", "Class_", ",_", "Service", "Class", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Tag_", ",_", "Ta", "g", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Controlle", "r", "Role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Site", "Role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Slice", "Role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Node_", ",_", "Node", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Node", "Label_", ",_", "Node", "Label", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "admin", ".", "site", ".", "register", "(", "Slice", "Privilege", ",", " ", "Slice", "Privilege", "Admi", "n", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "admin", ".", "site", ".", "register", "(", "Site", "Privilege", ",", " ", "Site", "Privilege", "Admi", "n", ")_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Instance_", ",_", "Insta", "nce", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Image_", ",_", "Image", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Dash", "board", "View_", ",_", "Dash", "board", "View", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Flavor_", ",_", "Fla", "vor", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Ten", "ant", "Root_", ",_", "Ten", "ant", "Roo", "t", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Ten", "ant", "Roo", "t", "Role_", ",_", "Ten", "ant", "Roo", "t", "Ro", "le", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Ten", "ant", "Role_", ",_", "Ten", "ant", "Ro", "le", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Ten", "ant", "Attribute_", ",_", "Ten", "ant", "Attribute", "Admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Address", "Pool_", ",_", "Address", "Poo", "l", "Admin_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "back", "end", "\\u", "icon_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "icon_", ",_", "tooltip_", ")_", "=_", "obj_", "._", "get", "\\u", "back", "end", "\\u", "icon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "icon", "\\u", "url_", "=_", "ICON", "\\u", "URLS_", "._", "get_", "(_", "icon_", ",_", "\"", "unknown", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "exponent_", ",_", "last", "\\u", "success_", ",_", "last", "\\u", "failure_", ",_", "failures_", ")_", "=_", "obj_", "._", "get", "\\u", "back", "end", "\\u", "details_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "Ne", "ed", " ", "to", " ", "clean", " ", "this", " ", "up", " ", "by", " ", "separa", "ting", " ", "Javascript", " ", "from", " ", "Python_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "obj_", "._", "pk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "script", " ", "type", "=\"", "text", "/", "javascript", "\">", "$(", "document", ").", "read", "y", "(", "function", " ", "()", " ", "{$", "(\"", "#", "show", "\\u", "deta", "il", "s", "\\u", "%", "d", "\")", ".", "click", "(", "function", " ", "()", " ", "{$", "(\"", "#", "status", "%", "d", "\")", ".", "dialog", "({", "modal", ":", " ", "true", ",", " ", "height", ":", " ", "200", ",", " ", "widt", "h", ":", " ", "200", " ", "})", ";}", ");", "})", ";<", "/", "script", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "(_", "obj_", "._", "pk_", ",_", "obj_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "div_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "div", " ", "style", "=\"", "display", ":", "none", ";", "\"", " ", "id", "=\"", "status", "%", "d", "\"", " ", "title", "=\"", "Det", "ail", "s", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "p", ">", "Back", "off", " ", "Expo", "nent", ":", " ", "%", "r", "</", "p", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "p", ">", "Las", "t", " ", "Success", ":", " ", "%", "r", "</", "p", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "p", ">", "Fail", "ure", "s", ":", " ", "%", "r", "</", "p", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "p", ">", "Las", "t", " ", "Fail", "ure", ":", " ", "%", "r", "</", "p", ">", "\\", "10", ";", " ", " ", "</", "div", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "(_", "obj_", "._", "pk_", ",_", "exponent_", ",_", "last", "\\u", "success_", ",_", "failures_", ",_", "last", "\\u", "failure_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "'<", "a", " ", "id", "=\"", "show", "\\u", "deta", "il", "s", "\\u", "%", "d", "\"", " ", "href", "=\"", "#\"", ">'_", "%_", "obj_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ast", "op_", "=_", "'<", "/", "a", ">'_", "\\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 ", " _", "div_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ast", "op_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tooltip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", " ", "%", "s", " ", "<", "span", " ", "style", "=\"", "min", "-", "widt", "h", ":", "16", "px", ";", "\"", " ", "title", "=\"", "%", "s", "\">", "%", "s", "<", "img", " ", "src", "=\"", "%", "s", "\">", "%", "s", "</", "span", ">'_", "%_", "(_", "script_", ",_", "div_", ",_", "tooltip_", ",_", "a_", ",_", "icon", "\\u", "url_", ",_", "ast", "op_", ")_", "\\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_", "'<", "span", " ", "style", "=\"", "min", "-", "widt", "h", ":", "16", "px", ";\">", "<", "img", " ", "src", "=\"", "%", "s", "\">", "</", "span", ">'_", "%_", "icon", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "back", "end", "\\u", "text_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "icon_", ",_", "tooltip_", ")_", "=_", "obj_", "._", "get", "\\u", "back", "end", "\\u", "icon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icon", "\\u", "url_", "=_", "ICON", "\\u", "URLS_", "._", "get_", "(_", "icon_", ",_", "\"", "unknown", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "'<", "img", " ", "src", "=\"", "%", "s", "\">", " ", "%", "s", "'_", "%_", "(_", "icon", "\\u", "url_", ",_", "tooltip_", ")_", "\\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_", "Upload", "Text", "area", "Widget_", "(_", "Admi", "n", "Text", "area", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Upload", "Text", "area", "Widget_", "(_", "Admi", "n", "Text", "area", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "render_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "attrs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "final", "\\u", "attrs_", "=_", "self_", "._", "build", "\\u", "attrs_", "(_", "attrs_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "format\\u", "html_", "(_", "'<", "input", " ", "type", "=\"", "file", "\"", " ", "style", "=\"", "widt", "h", ":", " ", "0", ";", " ", "height", ":", " ", "0", "\"", " ", "id", "=\"", "btn", "\\u", "upload", "\\u", "%", "s", "\"", " ", "on", "Change", "=\"", "upload", "Text", "area", "(", "event", ",\\\\", "'%", "s", "\\\\')", ";\">", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "button", " ", "on", "Click", "=\"$", "(\\\\'", "#", "btn", "\\u", "upload", "\\u", "%", "s", "\\\\')", ".", "click", "();", " ", "return", " ", "fal", "se", ";\">", "Upload", "</", "button", ">'_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "br", "><", "text", "area", "{", "0", "}>", "\\\\", "r", "\\\\", "n", "{", "1", "}", "</", "text", "area", ">'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "[_", "\"", "id", "\"_", "]_", ",_", "attrs_", "[_", "\"", "id", "\"_", "]_", ",_", "attrs_", "[_", "\"", "id", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flat", "att_", "(_", "final", "\\u", "attrs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "text_", "(_", "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_", "class_", "Slide", "r", "Widget_", "(_", "forms_", "._", "Hi", "dde", "n", "Input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Slide", "r", "Widget_", "(_", "forms_", "._", "Hi", "dde", "n", "Input_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "render_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "attrs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "final", "\\u", "attrs_", "=_", "self_", "._", "build", "\\u", "attrs_", "(_", "attrs_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "attrs_", "or_", "attrs_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "[_", "\"", "name", "\"_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "[_", "\"", "value", "\"_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "\"\"\"", "<", "div", " ", "style", "=\"", "widt", "h", ":", "640", "px", "\">", "<", "span", " ", "id", "=\"", "%", "(", "id", ")", "s", "\\u", "label", "\">", "%", "(", "value", ")", "s", "</", "span", "><", "div", " ", "id", "=\"", "%", "(", "id", ")", "s", "\\u", "slide", "r", "\"", " ", "style", "=\"", "float", ":", "right", ";", "widt", "h", ":", "610", "px", ";", "marg", "in", "-", "top", ":", "5", "px", "\">", "</", "div", "><", "/", "div", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "script", ">", "\\", "10", ";", " ", " ", " ", " ", "$(", "function", "()", " ", "{", "\\", "10", ";", " ", " ", "$(", "\"#", "%", "(", "id", ")", "s", "\\u", "slide", "r", "\")", ".", "slide", "r", "({", "\\", "10", ";", " ", " ", " ", " ", " ", "value", ":", " ", "%", "(", "value", ")", "s", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "slide", ":", " ", "function", "(", "event", ",", " ", "ui", ")", " ", "{", " ", "$(", "\"#", "%", "(", "id", ")", "s", "\")", ".", "val", "(", " ", "ui", ".", "value", " ", ");", " ", "$(", "\"#", "%", "(", "id", ")", "s", "\\u", "label", "\")", ".", "html", "(", "ui", ".", "value", ");", " ", "},", "\\", "10", ";", " ", " ", " ", " ", " ", "})", ";", "\\", "10", ";", " ", " ", " ", " ", "})", ";", "\\", "10", ";", " ", " ", " ", " ", "</", "script", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "input", " ", "type", "=\"", "hidden", "\"", " ", "id", "=\"", "%", "(", "id", ")", "s", "\"", " ", "name", "=\"", "%", "(", "name", ")", "s", "\"", " ", "value", "=\"", "%", "(", "value", ")", "s", "\">", "</", "input", ">", "\\", "10", ";", " ", " ", " ", " ", " ", "\"\"\"_", "%_", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "html_", "._", "replace_", "(_", "\"{\"_", ",_", "\"{", "{\"_", ")_", "._", "replace_", "(_", "\"}\"_", ",_", "\"}}", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "format\\u", "html_", "(_", "html_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flat", "att_", "(_", "final", "\\u", "attrs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "text_", "(_", "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_", "class_", "Plai", "n", "Text", "Widget_", "(_", "forms_", "._", "Hi", "dde", "n", "Input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "type_", "=_", "'", "hidden", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Plai", "n", "Text", "Widget_", "(_", "forms_", "._", "Hi", "dde", "n", "Input_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "attrs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mark", "\\u", "safe_", "(_", "str_", "(_", "value_", ")_", "+_", "super_", "(_", "Plai", "n", "Text", "Widget_", ",_", "self_", ")_", "._", "render_", "(_", "name_", ",_", "value_", ",_", "attrs_", ")_", ")_", "\\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_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "back", "end", "\\u", "status", "\\u", "icon_", "._", "short", "\\u", "description_", "=_", "\"\"_", "\\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_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "has", "\\u", "add", "\\u", "permission_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "not_", "self_", "._", "\\u\\u", "user", "\\u", "is", "\\u", "readonly_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "has", "\\u", "delete", "\\u", "permission_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "not_", "self_", "._", "\\u\\u", "user", "\\u", "is", "\\u", "readonly_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "save", "\\u", "model_", "(_", "self_", ",_", "request_", ",_", "obj_", ",_", "form_", ",_", "change_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "user", "\\u", "is", "\\u", "readonly_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "'", "if", "'", " ", "mig", "ht", " ", "be", " ", "redundant", " ", "if", " ", "save", "\\u", "by", "\\u", "user", " ", "is", " ", "implemented", " ", "right_", "\\u\\u\\uNL\\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_", "#", " ", "reset", " ", "exponential", " ", "backoff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "\"", "back", "end", "\\u", "register", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "back", "end", "\\u", "register_", "=_", "\"{}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "._", "caller_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "openst", "ack", " ", "connecti", "on", " ", "to", " ", "use", " ", "this", " ", "site", "/", "tenant_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "save", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "delete", "\\u", "model_", "(_", "self_", ",_", "request_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "delete", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "save", "\\u", "formset_", "(_", "self_", ",_", "request_", ",_", "form_", ",_", "formset_", ",_", "change_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instances_", "=_", "formset_", "._", "save_", "(_", "commit_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "instance_", "in_", "instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "._", "caller_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "save", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BUG", " ", "in", " ", "django", " ", "1.7", "?", " ", "Object", "s", " ", "are", " ", "not", " ", "delete", "d", " ", "by", " ", "formset", ".", "save", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commit", " ", "is", " ", "Fal", "se", ".", " ", "So", " ", "let", "'", "s", " ", "delete", " ", "them", " ", "ours", "elv", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "code", " ", "from", " ", "forms", "/", "model", "s", ".", "py", " ", "save", "\\u", "exist", "ing", "\\u", "object", "s", "()", "_", "\\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 ", " _", "forms", "\\u", "to", "\\u", "delete_", "=_", "formset_", "._", "delete", "d\\u", "forms_", "\\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 ", " _", "forms", "\\u", "to", "\\u", "delete_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "formset_", "._", "initial", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "form_", "in_", "formset_", "._", "initial", "\\u", "forms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "form_", "._", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "in_", "forms", "\\u", "to", "\\u", "delete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "obj_", "._", "pk_", "is_", "None_", ":_", "\\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_", "formset_", "._", "delete", "d\\u", "objects_", "._", "append_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "delete_", "(_", ")_", "\\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_", "formset_", "._", "save", "\\u", "m2", "m_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "get", "\\u", "actions_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "actions_", "=_", "super_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "self_", ")_", "._", "get", "\\u", "actions_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "user", "\\u", "is", "\\u", "readonly_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "delete", "\\u", "selecte", "d", "'_", "in_", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "actions_", "[_", "'", "delete", "\\u", "selecte", "d", "'_", "]_", "\\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_", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "url", "\\u", "for", "\\u", "model", "\\u", "changeli", "st_", "(_", "self_", ",_", "request_", ",_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "used", " ", "in", " ", "add", "\\u", "extra", "\\u", "context_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "'", "admin", ":", "%", "s", "\\u", "%", "s", "\\u", "changeli", "st", "'_", "%_", "(_", "model_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "model_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ")_", ",_", "current", "\\u", "app_", "=_", "model_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "add", "\\u", "extra", "\\u", "context_", "(_", "self_", ",_", "request_", ",_", "extra", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "allow", " ", "custom", " ", "applica", "tion", " ", "breadcrumb", " ", "url", " ", "and", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "\\u", "context_", "[_", "\"", "custom", "\\u", "app", "\\u", "breadcrumb", "\\u", "url", "\"_", "]_", "=_", "getattr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "\"", "custom", "\\u", "app", "\\u", "breadcrumb", "\\u", "url", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "\"", "custom", "\\u", "app", "\\u", "breadcrumb", "\\u", "name", "\"_", "]_", "=_", "getattr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "\"", "custom", "\\u", "app", "\\u", "breadcrumb", "\\u", "name", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "[_", "\"", "custom", "\\u", "changeli", "st", "\\u", "breadcrumb", "\\u", "url", "\"_", "]_", "=_", "getattr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "\"", "custom", "\\u", "changeli", "st", "\\u", "breadcrumb", "\\u", "url", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "Service", " ", "admin", "s", " ", "to", " ", "render", " ", "thei", "r", " ", "Administrati", "on", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "getattr_", "(_", "self_", ",_", "\"", "extra", "context", "\\u", "register", "ed", "\\u", "admin", "s", "\"_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admins_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", ",_", "model", "\\u", "admin_", "in_", "admin_", "._", "site_", "._", "\\u", "registry_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "model_", "==_", "self_", "._", "model_", ":_", "\\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_", "model_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", "==_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "info_", "=_", "{_", "\"", "app", "\"_", ":_", "model_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "model", "\"_", ":_", "model_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "cap", "first_", "(_", "model_", "._", "\\u", "meta_", "._", "verbo", "se", "\\u", "name", "\\u", "plural_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "url", "\"_", ":_", "self_", "._", "url", "\\u", "for", "\\u", "model", "\\u", "changeli", "st_", "(_", "request_", ",_", "model_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admins_", "._", "append_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "context_", "[_", "\"", "register", "ed", "\\u", "admin", "s", "\"_", "]_", "=_", "admins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "def_", "change", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "object\\u", "id_", ",_", "extra", "\\u", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "\\u", "context_", "=_", "extra", "\\u", "context_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "user", "\\u", "is", "\\u", "readonly_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "\"", "read", "only", "\\u", "save", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", " ", "the", " ", "original", " ", "read", "only", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "only", "\\u", "save_", "=_", "self_", "._", "read", "only", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "inline", "s", "\\u", "save_", "=_", "self_", "._", "inlines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "user", "\\u", "read", "only", "\\u", "fields", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "only", "\\u", "fields_", "=_", "self_", "._", "user", "\\u", "read", "only", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "user", "\\u", "read", "only", "\\u", "inline", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inlines_", "=_", "self_", "._", "user", "\\u", "read", "only", "\\u", "inlines_", "\\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_", "hasattr_", "(_", "self_", ",_", "\"", "read", "only", "\\u", "save", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "restore", " ", "the", " ", "original", " ", "read", "only", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "only", "\\u", "fields_", "=_", "self_", "._", "read", "only", "\\u", "save_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "inline", "s", "\\u", "save", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inlines_", "=_", "self_", "._", "inline", "s", "\\u", "save_", "\\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_", "._", "add", "\\u", "extra", "\\u", "context_", "(_", "request_", ",_", "extra", "\\u", "context_", ")_", "\\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 ", " _", "return_", "super_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "self_", ")_", "._", "change", "\\u", "view_", "(_", "request_", ",_", "object\\u", "id_", ",_", "extra", "\\u", "context_", "=_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Permi", "ssion", "Denied_", ":_", "\\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_", "except_", "Validat", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "e_", "._", "params_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Validat", "ion", " ", "error", "s", " ", "tha", "t", " ", "don", "'", "t", " ", "reference", " ", "a", " ", "specific", " ", "field", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "oft", "en", " ", "throw", " ", "a", " ", "non", "-", "descripti", "ve", " ", "500", " ", "page", " ", "to", " ", "the", " ", "user", ".", " ", "The", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "belo", "w", " ", "will", " ", "caus", "e", " ", "an", " ", "error", " ", "message", " ", "to", " ", "be", " ", "printed", " ", "and", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "page", " ", "refreshe", "d", " ", "inst", "ead", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", " ", "a", " ", "side", "-", "effect", " ", "it", " ", "turns", " ", "the", " ", "request", " ", "back", " ", "int", "o", " ", "a", " ", "'", "GET", "'", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "wipe", " ", "anyt", "hing", " ", "the", " ", "user", " ", "had", " ", "change", "d", " ", "on", " ", "the", " ", "page", ".", " ", "Bu", "t", ",", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "leas", "t", " ", "the", " ", "user", " ", "gets", " ", "a", " ", "real", " ", "error", " ", "message", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "revis", "it", " ", "this", " ", "and", " ", "display", " ", "some", " ", "kind", " ", "of", " ", "error", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "method_", "=_", "'", "GET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "messages_", "._", "error_", "(_", "request_", ",_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "self_", ")_", "._", "change", "\\u", "view_", "(_", "request_", ",_", "object\\u", "id_", ",_", "extra", "\\u", "context_", "=_", "extra", "\\u", "context_", ")_", "\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ", " _", "raise_", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "._", "readonly_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "self_", ")_", "._", "change", "\\u", "view_", "(_", "request_", ",_", "object\\u", "id_", ",_", "extra", "\\u", "context_", "=_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "changeli", "st", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "extra", "\\u", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "\\u", "context_", "=_", "extra", "\\u", "context_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "extra", "\\u", "context_", "(_", "request_", ",_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "super_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "self_", ")_", "._", "changeli", "st", "\\u", "view_", "(_", "request_", ",_", "extra", "\\u", "context_", "=_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "add", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "form", "\\u", "url_", "=_", "''_", ",_", "extra", "\\u", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "\\u", "context_", "=_", "extra", "\\u", "context_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "extra", "\\u", "context_", "(_", "request_", ",_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "super_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "self_", ")_", "._", "add", "\\u", "view_", "(_", "request_", ",_", "form", "\\u", "url_", ",_", "extra", "\\u", "context_", "=_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "\\u\\u", "user", "\\u", "is", "\\u", "readonly_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "request_", "._", "user_", "._", "is", "Read", "On", "ly", "User_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "back", "end", "\\u", "status", "\\u", "text_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mark", "\\u", "safe_", "(_", "back", "end", "\\u", "text_", "(_", "obj_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "back", "end", "\\u", "status", "\\u", "icon_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mark", "\\u", "safe_", "(_", "back", "end", "\\u", "icon_", "(_", "obj_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "form_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "obj", " ", "and", " ", "request", " ", "in", " ", "thread", "-", "local", " ", "storage", ",", " ", "so", " ", "suit", "\\u", "form", "\\u", "tabs", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "it", " ", "to", " ", "dete", "rmin", "e", " ", "whe", "ther", " ", "we", "'", "re", " ", "in", " ", "edit", " ", "or", " ", "add", " ", "mode", ",", " ", "and", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "whe", "ther", " ", "the", " ", "user", " ", "is", " ", "an", " ", "admin", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "thread", "\\u", "locals_", "._", "request_", "=_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "thread", "\\u", "locals_", "._", "obj_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "self_", ")_", "._", "get", "\\u", "form_", "(_", "request_", ",_", "obj_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "SA", "dmin", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "save", "\\u", "by", "\\u", "user", " ", "and", " ", "delete", "\\u", "by", "\\u", "user", " ", "inst", "ead", " ", "of", " ", "save", " ", "and", " ", "delete_", "\\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_", "get", "\\u", "inline", "\\u", "instances_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inlines_", "=_", "super_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "self_", ")_", "._", "get", "\\u", "inline", "\\u", "instances_", "(_", "request_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inline", "s", " ", "tha", "t", " ", "shou", "ld", " ", "only", " ", "be", " ", "shown", " ", "to", " ", "an", " ", "admin", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "inline", "\\u", "class_", "in_", "getattr_", "(_", "self_", ",_", "\"", "admin", "\\u", "inline", "s", "\"_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inlines_", "._", "append_", "(_", "inline", "\\u", "class_", "(_", "self_", "._", "model_", ",_", "self_", "._", "admin", "\\u", "site_", ")_", ")_", "\\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_", "inlines_", "\\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", "On", "ly", "Awa", "re", "Admin_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Make", " ", "sure", " ", "XO", "SA", "dmin", "Mix", "in", " ", "is", " ", "liste", "d", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "admin", ".", "Model", "Admi", "n", " ", "in", " ", "the", " ", "class", " ", "declaration", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\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_", "class_", "XO", "SB", "ase", "Admin_", "(_", "Read", "On", "ly", "Awa", "re", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "\\u", "on", "\\u", "top_", "=_", "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_", "class_", "Singleton", "Admin_", "(_", "Read", "On", "ly", "Awa", "re", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Singleton", "Admin_", "(_", "Read", "On", "ly", "Awa", "re", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "has", "\\u", "add", "\\u", "permission_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "super_", "(_", "Singleton", "Admin_", ",_", "self_", ")_", "._", "has", "\\u", "add", "\\u", "permission_", "(_", "request_", ")_", ":_", "\\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_", "num", "\\u", "objects_", "=_", "self_", "._", "model_", "._", "objects_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "objects_", ">=_", "1_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Service", "App", "Admin_", "(_", "Singleton", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "context", "\\u", "register", "ed", "\\u", "admins_", "=_", "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_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "self", "link_", "._", "allow", "\\u", "tags_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self", "link_", "._", "short", "\\u", "description_", "=_", "\"", "Det", "ail", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "back", "end", "\\u", "status", "\\u", "icon_", "._", "short", "\\u", "description_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\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_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "XO", "ST", "abu", "lar", "Inline_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", "line", "Model", "Admi", "n", " ", "as", " ", "no", " ", "get", "\\u", "fields", "()", " ", "method", ",", " ", "so", " ", "in", " ", "order", " ", "to", " ", "add_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "self", "link", " ", "field", ",", " ", "we", " ", "override", " ", "\\u\\u", "init", "\\u\\u", " ", "to", " ", "modif", "y", " ", "self", ".", "fields", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "read", "only", "\\u", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup", "\\u", "self", "link_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "self", "link", "\\u", "model_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "\"", "self", "link", "\\u", "field", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "self", ".", "self", "link", "\\u", "model", " ", "can", " ", "be", " ", "defin", "ed", " ", "to", " ", "punc", "h", " ", "through", " ", "a", " ", "relation", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "its", " ", "target", " ", "object", ".", " ", "For", " ", "example", ",", " ", "in", " ", "Slice", "Network", "In", "line", ",", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "self", "link", "\\u", "model", " ", "=", " ", "\"", "network", "\",", " ", "and", " ", "the", " ", "URL", " ", "will", " ", "lead", " ", "to", " ", "the", " ", "Network", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "inst", "ead", " ", "of", " ", "try", "ing", " ", "to", " ", "bring", " ", "up", " ", "a", " ", "change", " ", "view", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Slice", "Network", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "getattr_", "(_", "self_", "._", "model_", ",_", "self_", "._", "self", "link", "\\u", "fieldname_", ")_", "._", "field_", "._", "rel_", "._", "to_", "\\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_", "._", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "self", "link", "\\u", "reverse", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "admin", ":", "%", "s", "\\u", "change", "\"_", "%_", "(_", "self_", "._", "self", "link", "\\u", "model_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "change", "\\u", "url_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "URL", " ", "to", " ", "a", " ", "change", " ", "form", " ", "in", " ", "the", " ", "admin", " ", "for", " ", "this", " ", "model", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reverse", "\\u", "path_", "=_", "self_", "._", "self", "link", "\\u", "reverse", "\\u", "path_", "#", " ", "\"", "admin", ":", "%", "s", "\\u", "change", "\"", " ", "%", " ", "(", "self", ".", "self", "link", "\\u", "model", ".\\u", "meta", ".", "db", "\\u", "table", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "reverse", "\\u", "path_", ",_", "args_", "=_", "(_", "id_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Revers", "e", "Match_", ":_", "\\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_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "self", "link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "self_", "._", "get", "\\u", "change", "\\u", "url_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "have", " ", "an", " ", "admin", " ", "for", " ", "this", " ", "object", ",", " ", "so", " ", "don", "'", "t", " ", "create", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", "link", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "url_", "==_", "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_", "#", " ", "Sin", "ce", " ", "we", " ", "need", " ", "to", " ", "add", " ", "\"", "self", "link", "\"", " ", "to", " ", "the", " ", "field", " ", "list", ",", " ", "we", " ", "need", " ", "to", " ", "create_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "fields", " ", "if", " ", "it", " ", "is", " ", "Non", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "fields_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "._", "editable_", "and_", "f_", "._", "name_", "!=_", "\"", "id", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "fields_", "._", "append_", "(_", "f_", "._", "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_", "self_", "._", "fields_", "=_", "tuple_", "(_", "self_", "._", "fields_", ")_", "+_", "(_", "\"", "self", "link", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "read", "only", "\\u", "fields_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "only", "\\u", "fields_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "read", "only", "\\u", "fields_", "=_", "tuple_", "(_", "self_", "._", "read", "only", "\\u", "fields_", ")_", "+_", "(_", "\"", "self", "link", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "self", "link_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "\"", "self", "link", "\\u", "field", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "obj_", ",_", "self_", "._", "self", "link", "\\u", "fieldname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "self_", "._", "get", "\\u", "change", "\\u", "url_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"<", "a", " ", "href", "='", "%", "s", "'>", "Det", "ail", "s", "</", "a", ">\"_", "%_", "str_", "(_", "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 ", " _", "return_", "\"", "Not", " ", "presen", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "has", "\\u", "add", "\\u", "permission_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "request_", "._", "user_", "._", "is", "Read", "On", "ly", "User_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "read", "only", "\\u", "fields_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "only", "\\u", "fields_", "=_", "list_", "(_", "self_", "._", "read", "only", "\\u", "fields_", ")_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "user_", "._", "is", "Read", "On", "ly", "User_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "field_", "in_", "self_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "field_", "in_", "read", "only", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "read", "only", "\\u", "fields_", "._", "append_", "(_", "field_", ")_", "\\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_", "read", "only", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XO", "ST", "abu", "lar", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "back", "end", "\\u", "status", "\\u", "icon_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mark", "\\u", "safe_", "(_", "back", "end", "\\u", "icon_", "(_", "obj_", ")_", ")_", "\\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_", "Pl", "Stack", "Gene", "ric", "Tab", "ular", "Inline_", "(_", "generic_", "._", "Gene", "ric", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "back", "end", "\\u", "status", "\\u", "icon_", "._", "short", "\\u", "description_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pl", "Stack", "Gene", "ric", "Tab", "ular", "Inline_", "(_", "generic_", "._", "Gene", "ric", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "has", "\\u", "add", "\\u", "permission_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "request_", "._", "user_", "._", "is", "Read", "On", "ly", "User_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pl", "Stack", "Gene", "ric", "Tab", "ular", "Inline_", "(_", "generic_", "._", "Gene", "ric", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "read", "only", "\\u", "fields_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "only", "\\u", "fields_", "=_", "list_", "(_", "self_", "._", "read", "only", "\\u", "fields_", ")_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "user_", "._", "is", "Read", "On", "ly", "User_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "field_", "in_", "self_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "field_", "in_", "read", "only", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "read", "only", "\\u", "fields_", "._", "append_", "(_", "field_", ")_", "\\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_", "read", "only", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pl", "Stack", "Gene", "ric", "Tab", "ular", "Inline_", "(_", "generic_", "._", "Gene", "ric", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "back", "end", "\\u", "status", "\\u", "icon_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mark", "\\u", "safe_", "(_", "back", "end", "\\u", "icon_", "(_", "obj_", ")_", ")_", "\\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_", "Reserva", "tion", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Reserva", "tion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "reserva", "tion", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reserva", "tion", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Reserva", "tion_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ta", "g", "Inline_", "(_", "Pl", "Stack", "Gene", "ric", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "tags", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "service", "'_", ",_", "'", "name", "'_", ",_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ta", "g", "Inline_", "(_", "Pl", "Stack", "Gene", "ric", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Tag_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ",_", "'", "slice", "'_", ",_", "'", "deploy", "ment", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", ",_", "'", "node", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ",_", "'", "slice", "'_", ",_", "'", "deploy", "ment", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", ",_", "'", "node", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "instance", "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_", "[SEP]_", "class_", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Instance_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "acl_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site", "deployments", "\\u\\u", "nodes", "\\u\\u", "isnull_", "=_", "False_", ")_", "._", "distinct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "deploy", "ment", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "flavor", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "flavor", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "super_", "(_", "Insta", "nce", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "field_", "\\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_", "Cor", "d", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ",_", "'", "slice", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", ",_", "'", "node", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "'", "instance", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "instance", "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_", "[SEP]_", "class_", "Cor", "d", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Instance_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "d", "Insta", "nce", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "acl_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site", "deployments", "\\u\\u", "nodes", "\\u\\u", "isnull_", "=_", "False_", ")_", "._", "distinct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "deploy", "ment", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "flavor", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "flavor", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "super_", "(_", "Cor", "d", "Insta", "nce", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "field_", "\\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_", "Site", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "sites", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Site", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Site", "Host", "s", "Node", "s", "Inline_", "(_", "Site", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Site", "Host", "s", "Node", "s", "Inline_", "(_", "Site", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "host", "s", "\\u", "nodes_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Site", "Host", "s", "User", "s", "Inline_", "(_", "Site", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Site", "Host", "s", "User", "s", "Inline_", "(_", "Site", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "host", "s", "\\u", "users_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "email", "'_", ",_", "'", "first", "name", "'_", ",_", "'", "last", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "users", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "User", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "User_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Slice", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "'", "site", "'_", ",_", "'", "service", "Class", "'_", ",_", "'", "service", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "slice", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Slice_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Node", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "nodes", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "'", "site", "\\u", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Deployment", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Deployment", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "deploy", "ment", "privilege", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "role", "'_", ",_", "'", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Deployment", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Deployment", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Controlle", "r", "Site", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "controlle", "r", "'_", ",_", "'", "site", "'_", ",_", "'", "tenan", "t", "\\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_", "class_", "Site", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "site", "privilege", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "site", "'_", ",_", "'", "role", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Site", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "user", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "User_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Site", "Privilege", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Service", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Service", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "service", "privilege", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "service", "'_", ",_", "'", "role", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Service", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "service", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Service_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "user", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "User_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Service", "Privilege", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Service", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Site", "Deployment", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site", "Deployment", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "site", "deployments", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "deploy", "ment", "'_", ",_", "'", "site", "'_", ",_", "'", "controlle", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Site", "Deployment", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "controlle", "r", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "resolve_", "(_", "request_", "._", "path_", ")_", "._", "args_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Controller_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "deploy", "ment", "\\u\\u", "id_", "=_", "int_", "(_", "resolve_", "(_", "request_", "._", "path_", ")_", "._", "args_", "[_", "0_", "]_", ")_", ")_", "\\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_", "super_", "(_", "Site", "Deployment", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Deployment", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Slice", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Slice", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "slice", "privilege", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "slice", "'_", ",_", "'", "role", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Slice", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "slice", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Slice_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "user", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "all", " ", "users", " ", "are", " ", "avail", "able", " ", "to", " ", "be", " ", "grant", "ed", " ", "Slice", "Privilege", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "User_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Slice", "Privilege", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Slice", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Slice", "Network", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Network_", "._", "slices_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self", "link", "\\u", "fieldname_", "=_", "\"", "network", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Network", " ", "Connect", "ion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Network", " ", "Connect", "ion", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "slice", "network", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "network", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Image", "Deployment", "s", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Image", "Deployment", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Image", " ", "Deployment", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Image", " ", "Deployment", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "image", "deployments", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "image", "'_", ",_", "'", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", "]_", "\\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_", "Controlle", "r", "Image", "s", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Controlle", "r", " ", "Image", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Controlle", "r", " ", "Image", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "image", "'_", ",_", "'", "controlle", "r", "'_", ",_", "'", "gla", "nce", "\\u", "image", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "gla", "nce", "\\u", "image", "\\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_", "class_", "Slice", "Ro", "le", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Slice", "Role_", "\\u\\u\\uNEWLINE\\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_", "class_", "Site", "Ro", "le", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site", "Role_", "\\u\\u\\uNEWLINE\\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_", "class_", "Deployment", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "images_", "=_", "forms_", "._", "Model", "Multipl", "e", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "queryset_", "=_", "Image_", "._", "objects_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "\"", "Select", " ", "whi", "ch", " ", "images", " ", "shou", "ld", " ", "be", " ", "deploye", "d", " ", "on", " ", "this", " ", "deploy", "ment", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "Filter", "ed", "Select", "Multiple_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "(_", "'", "Image", "s", "'_", ")_", ",_", "is", "\\u", "stacked", "_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavors_", "=_", "forms_", "._", "Model", "Multipl", "e", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "queryset_", "=_", "Flavor_", "._", "objects_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "\"", "Select", " ", "whi", "ch", " ", "flavor", "s", " ", "shou", "ld", " ", "be", " ", "usable", " ", "on", " ", "this", " ", "deploy", "ment", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "Filter", "ed", "Select", "Multiple_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "(_", "'", "Fla", "vor", "s", "'_", ")_", ",_", "is", "\\u", "stacked", "_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Deployment", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "many", "\\u", "to", "\\u", "many_", "=_", "[_", "\"", "flavor", "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_", "Deployment", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "kwargs_", "._", "pop_", "(_", "'", "request", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Deployment", "Admi", "n", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "access", "Control", "'_", "]_", "._", "initial_", "=_", "\"", "allow", " ", "site", " ", "\"_", "+_", "request_", "._", "user_", "._", "site_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "instance_", "and_", "self_", "._", "instance_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "images", "'_", "]_", "._", "initial_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "image_", "for_", "x_", "in_", "self_", "._", "instance_", "._", "image", "deployments", "_", "._", "all_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "flavor", "s", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "flavors_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deployment", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "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_", "manipulate", "\\u", "m2", "m", "\\u", "objs_", "(_", "self_", ",_", "this", "\\u", "obj_", ",_", "selecte", "d\\u", "objs_", ",_", "all", "\\u", "relations_", ",_", "relation", "\\u", "class_", ",_", "local", "\\u", "attrname_", ",_", "foreign", "\\u", "attrname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "help", "er", " ", "function", " ", "for", " ", "handling", " ", "m2", "m", " ", "relation", "s", " ", "from", " ", "the", " ", "Multipl", "e", "Choi", "ce", "Field", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "this", "\\u", "obj", ":", " ", "the", " ", "source", " ", "object", " ", "we", " ", "want", " ", "to", " ", "link", " ", "from", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "selecte", "d\\u", "objs", ":", " ", "a", " ", "list", " ", "of", " ", "destinat", "ion", " ", "object", "s", " ", "we", " ", "want", " ", "to", " ", "link", " ", "to", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "all", "\\u", "relation", "s", ":", " ", "the", " ", "full", " ", "set", " ", "of", " ", "relation", "s", " ", "involv", "ing", " ", "this", "\\u", "obj", ",", " ", "inclu", "ding", " ", "ones", " ", "we", " ", "don", "'", "t", " ", "want", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "relation", "\\u", "class", ":", " ", "the", " ", "class", " ", "tha", "t", " ", "implement", "s", " ", "the", " ", "relation", " ", "from", " ", "source", " ", "to", " ", "dest", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "local", "\\u", "attr", "name", ":", " ", "field", " ", "name", " ", "represent", "ing", " ", "this", "\\u", "obj", " ", "in", " ", "relation", "\\u", "class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "foreign", "\\u", "attr", "name", ":", " ", "field", " ", "name", " ", "represent", "ing", " ", "selecte", "d\\u", "objs", " ", "in", " ", "relation", "\\u", "class", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "will", " ", "remove", " ", "all", " ", "newo", "bj", "class", " ", "relation", "s", " ", "from", " ", "this", "\\u", "obj", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "are", " ", "not", " ", "contain", "ed", " ", "in", " ", "selecte", "d\\u", "objs", ",", " ", "and", " ", "add", " ", "any", " ", "relation", "s", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "in", " ", "selecte", "d\\u", "objs", " ", "but", " ", "don", "'", "t", " ", "exist", " ", "in", " ", "the", " ", "data", " ", "model", " ", "ye", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "dest", "\\u", "objs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "relation_", "in_", "list_", "(_", "all", "\\u", "relations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getattr_", "(_", "relation_", ",_", "foreign", "\\u", "attrname_", ")_", "not_", "in_", "selecte", "d\\u", "objs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "delet", "ing", " ", "site", "\",", " ", "sd", "p", ".", "site_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relation_", "._", "delete_", "(_", ")_", "\\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 ", " _", "exist", "ing", "\\u", "dest", "\\u", "objs_", "._", "append_", "(_", "getattr_", "(_", "relation_", ",_", "foreign", "\\u", "attrname_", ")_", ")_", "\\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_", "dest", "\\u", "obj_", "in_", "selecte", "d\\u", "objs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dest", "\\u", "obj_", "not_", "in_", "exist", "ing", "\\u", "dest", "\\u", "objs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "addin", "g", " ", "site", "\",", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "foreign", "\\u", "attrname_", ":_", "dest", "\\u", "obj_", ",_", "local", "\\u", "attrname_", ":_", "this", "\\u", "obj_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "=_", "relation", "\\u", "class_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deployment", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deployment_", "=_", "super_", "(_", "Deployment", "Admi", "n", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "commit_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "commit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deployment_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "has", " ", "to", " ", "be", " ", "don", "e", " ", "after", " ", "save", "()", " ", "if", "/", "whe", "n", " ", "a", " ", "deploy", "ment", " ", "is", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "deployment_", "._", "flavors_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "flavor", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "deployment_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", "\\u", "m2", "m", "()", " ", "doe", "sn", "'", "t", " ", "see", "m", " ", "to", " ", "work", " ", "with", " ", "'", "through", "'", " ", "relation", "s", ".", " ", "So", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "create", "/", "destroy", " ", "the", " ", "through", " ", "model", "s", " ", "ours", "elv", "es", ".", " ", "There", " ", "has", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "bett", "er", " ", "way", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "manipulate", "\\u", "m2", "m", "\\u", "objs_", "(_", "deployment_", ",_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "images", "'_", "]_", ",_", "deployment_", "._", "image", "deployments", "_", "._", "all_", "(_", ")_", ",_", "Image", "Deployment", "s_", ",_", "\"", "deploy", "ment", "\"_", ",_", "\"", "image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "manipulate", "\\u", "m2", "m", "\\u", "objs", " ", "doe", "sn", "'", "t", " ", "work", " ", "for", " ", "Fla", "vor", "/", "Deployment", " ", "relationship_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "well", " ", "handle", " ", "tha", "t", " ", "manu", "ally", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "flavor_", "in_", "deployment_", "._", "flavors_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getattr_", "(_", "flavor_", ",_", "'", "name", "'_", ")_", "not_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "flavor", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "deployment_", "._", "flavors_", "._", "remove_", "(_", "flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "flavor_", "in_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "flavor", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "flavor_", "not_", "in_", "deployment_", "._", "flavors_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "flavor_", "._", "deployments", "_", "._", "add_", "(_", "deployment_", ")_", "\\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_", "self_", "._", "save", "\\u", "m2", "m_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "deployment_", "\\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_", "Deployment", "Admi", "n", "RO", "Form_", "(_", "Deployment", "Admi", "n", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Deployment", "Admi", "n", "RO", "Form_", "(_", "Deployment", "Admi", "n", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Permi", "ssion", "Denied_", "\\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_", "Site", "Assoc", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site_", "._", "deployments", "_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "sites", "'_", "\\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_", "Deployment", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Deployment", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "List_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "images", "'_", ",_", "'", "flavor", "s", "'_", ",_", "'", "access", "Control", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "field", "List_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "node", " ", "no", " ", "long", "er", " ", "direct", "ly", " ", "connect", "ed", " ", "to", " ", "deployment_", "\\u\\u\\uNL\\u\\u\\u_", "#", "inline", "s", " ", "=", " ", "[", "Deployment", "Privilege", "In", "line", ",", "Node", "In", "line", ",", "Ta", "g", "In", "line", ",", "Image", "Deployment", "s", "In", "line", "]_", "\\u\\u\\uNL\\u\\u\\u_", "inlines_", "=_", "[_", "Deployment", "Privilege", "Inline_", ",_", "Ta", "g", "Inline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "Deployment", "s", "Inline_", ",_", "Site", "Deployment", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nodes", " ", "no", " ", "long", "er", " ", "direc", "lty", " ", "connect", "ed", " ", "to", " ", "deployments", "_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Deployment", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "deploy", "ment", "privilege", "s", "'_", ",_", "'", "Privilege", "s", "'_", ")_", ",_", "(_", "'", "site", "deployments", "'_", ",_", "'", "Site", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Deployment", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "form_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "user_", "._", "is", "Read", "On", "ly", "User_", "(_", ")_", "or_", "not_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "\"", "form", "\"_", "]_", "=_", "Deployment", "Admi", "n", "RO", "Form_", "\\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 ", " _", "kwargs_", "[_", "\"", "form", "\"_", "]_", "=_", "Deployment", "Admi", "n", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin", "Form_", "=_", "super_", "(_", "Deployment", "Admin_", ",_", "self_", ")_", "._", "get", "\\u", "form_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "obj_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "stack", "exchange", ":", " ", "pass", " ", "the", " ", "request", " ", "object", " ", "int", "o", " ", "the", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Admi", "n", "Form", "Meta", "Class_", "(_", "admin", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "request", "'_", "]_", "=_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "admin", "Form_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\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_", "Admi", "n", "Form", "Meta", "Class_", "\\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_", "Controlle", "r", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "back", "end", "\\u", "disabled_", "=_", "forms_", "._", "Boo", "lean", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controller_", "\\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_", "Controlle", "r", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "kwargs_", "._", "pop_", "(_", "'", "request", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Controlle", "r", "Admi", "n", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "instance_", "and_", "self_", "._", "instance_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "back", "end", "\\u", "disable", "d", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "get", "\\u", "back", "end", "\\u", "register_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disable", "d", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "default", "s", " ", "whe", "n", " ", "addin", "g", " ", "new", " ", "controller_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "back", "end", "\\u", "disable", "d", "'_", "]_", "._", "initial_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "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_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "instance_", "._", "set\\u", "back", "end", "\\u", "register_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disable", "d", "\"_", ",_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\"", "back", "end", "\\u", "disable", "d", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Controlle", "r", "Admi", "n", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "commit_", "=_", "commit_", ")_", "\\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_", "Controlle", "r", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "List_", "=_", "[_", "'", "deploy", "ment", "'_", ",_", "'", "name", "'_", ",_", "'", "back", "end", "\\u", "type", "'_", ",_", "'", "back", "end", "\\u", "disable", "d", "'_", ",_", "'", "version", "'_", ",_", "'", "auth", "\\u", "url", "'_", ",_", "'", "admin", "\\u", "user", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "admin", "\\u", "tenan", "t", "'_", ",_", "'", "admin", "\\u", "password", "'_", ",_", "'", "domain", "'_", ",_", "'", "rabbit", "\\u", "host", "'_", ",_", "'", "rabbit", "\\u", "user", "'_", ",_", "'", "rabbit", "\\u", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "field", "List_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Controlle", "r", "Site", "Inline_", "]_", "#", " ", ",", "Controlle", "r", "Image", "s", "In", "line", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "'", "version", "'_", ",_", "'", "back", "end", "\\u", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Controlle", "r", "Admi", "n", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Controlle", "r", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "save", "\\u", "model_", "(_", "self_", ",_", "request_", ",_", "obj_", ",_", "form_", ",_", "change_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "openst", "ack", " ", "connecti", "on", " ", "to", " ", "use", " ", "this", " ", "site", "/", "tenant_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "save", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "model_", "(_", "self_", ",_", "request_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "delete", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Controller_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "suit", "\\u", "form", "\\u", "tabs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "=_", "[_", "(_", "'", "genera", "l", "'_", ",_", "'", "Controlle", "r", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "getattr_", "(_", "\\u", "thread", "\\u", "locals_", ",_", "\"", "request", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "and_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "._", "append_", "(_", "(_", "'", "admin", "-", "only", "'_", ",_", "'", "Admi", "n", "-", "On", "ly", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tabs_", "\\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_", "Ten", "ant", "Attribute", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Ten", "ant", "Attribute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "tenan", "t", "'_", ",_", "'", "name", "'_", ",_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "List_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "tenan", "t", "'_", ",_", "'", "name", "'_", ",_", "'", "value", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "field", "List_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Ten", "ant", " ", "Roo", "t", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\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_", "Ten", "ant", "Attr", "As", "Tab", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Ten", "ant", "Attribute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "tenan", "tat", "tr", "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_", "class_", "Ten", "ant", "Roo", "t", "Ro", "le", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Ten", "ant", "Roo", "t", "Role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "role", "'_", ",_", ")_", "\\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_", "Ten", "ant", "Roo", "t", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Ten", "ant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "provide", "r", "\\u", "service", "'_", ",_", "'", "subscribe", "r", "\\u", "root", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "tenan", "tro", "ots", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fk", "\\u", "name_", "=_", "'", "subscribe", "r", "\\u", "root", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "'", "subscribed", " ", "tenan", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "'", "subscribed", " ", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "querys", "et", "(", "self", ",", " ", "request", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "qs", " ", "=", " ", "super", "(", "Ten", "ant", "Roo", "t", "Ten", "ant", "In", "line", ",", " ", "self", ").", "querys", "et", "(", "request", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "qs", ".", "filter", "(", "kind", "=\"", "coarse", "\")", "_", "\\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_", "class_", "Ten", "ant", "Roo", "t", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Ten", "ant", "Roo", "t", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "tenan", "tro", "otp", "riv", "ile", "ges", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "role", "'_", ",_", "'", "tenan", "t", "\\u", "root", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ten", "ant", "Roo", "t", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ten", "ant", "Roo", "t", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ten", "ant", "Roo", "t", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Ten", "ant", "Root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "'", "kind", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "List_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "name", "'_", ",_", "'", "kind", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "field", "List_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "(_", "Ten", "ant", "Roo", "t", "Ten", "ant", "Inline_", ",_", "Ten", "ant", "Roo", "t", "Privilege", "Inline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Ten", "ant", " ", "Roo", "t", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tenan", "tro", "ots", "'_", ",_", "'", "Ten", "ancy", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tenan", "tro", "otp", "riv", "ile", "ges", "'_", ",_", "'", "Privilege", "s", "'_", ")_", "\\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_", "Ten", "ant", "Ro", "le", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Admi", "n", " ", "for", " ", "Ten", "ant", "Ro", "les", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Ten", "ant", "Role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "role", "'_", ",_", ")_", "\\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_", "Ten", "ant", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "In", "line", " ", "for", " ", "addin", "g", " ", "a", " ", "Ten", "ant", "Privilege", " ", "to", " ", "a", " ", "Ten", "ant", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Ten", "ant", "Privilege", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "tenan", "tpr", "ivi", "leg", "es", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "role", "'_", ",_", "'", "tenan", "t", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ten", "ant", "Privilege", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ten", "ant", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Provider", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Coa", "rse", "Ten", "ant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "provide", "r", "\\u", "service", "'_", ",_", "'", "subscribe", "r", "\\u", "service", "'_", ",_", "'", "connect", "\\u", "method", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "service", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fk", "\\u", "name_", "=_", "'", "provide", "r", "\\u", "service", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "'", "provided", " ", "tenan", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "'", "provided", " ", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Provider", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "super_", "(_", "Provider", "Ten", "ant", "Inline_", ",_", "self_", ")_", "._", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "._", "filter_", "(_", "kind_", "=_", "\"", "coarse", "\"_", ")_", "\\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_", "Subscrib", "er", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Coa", "rse", "Ten", "ant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "provide", "r", "\\u", "service", "'_", ",_", "'", "subscribe", "r", "\\u", "service", "'_", ",_", "'", "connect", "\\u", "method", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "service", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fk", "\\u", "name_", "=_", "'", "subscribe", "r", "\\u", "service", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "'", "subscribed", " ", "tenan", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "'", "subscribed", " ", "tenan", "ts", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Subscrib", "er", "Ten", "ant", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "super_", "(_", "Subscrib", "er", "Ten", "ant", "Inline_", ",_", "self_", ")_", "._", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "._", "filter_", "(_", "kind_", "=_", "\"", "coarse", "\"_", ")_", "\\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_", "Service", "Attr", "As", "Tab", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Service", "Attribute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "service", "attr", "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_", "class_", "Service", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "name", "\"_", ",_", "\"", "kind", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "version", "Number", "\"_", ",_", "\"", "enable", "d", "\"_", ",_", "\"", "publi", "shed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "List_", "=_", "[_", "\"", "back", "end", "\\u", "status", "\\u", "text", "\"_", ",_", "\"", "name", "\"_", ",_", "\"", "kind", "\"_", ",_", "\"", "description", "\"_", ",_", "\"", "version", "Number", "\"_", ",_", "\"", "enable", "d", "\"_", ",_", "\"", "publi", "shed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "view", "\\u", "url", "\"_", ",_", "\"", "icon", "\\u", "url", "\"_", ",_", "\"", "public", "\\u", "key", "\"_", ",_", "\"", "private", "\\u", "key", "\\u", "fn", "\"_", ",_", "\"", "service", "\\u", "specific", "\\u", "attribute", "\"_", ",_", "\"", "service", "\\u", "specific", "\\u", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "field", "List_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Service", "Attr", "As", "Tab", "Inline_", ",_", "Slice", "Inline_", ",_", "Provider", "Ten", "ant", "Inline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Subscrib", "er", "Ten", "ant", "Inline_", ",_", "Service", "Privilege", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "field", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Service", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slice", "s", "'_", ",_", "'", "Slice", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "service", "attr", "s", "'_", ",_", "'", "Addition", "al", " ", "Attribute", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "service", "tenan", "ts", "'_", ",_", "'", "Ten", "ancy", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "service", "privilege", "s", "'_", ",_", "'", "Privilege", "s", "'_", ")_", "\\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_", "Site", "Node", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "site", "\\u", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "nodes", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Site", "Node", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "display", " ", "site", " ", "deployments", " ", "associate", "d", " ", "with", " ", "this", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "\\u", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site", "Deployment", "_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site", "\\u\\u", "id_", "=_", "int_", "(_", "request_", "._", "path_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Site", "Node", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "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_", "Site", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "field", "List", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "name", "',", " ", "'", "site", "\\u", "url", "',", " ", "'", "enable", "d", "',", " ", "'", "is", "\\u", "public", "',", " ", "'", "login", "\\u", "base", "',", " ", "'", "account", "Link", "','", "location", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "List_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "name", "'_", ",_", "'", "site", "\\u", "url", "'_", ",_", "'", "enable", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "login", "\\u", "base", "'_", ",_", "'", "location", "'_", ",_", "'", "is", "\\u", "public", "'_", ",_", "'", "host", "s", "\\u", "nodes", "'_", ",_", "'", "host", "s", "\\u", "users", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "field", "List_", ",_", "'", "classe", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#(", "'", "Deployment", " ", "Network", "s", "',", " ", "{", "'", "fields", "':", " ", "['", "deployments", "']", ",", " ", "'", "classe", "s", "':", "['", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "deployments", "']}", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "read", "only", "\\u", "fields", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "account", "Link", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "user", "\\u", "read", "only", "\\u", "fields", " ", "=", " ", "['", "name", "',", " ", "'", "deployments", "','", "site", "\\u", "url", "',", " ", "'", "enable", "d", "',", " ", "'", "is", "\\u", "public", "',", " ", "'", "login", "\\u", "base", "',", " ", "'", "account", "Link", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "deployments", "'_", ",_", "'", "site", "\\u", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enable", "d", "'_", ",_", "'", "is", "\\u", "public", "'_", ",_", "'", "login", "\\u", "base", "'_", ",_", "'", "host", "s", "\\u", "nodes", "'_", ",_", "'", "host", "s", "\\u", "users", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "login", "\\u", "base", "'_", ",_", "'", "site", "\\u", "url", "'_", ",_", "'", "enable", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "horizontal_", "=_", "(_", "'", "deployments", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Slice", "Inline_", ",_", "User", "Inline_", ",_", "Ta", "g", "Inline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Site", "Privilege", "Inline_", ",_", "Site", "Node", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "inlines_", "=_", "[_", "Controlle", "r", "Site", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "fields_", "=_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "account", "Link_", "._", "allow", "\\u", "tags_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "account", "Link_", "._", "short", "\\u", "description_", "=_", "\"", "Bill", "ing", "\"_", "\\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_", "Site", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "field", "List", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "name", "',", " ", "'", "site", "\\u", "url", "',", " ", "'", "enable", "d", "',", " ", "'", "is", "\\u", "public", "',", " ", "'", "login", "\\u", "base", "',", " ", "'", "account", "Link", "','", "location", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "suit", "\\u", "form", "\\u", "tabs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "=_", "[_", "(_", "'", "genera", "l", "'_", ",_", "'", "Site", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "users", "'_", ",_", "'", "User", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "site", "privilege", "s", "'_", ",_", "'", "Privilege", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slice", "s", "'_", ",_", "'", "Slice", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "nodes", "'_", ",_", "'", "Node", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "getattr_", "(_", "\\u", "thread", "\\u", "locals_", ",_", "\"", "request", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "and_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "._", "append_", "(_", "(_", "'", "admin", "-", "only", "'_", ",_", "'", "Admi", "n", "-", "On", "ly", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tabs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "field", "List", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "name", "',", " ", "'", "site", "\\u", "url", "',", " ", "'", "enable", "d", "',", " ", "'", "is", "\\u", "public", "',", " ", "'", "login", "\\u", "base", "',", " ", "'", "account", "Link", "','", "location", "']", "_", "\\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_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "field", "List", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "name", "',", " ", "'", "site", "\\u", "url", "',", " ", "'", "enable", "d", "',", " ", "'", "is", "\\u", "public", "',", " ", "'", "login", "\\u", "base", "',", " ", "'", "account", "Link", "','", "location", "']", "_", "\\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_", "get", "\\u", "formset", "s_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "inline_", "in_", "self_", "._", "get", "\\u", "inline", "\\u", "instances_", "(_", "request_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hide", " ", "My", "In", "line", " ", "in", " ", "the", " ", "add", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\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_", "isinstance_", "(_", "inline_", ",_", "Insta", "nce", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inline_", "._", "model_", "._", "caller_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "inline_", "._", "get", "\\u", "formset_", "(_", "request_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "field", "List", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "name", "',", " ", "'", "site", "\\u", "url", "',", " ", "'", "enable", "d", "',", " ", "'", "is", "\\u", "public", "',", " ", "'", "login", "\\u", "base", "',", " ", "'", "account", "Link", "','", "location", "']", "_", "\\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_", "def_", "account", "Link_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link", "\\u", "obj_", "=_", "obj_", "._", "accounts_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "link", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reverse", "\\u", "path_", "=_", "\"", "admin", ":", "core", "\\u", "account", "\\u", "change", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "reverse", "\\u", "path_", ",_", "args_", "=_", "(_", "link", "\\u", "obj_", "[_", "0_", "]_", "._", "id_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"<", "a", " ", "href", "='", "%", "s", "'>", "%", "s", "</", "a", ">\"_", "%_", "(_", "url_", ",_", "\"", "view", " ", "bill", "ing", " ", "deta", "il", "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_", "\"", "no", " ", "bill", "ing", " ", "data", " ", "for", " ", "this", " ", "site", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "field", "List", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "name", "',", " ", "'", "site", "\\u", "url", "',", " ", "'", "enable", "d", "',", " ", "'", "is", "\\u", "public", "',", " ", "'", "login", "\\u", "base", "',", " ", "'", "account", "Link", "','", "location", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "save", "\\u", "model_", "(_", "self_", ",_", "request_", ",_", "obj_", ",_", "form_", ",_", "change_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "openst", "ack", " ", "connecti", "on", " ", "to", " ", "use", " ", "this", " ", "site", "/", "tenant_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "save", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "field", "List", " ", "=", " ", "['", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "name", "',", " ", "'", "site", "\\u", "url", "',", " ", "'", "enable", "d", "',", " ", "'", "is", "\\u", "public", "',", " ", "'", "login", "\\u", "base", "',", " ", "'", "account", "Link", "','", "location", "']", "_", "\\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_", "delete", "\\u", "model_", "(_", "self_", ",_", "request_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "delete", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Site", "Privilege", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "List_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "user", "'_", ",_", "'", "site", "'_", ",_", "'", "role", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "field", "List_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "collapse", "'_", "]_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "site", "'_", ",_", "'", "role", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "list", "\\u", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "field", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "inlines_", "=_", "[_", "]_", "\\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_", "Site", "Privilege", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "show", " ", "sites", " ", "where", " ", "user", " ", "is", " ", "an", " ", "admin", " ", "or", " ", "pi_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sites_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site", "\\u", "privilege", "_", "in_", "Site", "Privilege", "_", "._", "objects_", "._", "filer", "_", "(_", "user_", "=_", "request_", "._", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "site", "\\u", "privilege", "_", "._", "role_", "._", "role", "\\u", "type_", "in_", "[_", "'", "admin", "'_", ",_", "'", "pi", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sites_", "._", "add_", "(_", "site", "\\u", "privilege", "_", "._", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site_", "._", "objects_", "._", "filter_", "(_", "site", "\\u\\u", "in_", "=_", "list_", "(_", "sites_", ")_", ")_", "\\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_", "db", "\\u", "field_", "._", "name_", "==_", "'", "user", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "show", " ", "users", " ", "from", " ", "sites", " ", "where", " ", "caller", " ", "has", " ", "admin", " ", "or", " ", "pi", " ", "role_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "roles_", "=_", "Role_", "._", "objects_", "._", "filter_", "(_", "role", "\\u", "type\\u\\u", "in_", "=_", "[_", "'", "admin", "'_", ",_", "'", "pi", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site", "\\u", "privilege", "s_", "=_", "Site", "Privilege", "_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "role", "\\u\\u", "in_", "=_", "roles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sites_", "=_", "[_", "site", "\\u", "privilege", "_", "._", "site_", "for_", "site", "\\u", "privilege", "_", "in_", "site", "\\u", "privilege", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site", "\\u", "privilege", "s_", "=_", "Site", "Privilege", "_", "._", "objects_", "._", "filter_", "(_", "site", "\\u\\u", "in_", "=_", "sites_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "emails_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "site", "\\u", "privilege", "_", "._", "user_", "._", "email_", "for_", "site", "\\u", "privilege", "_", "in_", "site", "\\u", "privilege", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "=_", "User_", "._", "objects_", "._", "filter_", "(_", "email", "\\u\\u", "in_", "=_", "emails_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "users_", "\\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_", "super_", "(_", "Site", "Privilege", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Site", "Privilege", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "admin", "s", " ", "can", " ", "see", " ", "all", " ", "privilege", "s", ".", " ", "User", "s", " ", "can", " ", "only", " ", "see", " ", "privilege", "s", " ", "at", " ", "sites_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "where", " ", "the", "y", " ", "have", " ", "the", " ", "admin", " ", "role", " ", "or", " ", "pi", " ", "role", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "super_", "(_", "Site", "Privilege", "Admin_", ",_", "self_", ")_", "._", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "request", ".", "user", ".", "is", "\\u", "admin", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "role", "s", " ", "=", " ", "Ro", "le", ".", "object", "s", ".", "filter", "(", "role", "\\u", "type\\u\\u", "in", "=[", "'", "admin", "',", " ", "'", "pi", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "site", "\\u", "privilege", "s", " ", "=", " ", "Site", "Privilege", ".", "object", "s", ".", "filter", "(", "user", "=", "request", ".", "user", ").", "filter", "(", "role", "\\u\\u", "in", "=", "role", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "login", "\\u", "base", "s", " ", "=", " ", "[", "site", "\\u", "privilege", ".", "site", ".", "login", "\\u", "base", " ", "for", " ", "site", "\\u", "privilege", " ", "in", " ", "site", "\\u", "privilege", "s", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "sites", " ", "=", " ", "Site", ".", "object", "s", ".", "filter", "(", "login", "\\u", "base", "\\u\\u", "in", "=", "login", "\\u", "base", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "qs", " ", "=", " ", "qs", ".", "filter", "(", "site", "\\u\\u", "in", "=", "sites", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "qs_", "\\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_", "Slice", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "service", "'_", ":_", "Linke", "d", "Select_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean", "ed", "\\u", "data_", "=_", "super_", "(_", "Slice", "Form_", ",_", "self_", ")_", "._", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "'", "site", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "=_", "self_", "._", "instance_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "site_", "and_", "slice", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site_", "=_", "Slice_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "slice", "\\u", "id_", ")_", "._", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "isinstance_", "(_", "site_", ",_", "Site_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "previ", "ous", " ", "code", " ", "indicat", "es", " ", "'", "site", "'", " ", "coul", "d", " ", "be", " ", "a", " ", "site", "\\u", "id", " ", "and", " ", "not", " ", "a", " ", "site", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site_", "=_", "Slice_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "site_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "name_", "._", "startswith_", "(_", "site_", "._", "login", "\\u", "base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slice", " ", "name", " ", "must", " ", "begin", " ", "with", " ", "%", "s", "'_", "%_", "site_", "._", "login", "\\u", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "clean", "ed", "\\u", "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_", "class_", "Controlle", "r", "Slice", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Controlle", "r", " ", "Slice", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Controlle", "r", " ", "Slice", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "controlle", "r", "'_", ",_", "'", "tenan", "t", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "controlle", "r", "'_", ")_", "\\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_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Slice", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "List_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "site", "'_", ",_", "'", "name", "'_", ",_", "'", "service", "Class", "'_", ",_", "'", "enable", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ",_", "'", "service", "'_", ",_", "'", "slice", "\\u", "url", "'_", ",_", "'", "max", "\\u", "instance", "s", "'_", ",_", "\"", "default", "\\u", "isolation", "\"_", ",_", "\"", "network", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "(_", "'", "Slice", " ", "Det", "ail", "s", "'_", ",_", "{_", "'", "fields", "'_", ":_", "field", "List_", ",_", "'", "classe", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "'", "site", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "service", "Class", "'_", ",_", "'", "slice", "\\u", "url", "'_", ",_", "'", "max", "\\u", "instance", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal", "\\u", "inlines_", "=_", "[_", "Slice", "Privilege", "Inline_", ",_", "Insta", "nce", "Inline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ta", "g", "Inline_", ",_", "Reserva", "tion", "Inline_", ",_", "Slice", "Network", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "normal", "\\u", "inlines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "inlines_", "=_", "[_", "Controlle", "r", "Slice", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "form", "\\u", "includes_", "=_", "(_", "(_", "'", "slice", "\\u", "instance", "\\u", "tab", ".", "html", "'_", ",_", "'", "bottom", "'_", ",_", "'", "instance", "s", "'_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "field", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "suit", "\\u", "form", "\\u", "tabs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "=_", "[_", "(_", "'", "genera", "l", "'_", ",_", "'", "Slice", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slice", "network", "s", "'_", ",_", "'", "Network", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slice", "privilege", "s", "'_", ",_", "'", "Privilege", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "instance", "s", "'_", ",_", "'", "Insta", "nce", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#(", "'", "reserva", "tion", "s", "','", "Reserva", "tion", "s", "')", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tags", "'_", ",_", "'", "Ta", "gs", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "getattr_", "(_", "\\u", "thread", "\\u", "locals_", ",_", "\"", "request", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "and_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "._", "append_", "(_", "(_", "'", "admin", "-", "only", "'_", ",_", "'", "Admi", "n", "-", "On", "ly", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tabs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "form", "\\u", "url_", "=_", "''_", ",_", "extra", "\\u", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ug", "ly", " ", "hack", " ", "for", " ", "COR", "D_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inlines_", "=_", "self_", "._", "normal", "\\u", "inlines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "revert", " ", "to", " ", "default", " ", "read", "-", "only", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Slice", "Admin_", ",_", "self_", ")_", "._", "add", "\\u", "view_", "(_", "request_", ",_", "form", "\\u", "url_", ",_", "extra", "\\u", "context_", "=_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "change", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "object\\u", "id_", ",_", "form", "\\u", "url_", "=_", "''_", ",_", "extra", "\\u", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cann", "ot", " ", "change", " ", "the", " ", "site", " ", "of", " ", "an", " ", "exist", "ing", " ", "slice", " ", "so", " ", "make", " ", "the", " ", "site", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "object\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "site", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Slice", "Admin_", ",_", "self_", ")_", "._", "change", "\\u", "view_", "(_", "request_", ",_", "object\\u", "id_", ",_", "form", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "change", "\\u", "form_", "(_", "self_", ",_", "request_", ",_", "context_", ",_", "add_", "=_", "False_", ",_", "change_", "=_", "False_", ",_", "form", "\\u", "url_", "=_", "''_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "Node_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "nodes_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "node_", "._", "site", "\\u", "deployment_", "._", "deployment_", "._", "id_", ",_", "node_", "._", "id_", ",_", "node_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "deploy", "ment", "\\u", "flavors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "flavor_", "in_", "Flavor_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "deployment_", "in_", "flavor_", "._", "deployments", "_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "flavors_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deployment_", "._", "id_", ",_", "flavor_", "._", "id_", ",_", "flavor_", "._", "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_", "deploy", "ment", "\\u", "images_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "image_", "in_", "Image_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "deploy", "ment", "\\u", "image_", "in_", "image_", "._", "image", "deployments", "_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "images_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deploy", "ment", "\\u", "image_", "._", "deployment_", "._", "id_", ",_", "image_", "._", "id_", ",_", "image_", "._", "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_", "site", "\\u", "login", "\\u", "bases_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "Site_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site", "\\u", "login", "\\u", "bases_", "._", "append_", "(_", "(_", "site_", "._", "id_", ",_", "site_", "._", "login", "\\u", "base_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "\"", "deploy", "ment", "\\u", "nodes", "\"_", "]_", "=_", "deploy", "ment", "\\u", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "deploy", "ment", "\\u", "flavor", "s", "\"_", "]_", "=_", "deploy", "ment", "\\u", "flavors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "deploy", "ment", "\\u", "images", "\"_", "]_", "=_", "deploy", "ment", "\\u", "images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "site", "\\u", "login", "\\u", "base", "s", "\"_", "]_", "=_", "site", "\\u", "login", "\\u", "bases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Slice", "Admin_", ",_", "self_", ")_", "._", "render", "\\u", "change", "\\u", "form_", "(_", "request_", ",_", "context_", ",_", "add_", ",_", "change_", ",_", "form", "\\u", "url_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "host", "s", "\\u", "users_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "update", "\\u", "slice", "\\u", "prefix", "(", "this", ",", " ", "$(", "$(", "this", ").", "closest", "('", "fieldset", "')", "[", "0", "])", ".", "find", "('.", "field", "-", "name", " ", "input", "')", "[", "0", "].", "id", ")\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Slice", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "admin", "s", " ", "can", " ", "see", " ", "all", " ", "keys", ".", " ", "User", "s", " ", "can", " ", "only", " ", "see", " ", "slice", "s", " ", "the", "y", " ", "belo", "ng", " ", "to", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Slice_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "formset", "s_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "inline_", "in_", "self_", "._", "get", "\\u", "inline", "\\u", "instances_", "(_", "request_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hide", " ", "My", "In", "line", " ", "in", " ", "the", " ", "add", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\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_", "isinstance_", "(_", "inline_", ",_", "Insta", "nce", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inline_", "._", "model_", "._", "caller_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "inline_", "._", "get", "\\u", "formset_", "(_", "request_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\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_", "add", "\\u", "extra", "\\u", "context_", "(_", "self_", ",_", "request_", ",_", "extra", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Slice", "Admin_", ",_", "self_", ")_", "._", "add", "\\u", "extra", "\\u", "context_", "(_", "request_", ",_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "context", "[\"", "slice", "\\u", "id", "\"]", " ", "to", " ", "the", " ", "PK", " ", "pass", "ed", " ", "in", " ", "the", " ", "URL", " ", "to", " ", "this", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "request_", "._", "resolver", "\\u", "match_", "._", "args_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "\\u", "context_", "[_", "\"", "slice", "\\u", "id", "\"_", "]_", "=_", "request_", "._", "resolver", "\\u", "match_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\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_", "UN", "USED", "\\u", "get", "\\u", "inline", "\\u", "instances_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "HA", "CK", " ", "for", " ", "COR", "D", " ", "to", " ", "do", " ", "somet", "hing", " ", "special", " ", "on", " ", "vc", "pe", " ", "slice", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "this", " ", "was", " ", "a", " ", "good", " ", "idea", ",", " ", "but", " ", "fail", "ed", " ", "mis", "era", "bly", ",", " ", "as", " ", "somet", "hing", " ", "still", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "expect", "s", " ", "there", " ", "to", " ", "be", " ", "a", " ", "deploy", "ment", " ", "field", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "XX", "X", " ", "this", " ", "appro", "ach", " ", "is", " ", "bett", "er", " ", "than", " ", "clobber", "ing", " ", "self", ".", "inline", "s", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "try", " ", "to", " ", "make", " ", "this", " ", "work", " ", "post", "-", "demo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "obj_", "is_", "not_", "None_", ")_", "and_", "(_", "obj_", "._", "name_", "==_", "\"", "mys", "ite", "\\u", "vc", "pe", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cord", "\\u", "vc", "pe", "\\u", "inlines_", "=_", "[_", "Slice", "Privilege", "Inline_", ",_", "Cor", "d", "Insta", "nce", "Inline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ta", "g", "Inline_", ",_", "Reserva", "tion", "Inline_", ",_", "Slice", "Network", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inlines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "inline", "\\u", "class_", "in_", "cord", "\\u", "vc", "pe", "\\u", "inlines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inlines_", "._", "append_", "(_", "inline", "\\u", "class_", "(_", "self_", "._", "model_", ",_", "self_", "._", "admin", "\\u", "site_", ")_", ")_", "\\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 ", " _", "inlines_", "=_", "super_", "(_", "Slice", "Admin_", ",_", "self_", ")_", "._", "get", "\\u", "inline", "\\u", "instances_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "inlines_", "\\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_", "Slice", "Privilege", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "user", "'_", ",_", "'", "slice", "'_", ",_", "'", "role", "'_", "]_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "user", "'_", ",_", "'", "slice", "'_", ",_", "'", "role", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "list", "\\u", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "user", "'_", ",_", "'", "slice", "'_", ",_", "'", "role", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "inlines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Slice", "Privilege", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "slice", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Slice_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "user", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "User_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Slice", "Privilege", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Privilege", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "admin", "s", " ", "can", " ", "see", " ", "all", " ", "memberships", ".", " ", "User", "s", " ", "can", " ", "only", " ", "see", " ", "memberships", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "slice", "s", " ", "where", " ", "the", "y", " ", "have", " ", "the", " ", "admin", " ", "role", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Slice", "Privilege", "_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Privilege", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "model_", "(_", "self_", ",_", "request_", ",_", "obj_", ",_", "form_", ",_", "change_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "openst", "ack", " ", "connecti", "on", " ", "to", " ", "use", " ", "this", " ", "site", "/", "tenant_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth_", "=_", "request_", "._", "session_", "._", "get_", "(_", "'", "auth", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "[_", "'", "tenan", "t", "'_", "]_", "=_", "obj_", "._", "slice_", "._", "slice", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "os", "\\u", "manager_", "=_", "Open", "Stack", "Manager_", "(_", "auth_", "=_", "auth_", ",_", "caller_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Privilege", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "model_", "(_", "self_", ",_", "request_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "openst", "ack", " ", "connecti", "on", " ", "to", " ", "use", " ", "this", " ", "site", "/", "tenant_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth_", "=_", "request_", "._", "session_", "._", "get_", "(_", "'", "auth", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "[_", "'", "tenan", "t", "'_", "]_", "=_", "obj_", "._", "slice_", "._", "slice", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "os", "\\u", "manager_", "=_", "Open", "Stack", "Manager_", "(_", "auth_", "=_", "auth_", ",_", "caller_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "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_", "Image", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldsets_", "=_", "[_", "(_", "'", "Image", " ", "Det", "ail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "name", "'_", ",_", "'", "kind", "'_", ",_", "'", "disk", "\\u", "format", "'_", ",_", "'", "container", "\\u", "format", "'_", ",_", "'", "tag", "'_", ",_", "'", "path", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Image", " ", "Det", "ail", "s", "'_", ")_", ",_", "(_", "'", "instance", "s", "'_", ",_", "'", "Insta", "nce", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "image", "deployments", "'_", ",_", "'", "Deployment", "s", "'_", ")_", ",_", "(_", "'", "admin", "-", "only", "'_", ",_", "'", "Admi", "n", "-", "On", "ly", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inlines_", "=_", "[_", "Insta", "nce", "Inline_", ",_", "Controlle", "r", "Image", "s", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "disk", "\\u", "format", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "container", "\\u", "format", "'_", ",_", "'", "tag", "'_", ",_", "'", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "display_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "'", "kind", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "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_", "class_", "Node", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodel", "abels_", "=_", "forms_", "._", "Model", "Multipl", "e", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "queryset_", "=_", "Node", "Label_", "._", "objects_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "\"", "Select", " ", "whi", "ch", " ", "labels", " ", "appl", "y", " ", "to", " ", "this", " ", "node", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "Filter", "ed", "Select", "Multiple_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "(_", "'", "Label", "s", "'_", ")_", ",_", "is", "\\u", "stacked", "_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "site", "'_", ":_", "Linke", "d", "Select_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deploy", "ment", "'_", ":_", "Linke", "d", "Select_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "Node", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "kwargs_", "._", "pop_", "(_", "'", "request", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Node", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "instance_", "and_", "self_", "._", "instance_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "nodel", "abel", "s", "'_", "]_", "._", "initial_", "=_", "self_", "._", "instance_", "._", "nodel", "abels_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node", "Form_", "(_", "forms_", "._", "Model", "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_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "super_", "(_", "Node", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "commit_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "nodel", "abels_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "nodel", "abel", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "commit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "node_", "\\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_", "Node", "Label", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "(_", "'", "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_", "class_", "Node", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Node", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "'", "site", "\\u", "deploy", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "=_", "(_", "'", "site", "\\u", "deploy", "ment", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inlines_", "=_", "[_", "Ta", "g", "Inline_", ",_", "Insta", "nce", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "(_", "'", "Node", " ", "Det", "ail", "s", "'_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "name", "'_", ",_", "'", "site", "\\u", "deploy", "ment", "'_", "]_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "deta", "il", "s", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Label", "s", "'_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "nodel", "abel", "s", "'_", "]_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "labels", "'_", "]_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "site", "\\u", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "inlines_", "=_", "[_", "Ta", "g", "Inline_", ",_", "Insta", "nce", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "deta", "il", "s", "'_", ",_", "'", "Node", " ", "Det", "ail", "s", "'_", ")_", ",_", "(_", "'", "instance", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Insta", "nce", "s", "'_", ")_", ",_", "(_", "'", "labels", "'_", ",_", "'", "Label", "s", "'_", ")_", ",_", "(_", "'", "tags", "'_", ",_", "'", "Ta", "gs", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Node", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "host", "s", "\\u", "nodes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "super_", "(_", "Node", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "field_", "\\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_", "Insta", "nce", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "Plai", "n", "Text", "Widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "name_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "Plai", "n", "Text", "Widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ip", "'_", ":_", "Plai", "n", "Text", "Widget_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ":_", "Plai", "n", "Text", "Widget_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "Plai", "n", "Text", "Widget_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slice", "'_", ":_", "Linke", "d", "Select_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deploy", "ment", "'_", ":_", "Linke", "d", "Select_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "node", "'_", ":_", "Linke", "d", "Select_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "image", "'_", ":_", "Linke", "d", "Select_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ta", "g", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ",_", "'", "value", "'_", ",_", "'", "content", "\\u", "type", "'_", ",_", "'", "content", "\\u", "object", "'_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "list", "\\u", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "service", "'_", ",_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ",_", "'", "content", "\\u", "type", "'_", ",_", "'", "content", "\\u", "object", "'_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "inlines_", "=_", "[_", "]_", "\\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_", "Insta", "nce", "Port", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "network", "'_", ",_", "'", "instance", "'_", ",_", "'", "ip", "'_", ",_", "'", "mac", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "ip", "\"_", ",_", "\"", "mac", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", "link", "\\u", "field", "name", " ", "=", " ", "\"", "network", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Port", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Port", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "port", "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_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Insta", "nce", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Insta", "nce", " ", "Det", "ail", "s", "'_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "slice", "'_", ",_", "'", "deploy", "ment", "'_", ",_", "'", "isolation", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", ",_", "'", "node", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "'", "instance", "\\u", "name", "'_", ",_", "'", "ssh", "\\u", "command", "'_", ",_", "]_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", ",_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Containe", "r", " ", "Sett", "ings", "'_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "volume", "s", "'_", "]_", ",_", "'", "classe", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "container", "'_", "]_", ",_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "ssh", "\\u", "command", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ",_", "'", "isolation", "'_", ",_", "'", "slice", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", ",_", "'", "node", "'_", ",_", "'", "deploy", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "instance", "\\u", "id", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Insta", "nce", " ", "Det", "ail", "s", "'_", ")_", ",_", "(_", "'", "port", "s", "'_", ",_", "'", "Port", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "container", "'_", ",_", "'", "Containe", "r", " ", "Sett", "ings", "'_", ")_", ",_", "(_", "'", "tags", "'_", ",_", "'", "Ta", "gs", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inlines_", "=_", "[_", "Ta", "g", "Inline_", ",_", "Insta", "nce", "Port", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "slice", "'_", ",_", "'", "deploy", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "node", "'_", ",_", "'", "ip", "'_", ",_", "'", "instance", "\\u", "name", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "save", "\\u", "model", "(", "self", ",", " ", "request", ",", " ", "obj", ",", " ", "form", ",", " ", "change", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "update", " ", "openst", "ack", " ", "connecti", "on", " ", "to", " ", "use", " ", "this", " ", "site", "/", "tenant_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "auth", " ", "=", " ", "request", ".", "session", ".", "get", "('", "auth", "',", " ", "{})", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "auth", "['", "tenan", "t", "']", " ", "=", " ", "obj", ".", "slice", ".", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "obj", ".", "os", "\\u", "manage", "r", " ", "=", " ", "Open", "Stack", "Manager", "(", "auth", "=", "auth", ",", " ", "caller", "=", "request", ".", "user", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "obj", ".", "creat", "or", " ", "=", " ", "request", ".", "user_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "obj", ".", "save", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "delete", "\\u", "model", "(", "self", ",", " ", "request", ",", " ", "obj", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "update", " ", "openst", "ack", " ", "connecti", "on", " ", "to", " ", "use", " ", "this", " ", "site", "/", "tenant_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "auth", " ", "=", " ", "request", ".", "session", ".", "get", "('", "auth", "',", " ", "{})", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "auth", "['", "tenan", "t", "']", " ", "=", " ", "obj", ".", "slice", ".", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "obj", ".", "os", "\\u", "manage", "r", " ", "=", " ", "Open", "Stack", "Manager", "(", "auth", "=", "auth", ",", " ", "caller", "=", "request", ".", "user", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "obj", ".", "delete", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "ssh", "\\u", "command_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ssh", "\\u", "command_", "=_", "obj_", "._", "get", "\\u", "ssh", "\\u", "command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ssh", "\\u", "command_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ssh", "\\u", "command_", "\\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_", "\"(", "not", " ", "avail", "able", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\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_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "slice", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Slice_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Insta", "nce", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "admin", "s", " ", "can", " ", "see", " ", "all", " ", "instance", "s", ".", " ", "User", "s", " ", "can", " ", "only", " ", "see", " ", "instance", "s", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "slice", "s", " ", "the", "y", " ", "belo", "ng", " ", "to", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Instance_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "form", "\\u", "url_", "=_", "''_", ",_", "extra", "\\u", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ssh", "\\u", "command", "'_", ",_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Insta", "nce", "Admin_", ",_", "self_", ")_", "._", "add", "\\u", "view_", "(_", "request_", ",_", "form", "\\u", "url_", ",_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "change", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "object\\u", "id_", ",_", "extra", "\\u", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "ssh", "\\u", "command", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "all", "\\u", "ips", "\\u", "string", "'_", ",_", "'", "deploy", "ment", "'_", ",_", "'", "slice", "'_", ",_", "'", "flavor", "'_", ",_", "'", "image", "'_", ",_", "'", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "XO", "SA", "dmin", "Mix", "in", ".", "change", "\\u", "view", "'", "s", " ", "user", "\\u", "read", "only", "\\u", "fields", " ", "switching", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "read", "only", "\\u", "save_", "=_", "self_", "._", "read", "only", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Insta", "nce", "Admin_", ",_", "self_", ")_", "._", "change", "\\u", "view_", "(_", "request_", ",_", "object\\u", "id_", ",_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "change", "\\u", "form_", "(_", "self_", ",_", "request_", ",_", "context_", ",_", "add_", "=_", "False_", ",_", "change_", "=_", "False_", ",_", "form", "\\u", "url_", "=_", "''_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "node", " ", "in", " ", "Node", ".", "object", "s", ".", "all", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", "in_", "Node_", "._", "objects_", "._", "order", "\\u", "by_", "(_", "\"", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "nodes_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "node_", "._", "site", "\\u", "deployment_", "._", "deployment_", "._", "id_", ",_", "node_", "._", "id_", ",_", "node_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "deploy", "ment", "\\u", "flavors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "flavor_", "in_", "Flavor_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "deployment_", "in_", "flavor_", "._", "deployments", "_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "flavors_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deployment_", "._", "id_", ",_", "flavor_", "._", "id_", ",_", "flavor_", "._", "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_", "deploy", "ment", "\\u", "images_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "image_", "in_", "Image_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "deploy", "ment", "\\u", "image_", "in_", "image_", "._", "image", "deployments", "_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "images_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deploy", "ment", "\\u", "image_", "._", "deployment_", "._", "id_", ",_", "image_", "._", "id_", ",_", "image_", "._", "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_", "site", "\\u", "login", "\\u", "bases_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "Site_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site", "\\u", "login", "\\u", "bases_", "._", "append_", "(_", "(_", "site_", "._", "id_", ",_", "site_", "._", "login", "\\u", "base_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "\"", "deploy", "ment", "\\u", "nodes", "\"_", "]_", "=_", "deploy", "ment", "\\u", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "deploy", "ment", "\\u", "flavor", "s", "\"_", "]_", "=_", "deploy", "ment", "\\u", "flavors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "deploy", "ment", "\\u", "images", "\"_", "]_", "=_", "deploy", "ment", "\\u", "images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "\"", "site", "\\u", "login", "\\u", "base", "s", "\"_", "]_", "=_", "site", "\\u", "login", "\\u", "bases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Insta", "nce", "Admin_", ",_", "self_", ")_", "._", "render", "\\u", "change", "\\u", "form_", "(_", "request_", ",_", "context_", ",_", "add_", ",_", "change_", ",_", "form", "\\u", "url_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "deploy", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Deployment", "_", "._", "select", "\\u", "by", "\\u", "acl_", "(_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site", "deployments", "\\u\\u", "nodes", "\\u\\u", "isnull_", "=_", "False_", ")_", "._", "distinct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "deploy", "ment", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "flavor", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "'", "on", "Change", "'_", ":_", "\"", "instance", "\\u", "flavor", "\\u", "change", "d", "(", "this", ");\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "super_", "(_", "Insta", "nce", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "field_", "\\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_", "User", "Creat", "ion", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "form", " ", "for", " ", "creati", "ng", " ", "new", " ", "users", ".", " ", "Includes", " ", "all", " ", "the", " ", "require", "d", "\\", "10", ";", " ", " ", " ", " ", "fields", ",", " ", "plus", " ", "a", " ", "repeated", " ", "password", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "1_", "=_", "forms_", "._", "Char", "Field_", "(_", "label_", "=_", "'", "Passw", "ord", "'_", ",_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "2_", "=_", "forms_", "._", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "'", "Passw", "ord", " ", "confirmation", "'_", ",_", "widget_", "=_", "forms_", "._", "Passw", "ord", "Input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "email", "'_", ",_", "'", "first", "name", "'_", ",_", "'", "last", "name", "'_", ",_", "'", "phone", "'_", ",_", "'", "public", "\\u", "key", "'_", ")_", "\\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_", "User", "Creat", "ion", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "password", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "two", " ", "password", " ", "entri", "es", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password", "1_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "password", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "2_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "password", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "password", "1_", "and_", "password", "2_", "and_", "password", "1_", "!=_", "password", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\"", "Passw", "ords", " ", "don", "'", "t", " ", "match", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "password", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Creat", "ion", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "provided", " ", "password", " ", "in", " ", "hashed", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "super_", "(_", "User", "Creat", "ion", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "commit_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "password_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\"", "password", "1", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "user", ".", "set\\u", "password", "(", "self", ".", "clean", "ed", "\\u", "data", "[\"", "password", "1", "\"]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "commit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "User", "Change", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "form", " ", "for", " ", "updat", "ing", " ", "users", ".", " ", "Includes", " ", "all", " ", "the", " ", "fields", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "user", ",", " ", "but", " ", "replace", "s", " ", "the", " ", "password", " ", "field", " ", "with", " ", "admin", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "password", " ", "hash", " ", "display", " ", "field", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "Read", "On", "ly", "Passw", "ord", "Hash", "Field_", "(_", "label_", "=_", "'", "Passw", "ord", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "'<", "a", " ", "href", "=\\\\\"", "password", "/\\\\", "\">", "Change", " ", "Passw", "ord", "</", "a", ">.", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PROFILE", "\\u", "CHOICES_", "=_", "(_", "(_", "None_", ",_", "'-----", "-'_", ")_", ",_", "(_", "'", "regular", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Regula", "r", " ", "user", "'_", ")_", ",_", "(_", "'", "cp", "'_", ",_", "'", "Conten", "t", " ", "Provider", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "=_", "forms_", "._", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "PROFILE", "\\u", "CHOICES_", ",_", "required_", "=_", "False_", ",_", "label_", "=_", "\"", "Qui", "ck", " ", "Profil", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "'", "public", "\\u", "key", "'_", ":_", "Upload", "Text", "area", "Widget_", ",_", "}_", "\\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_", "User", "Change", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "password_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reg", "ard", "less", " ", "of", " ", "what", " ", "the", " ", "user", " ", "provide", "s", ",", " ", "return", " ", "the", " ", "initial", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "don", "e", " ", "here", ",", " ", "rat", "her", " ", "than", " ", "on", " ", "the", " ", "field", ",", " ", "bec", "aus", "e", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "field", " ", "doe", "s", " ", "not", " ", "have", " ", "access", " ", "to", " ", "the", " ", "initial", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "initial_", "[_", "\"", "password", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Change", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "profile", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "instance_", "._", "appl", "y", "\\u", "profile_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "profile", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "User", "Change", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "*_", "args_", ",_", "**_", "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_", "User", "Dash", "board", "View", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "User", "Dash", "board", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "dashboards", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "user", "'_", ",_", "'", "dash", "board", "View", "'_", ",_", "'", "order", "'_", "]_", "\\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_", "Controlle", "r", "User", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "controlle", "r", "'_", ",_", "'", "user", "'_", ",_", "'", "kus", "er", "\\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_", "class_", "User", "Admin_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "User", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Make", " ", "sure", " ", "XO", "SA", "dmin", "Mix", "in", " ", "is", " ", "liste", "d", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "admin", ".", "Model", "Admi", "n", " ", "in", " ", "the", " ", "class", " ", "declaration", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "label_", "=_", "\"", "core", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "forms", " ", "to", " ", "add", " ", "and", " ", "change", " ", "user", " ", "instances_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "=_", "User", "Change", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "form_", "=_", "User", "Creat", "ion", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "fields", " ", "to", " ", "be", " ", "used", " ", "in", " ", "display", "ing", " ", "the", " ", "User", " ", "model", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "override", " ", "the", " ", "definit", "ion", "s", " ", "on", " ", "the", " ", "base", " ", "User", "Admin_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "reference", " ", "specific", " ", "fields", " ", "on", " ", "auth", ".", "User", "._", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "email", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "name", "'_", ",_", "'", "last", "name", "'_", ",_", "'", "site", "'_", ",_", "'", "last", "\\u", "login", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "\"", "email", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "=_", "(_", "'", "site", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Slice", "Privilege", "Inline_", ",_", "Site", "Privilege", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "inlines_", "=_", "[_", "Controlle", "r", "User", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "List", "Logi", "n", "Details_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "email", "'_", ",_", "'", "site", "'_", ",_", "'", "password", "'_", ",_", "'", "is", "\\u", "active", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "read", "only", "'_", ",_", "'", "is", "\\u", "admin", "'_", ",_", "'", "is", "\\u", "app", "user", "'_", ",_", "'", "public", "\\u", "key", "'_", ",_", "'", "login", "\\u", "page", "'_", ",_", "'", "profile", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "List", "Conta", "ct", "Info_", "=_", "[_", "'", "first", "name", "'_", ",_", "'", "last", "name", "'_", ",_", "'", "phone", "'_", ",_", "'", "timezon", "e", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fieldsets_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Logi", "n", " ", "Det", "ail", "s", "'_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "email", "'_", ",_", "'", "site", "'_", ",_", "'", "password", "'_", ",_", "'", "is", "\\u", "active", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "read", "only", "'_", ",_", "'", "is", "\\u", "admin", "'_", ",_", "'", "is", "\\u", "app", "user", "'_", ",_", "'", "public", "\\u", "key", "'_", "]_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Conta", "ct", " ", "Information", "'_", ",_", "{_", "'", "fields", "'_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "name", "'_", ",_", "'", "last", "name", "'_", ",_", "'", "phone", "'_", ",_", "'", "timezon", "e", "'_", ")_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "contact", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#(", "'", "Importa", "nt", " ", "dates", "',", " ", "{", "'", "fields", "':", " ", "('", "last", "\\u", "login", "',", ")}", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "fieldsets_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "(_", "'", "wide", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "(_", "'", "site", "'_", ",_", "'", "email", "'_", ",_", "'", "first", "name", "'_", ",_", "'", "last", "name", "'_", ",_", "'", "is", "\\u", "admin", "'_", ",_", "'", "is", "\\u", "read", "only", "'_", ",_", "'", "is", "\\u", "app", "user", "'_", ",_", "'", "phone", "'_", ",_", "'", "public", "\\u", "key", "'_", ",_", "'", "password", "1", "'_", ",_", "'", "password", "2", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "fields_", "=_", "(_", "'", "email", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "(_", "'", "email", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "horizontal_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "field", "List", "Logi", "n", "Details_", "+_", "field", "List", "Conta", "ct", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "User", "Admin_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "User", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Make", " ", "sure", " ", "XO", "SA", "dmin", "Mix", "in", " ", "is", " ", "liste", "d", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "admin", ".", "Model", "Admi", "n", " ", "in", " ", "the", " ", "class", " ", "declaration", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "suit", "\\u", "form", "\\u", "tabs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getattr_", "(_", "\\u", "thread", "\\u", "locals_", ",_", "\"", "obj", "\"_", ",_", "None_", ")_", "is_", "None_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "=_", "[_", "(_", "'", "genera", "l", "'_", ",_", "'", "Logi", "n", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "contact", "'_", ",_", "'", "Conta", "ct", " ", "Information", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slice", "privilege", "s", "'_", ",_", "'", "Slice", " ", "Privilege", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "site", "privilege", "s", "'_", ",_", "'", "Site", " ", "Privilege", "s", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "getattr_", "(_", "\\u", "thread", "\\u", "locals_", ",_", "\"", "request", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "and_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "._", "append_", "(_", "(_", "'", "admin", "-", "only", "'_", ",_", "'", "Admi", "n", "-", "On", "ly", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tabs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Admin_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "User", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Make", " ", "sure", " ", "XO", "SA", "dmin", "Mix", "in", " ", "is", " ", "liste", "d", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "admin", ".", "Model", "Admi", "n", " ", "in", " ", "the", " ", "class", " ", "declaration", "._", "\\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_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "site", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "querys", "et", "'_", "]_", "=_", "Site_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ")_", "._", "filter_", "(_", "host", "s", "\\u", "users_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "User", "Admin_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Admin_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "User", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Make", " ", "sure", " ", "XO", "SA", "dmin", "Mix", "in", " ", "is", " ", "liste", "d", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "admin", ".", "Model", "Admi", "n", " ", "in", " ", "the", " ", "class", " ", "declaration", "._", "\\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_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "User_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Admin_", "(_", "XO", "SA", "dmin", "Mixin_", ",_", "User", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Make", " ", "sure", " ", "XO", "SA", "dmin", "Mix", "in", " ", "is", " ", "liste", "d", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "admin", ".", "Model", "Admi", "n", " ", "in", " ", "the", " ", "class", " ", "declaration", "._", "\\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_", "get", "\\u", "form_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "copy", " ", "login", " ", "deta", "il", "s", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login", "\\u", "deta", "il", "s", "\\u", "fields_", "=_", "list_", "(_", "self_", "._", "field", "List", "Logi", "n", "Details_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "admin", "s", " ", "can", " ", "see", " ", "'", "is", "\\u", "admin", "'", " ", "and", " ", "'", "is", "\\u", "read", "only", "'", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "is", "\\u", "admin", "'_", "in_", "login", "\\u", "deta", "il", "s", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login", "\\u", "deta", "il", "s", "\\u", "fields_", "._", "remove_", "(_", "'", "is", "\\u", "admin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "is", "\\u", "read", "only", "'_", "in_", "login", "\\u", "deta", "il", "s", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login", "\\u", "deta", "il", "s", "\\u", "fields_", "._", "remove_", "(_", "'", "is", "\\u", "read", "only", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "is", "\\u", "app", "user", "'_", "in_", "login", "\\u", "deta", "il", "s", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login", "\\u", "deta", "il", "s", "\\u", "fields_", "._", "remove_", "(_", "'", "is", "\\u", "admin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "profile", "'_", "in_", "login", "\\u", "deta", "il", "s", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login", "\\u", "deta", "il", "s", "\\u", "fields_", "._", "remove_", "(_", "'", "profile", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "len", "(", "request", ".", "user", ".", "site", "privilege", "s", ".", "filter", "(", "role", "\\u\\u", "role", " ", "=", " ", "'", "pi", "'))", " ", ">", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "admin", "s", " ", "and", " ", "pis", " ", "can", " ", "change", " ", "a", " ", "user", "'", "s", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "read", "only", "\\u", "fields", " ", "=", " ", "('", "back", "end", "\\u", "status", "\\u", "text", "',", " ", "'", "site", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fieldsets_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Logi", "n", " ", "Det", "ail", "s", "'_", ",_", "{_", "'", "fields", "'_", ":_", "login", "\\u", "deta", "il", "s", "\\u", "fields_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Conta", "ct", " ", "Information", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "self_", "._", "field", "List", "Conta", "ct", "Info_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "contact", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "User", "Admin_", ",_", "self_", ")_", "._", "get", "\\u", "form_", "(_", "request_", ",_", "obj_", ",_", "**_", "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_", "Controlle", "r", "Dash", "board", "View", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Dash", "board", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "controlle", "r", "\"_", ",_", "\"", "url", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "controlle", "rs", "'_", "\\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_", "Dash", "board", "View", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldsets_", "=_", "[_", "(_", "'", "Dash", "board", " ", "View", " ", "Det", "ail", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "name", "'_", ",_", "'", "url", "'_", ",_", "'", "enable", "d", "'_", ",_", "'", "deployments", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "[_", "\"", "name", "\"_", ",_", "\"", "enable", "d", "\"_", ",_", "\"", "url", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Controlle", "r", "Dash", "board", "View", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Dash", "board", " ", "View", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "controlle", "rs", "'_", ",_", "'", "Per", "-", "controlle", "r", " ", "Dash", "board", " ", "Det", "ail", "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_", "class_", "Service", "Reso", "urc", "e", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Service", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "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_", "class_", "Service", "Class", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "commitment", "'_", ",_", "'", "member", "ship", "Fee", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Service", "Reso", "urc", "e", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "commitment", "'_", ",_", "'", "member", "ship", "Fee", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "inlines_", "=_", "[_", "]_", "\\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_", "Reserve", "d", "Reso", "urc", "e", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Reserve", "d", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "reserve", "dre", "source", "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_", "[SEP]_", "class_", "Reserve", "d", "Reso", "urc", "e", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "request_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "=_", "super_", "(_", "Reserve", "d", "Reso", "urc", "e", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "foreign", "key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "field_", ",_", "request_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "resource", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "restrict", " ", "resource", "s", " ", "to", " ", "tho", "se", " ", "tha", "t", " ", "the", " ", "slice", "'", "s", " ", "service", " ", "class", " ", "allow", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "\\u", "slice_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "._", "queryset_", "=_", "field_", "._", "queryset_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service", "Class_", "=_", "request_", "._", "\\u", "slice_", "._", "service", "Class_", ",_", "calendar", "Reserva", "ble_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "field_", "._", "queryset_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "field_", "._", "initial_", "=_", "field_", "._", "queryset_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\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 ", " _", "field_", "._", "queryset_", "=_", "field_", "._", "queryset_", "._", "none_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "db", "\\u", "field_", "._", "name_", "==_", "'", "instance", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "restrict", " ", "instance", "s", " ", "to", " ", "tho", "se", " ", "tha", "t", " ", "belo", "ng", " ", "to", " ", "the", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "\\u", "slice_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "._", "queryset_", "=_", "field_", "._", "queryset_", "._", "filter_", "(_", "slice_", "=_", "request_", "._", "\\u", "slice_", ")_", "\\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 ", " _", "field_", "._", "queryset_", "=_", "field_", "._", "queryset_", "._", "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_", "return_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reserve", "d", "Reso", "urc", "e", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Reserve", "d", "Resource_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reserva", "tion", "Change", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Reserva", "tion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slice", "'_", ":_", "Linke", "d", "Select_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reserva", "tion", "Add", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice_", "=_", "forms_", "._", "Model", "Choi", "ce", "Field_", "(_", "queryset_", "=_", "Slice_", "._", "objects_", "._", "all_", "(_", ")_", ",_", "widget_", "=_", "forms_", "._", "Select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "=_", "{_", "\"", "on", "Change", "\"_", ":_", "\"", "document", ".", "get", "Element", "By", "Id", "('", "id", "\\u", "refre", "sh", "')", ".", "value", "=", "1", ";", " ", "submit", "()\"_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refresh_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Hi", "dde", "n", "Input_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Media_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css_", "=_", "{_", "'", "all", "'_", ":_", "(_", "'", "xo", "s", ".", "css", "'_", ",_", ")_", "}_", "#", " ", ".", "field", "-", "refre", "sh", " ", "{", " ", "display", ":", " ", "none", ";", " ", "}_", "\\u\\u\\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_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Reserva", "tion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slice", "'_", ":_", "Linke", "d", "Select_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reserva", "tion", "Add", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "slice_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "slice", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "Service", "Resource_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service", "Class_", "=_", "slice_", "._", "service", "Class_", ",_", "calendar", "Reserva", "ble_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "x_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "slice", " ", "you", " ", "selecte", "d", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "service", " ", "class", " ", "tha", "t", " ", "allow", "s", " ", "reserva", "tion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "slice_", "\\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_", "Reserva", "tion", "Add", "Refr", "esh", "Form_", "(_", "Reserva", "tion", "Add", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Thi", "s", " ", "form", " ", "is", " ", "displaye", "d", " ", "whe", "n", " ", "the", " ", "Reserva", "tion", " ", "Form", " ", "receive", "s", " ", "an", " ", "update", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "the", " ", "Slice", " ", "dropdown", " ", "on", "Change", " ", "handler", ".", " ", "It", " ", "doe", "sn", "'", "t", " ", "validat", "e", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "and", " ", "doe", "sn", "'", "t", " ", "save", " ", "the", " ", "data", ".", " ", "Thi", "s", " ", "will", " ", "caus", "e", " ", "the", " ", "form", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "redraw", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "don", "'", "t", " ", "validat", "e", " ", "anyt", "hing", " ", "other", " ", "than", " ", "slice", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "t", "\\u", "validat", "e\\u", "fields_", "=_", "(_", "\"", "start", "Time", "\"_", ",_", "\"", "duration", "\"_", ")_", "\\u\\u\\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_", "\"\"\"", " ", "don", "'", "t", " ", "save", " ", "anyt", "hing", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reserva", "tion", "Add", "Refr", "esh", "Form_", "(_", "Reserva", "tion", "Add", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "full", "\\u", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Reserva", "tion", "Add", "Form_", ",_", "self_", ")_", "._", "full", "\\u", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fieldname_", "in_", "self_", "._", "don", "t", "\\u", "validat", "e\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fieldname_", "in_", "self_", "._", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "errors_", "[_", "fieldname_", "]_", "\\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_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reserva", "tion", "Add", "Refr", "esh", "Form_", "(_", "Reserva", "tion", "Add", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "is", "\\u", "valid_", "(_", "self_", ")_", ":_", "\\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_", "class_", "Reserva", "tion", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "List_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "slice", "'_", ",_", "'", "start", "Time", "'_", ",_", "'", "duration", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "(_", "'", "Reserva", "tion", " ", "Det", "ail", "s", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "field", "List_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "start", "Time", "'_", ",_", "'", "duration", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Reserva", "tion", "Add", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Reserva", "tion", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "reserve", "dre", "source", "s", "'_", ",_", "'", "Reserve", "d", " ", "Reso", "urc", "es", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inlines_", "=_", "[_", "Reserve", "d", "Reso", "urc", "e", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "field", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Reserva", "tion", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "form", "\\u", "url_", "=_", "''_", ",_", "extra", "\\u", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timezone_", "._", "activate_", "(_", "request_", "._", "user_", "._", "timezone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "refresh_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "slice_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\"", "refre", "sh", "\"", " ", "will", " ", "be", " ", "set", " ", "to", " ", "\"", "1", "\"", " ", "if", " ", "the", " ", "form", " ", "was", " ", "submitted", " ", "due", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "change", " ", "in", " ", "the", " ", "Slice", " ", "dropdown", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "refre", "sh", "\"_", ",_", "\"", "1", "\"_", ")_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "\\u", "refresh_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "POST_", "[_", "\"", "refre", "sh", "\"_", "]_", "=_", "\"", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Keep", " ", "track", " ", "of", " ", "the", " ", "slice", " ", "tha", "t", " ", "was", " ", "selecte", "d", ",", " ", "so", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reserve", "d", "Reso", "urc", "e", " ", "inline", " ", "can", " ", "filter", " ", "items", " ", "for", " ", "the", " ", "slice", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "._", "\\u", "slice_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "slice", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "request_", "._", "\\u", "slice_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "\\u", "slice_", "=_", "Slice_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "request_", "._", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "super_", "(_", "Reserva", "tion", "Admin_", ",_", "self_", ")_", "._", "add", "\\u", "view_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "form", "\\u", "url_", ",_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reserva", "tion", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "changeli", "st", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "extra", "\\u", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timezone_", "._", "activate_", "(_", "request_", "._", "user_", "._", "timezone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Reserva", "tion", "Admin_", ",_", "self_", ")_", "._", "changeli", "st", "\\u", "view_", "(_", "request_", ",_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reserva", "tion", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "form_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "\\u", "obj\\u_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "change", "s", ",", " ", "set", " ", "request", ".\\u", "slice", " ", "to", " ", "the", " ", "slice", " ", "alr", "ead", "y", " ", "set", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "\\u", "slice_", "=_", "obj_", "._", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "form_", "=_", "Reserva", "tion", "Change", "Form_", "\\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_", "getattr_", "(_", "request_", ",_", "\"\\u", "refre", "sh", "\"_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "form_", "=_", "Reserva", "tion", "Add", "Refr", "esh", "Form_", "\\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_", "._", "form_", "=_", "Reserva", "tion", "Add", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Reserva", "tion", "Admin_", ",_", "self_", ")_", "._", "get", "\\u", "form_", "(_", "request_", ",_", "obj_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reserva", "tion", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "read", "only", "\\u", "fields_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "obj_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prev", "ent", " ", "slice", " ", "from", " ", "bei", "ng", " ", "change", "d", " ", "after", " ", "the", " ", "reserva", "tion", " ", "has", " ", "bee", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "created", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "'", "slice", "'_", "]_", "\\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_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reserva", "tion", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\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_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Reserva", "tion_", "._", "select", "\\u", "by", "\\u", "user_", "(_", "request_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Network", "Parameter", "Type", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "name", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "inlines_", "=_", "[_", "]_", "\\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_", "Route", "r", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "name", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "inlines_", "=_", "[_", "]_", "\\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_", "Route", "r", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Router_", "._", "networks_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Route", "rs", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Route", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "router", "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_", "class_", "Network", "Parameter", "Inline_", "(_", "Pl", "Stack", "Gene", "ric", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Network", "Parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Parameter", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Parameter", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "net", "params", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "parameter", "'_", ",_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Network", "Port", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "network", "'_", ",_", "'", "instance", "'_", ",_", "'", "ip", "'_", ",_", "'", "mac", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "ip", "\"_", ",_", "\"", "mac", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", "link", "\\u", "field", "name", " ", "=", " ", "\"", "instance", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Port", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Port", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "port", "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_", "class_", "Network", "Slice", "s", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Network", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self", "link", "\\u", "fieldname_", "=_", "\"", "slice", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Slice", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Slice", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "network", "slice", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "network", "'_", ",_", "'", "slice", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Controlle", "r", "Network", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Controlle", "r", "Network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Controlle", "r", " ", "Network", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Controlle", "r", " ", "Network", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "admin", "-", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "controlle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "net", "\\u", "id", "'_", ",_", "'", "subnet", "\\u", "id", "'_", ",_", "'", "subnet", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", ")_", "\\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_", "Network", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "topo", "log", "y", "Parameter", "s", "'_", ":_", "Upload", "Text", "area", "Widget_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "controlle", "r", "Parameter", "s", "'_", ":_", "Upload", "Text", "area", "Widget_", ",_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Network", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "name", "\"_", ",_", "\"", "subnet", "\"_", ",_", "\"", "port", "s", "\"_", ",_", "\"", "labels", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "subnet", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Network", "Parameter", "Inline_", ",_", "Network", "Port", "Inline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Network", "Slice", "s", "Inline_", ",_", "Route", "r", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "inlines_", "=_", "[_", "Controlle", "r", "Network", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Network", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "name", "'_", ",_", "'", "template", "'_", ",_", "'", "port", "s", "'_", ",_", "'", "labels", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ",_", "'", "guaran", "tee", "d\\u", "bandwi", "dth", "'_", ",_", "'", "permit", "\\u", "all", "\\u", "slice", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permit", "ted", "\\u", "slice", "s", "'_", ",_", "'", "network", "\\u", "id", "'_", ",_", "'", "router", "\\u", "id", "'_", ",_", "'", "subnet", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subnet", "'_", ",_", "'", "autocon", "nect", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "topo", "log", "y", "\\u", "parameter", "s", "'_", ",_", "'", "controlle", "r", "\\u", "url", "'_", ",_", "'", "controlle", "r", "\\u", "parameter", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "sdn", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "template", "'_", ",_", "'", "port", "s", "'_", ",_", "'", "labels", "'_", ",_", "'", "owner", "'_", ",_", "'", "guaran", "tee", "d\\u", "bandwi", "dth", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permit", "\\u", "all", "\\u", "slice", "s", "'_", ",_", "'", "permit", "ted", "\\u", "slice", "s", "'_", ",_", "'", "network", "\\u", "id", "'_", ",_", "'", "router", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subnet", "\\u", "id", "'_", ",_", "'", "subnet", "'_", ",_", "'", "autocon", "nect", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Network", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "suit", "\\u", "form", "\\u", "tabs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "=_", "[_", "(_", "'", "genera", "l", "'_", ",_", "'", "Network", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "sdn", "'_", ",_", "'", "SD", "N", " ", "Configura", "tion", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "net", "params", "'_", ",_", "'", "Parameter", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "port", "s", "'_", ",_", "'", "Port", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "network", "slice", "s", "'_", ",_", "'", "Slice", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "router", "s", "'_", ",_", "'", "Route", "rs", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "getattr_", "(_", "\\u", "thread", "\\u", "locals_", ",_", "\"", "request", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "and_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "._", "append_", "(_", "(_", "'", "admin", "-", "only", "'_", ",_", "'", "Admi", "n", "-", "On", "ly", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tabs_", "\\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_", "Network", "Templa", "te", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "guaran", "tee", "d\\u", "bandwi", "dth", "\"_", ",_", "\"", "visi", "bilit", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "name", "\"_", ",_", "\"", "guaran", "tee", "d\\u", "bandwi", "dth", "\"_", ",_", "\"", "visi", "bilit", "y", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "inlines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Network", "Parameter", "Inline_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "name", "'_", ",_", "'", "description", "'_", ",_", "'", "guaran", "tee", "d\\u", "bandwi", "dth", "'_", ",_", "'", "visi", "bilit", "y", "'_", ",_", "'", "translatio", "n", "'_", ",_", "'", "access", "'_", ",_", "'", "shared", "\\u", "network", "\\u", "name", "'_", ",_", "'", "shared", "\\u", "network", "\\u", "id", "'_", ",_", "'", "topo", "log", "y", "\\u", "kind", "'_", ",_", "'", "controlle", "r", "\\u", "kind", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Network", " ", "Templa", "te", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "net", "params", "'_", ",_", "'", "Parameter", "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_", "class_", "Port", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "id", "\"_", ",_", "\"", "ip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "icon", "'_", ",_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "subnet", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Network", "Parameter", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", "'", "network", "'_", ",_", "'", "instance", "'_", ",_", "'", "ip", "'_", ",_", "'", "port", "\\u", "id", "'_", ",_", "'", "mac", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "'", "back", "end", "\\u", "status", "\\u", "text", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "(_", "'", "genera", "l", "'_", ",_", "'", "Port", " ", "Det", "ail", "s", "'_", ")_", ",_", "(_", "'", "net", "params", "'_", ",_", "'", "Parameter", "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_", "class_", "Fla", "vor", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "\"_", ",_", "\"", "order", "\"_", ",_", "\"", "default", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "\"", "back", "end", "\\u", "status", "\\u", "icon", "\"_", ",_", "\"", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "name", "\"_", ",_", "\"", "flavor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "\"", "name", "\"_", ",_", "\"", "description", "\"_", ",_", "\"", "flavor", "\"_", ",_", "\"", "order", "\"_", ",_", "\"", "default", "\"_", ")_", "\\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_", "cache", "\\u", "credentials_", "(_", "sender_", ",_", "user_", ",_", "request_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth_", "=_", "{_", "'", "user", "name", "'_", ":_", "request_", "._", "POST_", "[_", "'", "user", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "request_", "._", "POST_", "[_", "'", "password", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "[_", "'", "auth", "'_", "]_", "=_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dollar", "\\u", "field_", "(_", "field", "Name_", ",_", "short", "\\u", "description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "new", "Func_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\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 ", " _", "x_", "=_", "\"$", " ", "%", "0.", "2f", "\"_", "%_", "float_", "(_", "getattr_", "(_", "obj_", ",_", "field", "Name_", ",_", "0.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 ", " _", "x_", "=_", "getattr_", "(_", "obj_", ",_", "field", "Name_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Func_", "._", "short", "\\u", "description_", "=_", "short", "\\u", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "Func_", "\\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_", "right", "\\u", "dollar", "\\u", "field_", "(_", "field", "Name_", ",_", "short", "\\u", "description_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "new", "Func_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "x", "=", " ", "'<", "div", " ", "align", "=", "right", " ", "style", "=\"", "widt", "h", ":", "6e", "m", "\">", "$", " ", "%", "0.", "2f", "</", "div", ">'", " ", "%", " ", "float", "(", "getattr", "(", "obj", ",", " ", "field", "Name", ",", " ", "0.", "0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "'<", "div", " ", "align", "=", "right", ">", "$", " ", "%", "0.", "2f", "</", "div", ">'_", "%_", "float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "getattr_", "(_", "obj_", ",_", "field", "Name_", ",_", "0.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 ", " _", "x_", "=_", "getattr_", "(_", "obj_", ",_", "field", "Name_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Func_", "._", "short", "\\u", "description_", "=_", "short", "\\u", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Func_", "._", "allow", "\\u", "tags_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "Func_", "\\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_", "Invoice", "Charge", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Charge", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Charge", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Charge", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "[_", "'", "account", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "kind", "\"_", ",_", "\"", "state", "\"_", ",_", "\"", "object", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "core", "Hour", "s", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", ",_", "\"", "slice", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "kind", "\"_", ",_", "\"", "state", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "\"_", ",_", "\"", "core", "Hour", "s", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", ",_", "\"", "slice", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dollar", "\\u", "amount_", "=_", "right", "\\u", "dollar", "\\u", "field_", "(_", "\"", "amo", "unt", "\"_", ",_", "\"", "Amo", "unt", "\"_", ")_", "\\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_", "Invoice", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "date", "\"_", ",_", "\"", "account", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inlines_", "=_", "[_", "Invoice", "Charge", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "account", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "account", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dollar", "\\u", "amount_", "=_", "dollar", "\\u", "field_", "(_", "\"", "amo", "unt", "\"_", ",_", "\"", "Amo", "unt", "\"_", ")_", "\\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_", "Invoice", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Invoice", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Invoice", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Invoice", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "accounti", "nv", "oi", "ce", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dollar", "\\u", "amount_", "=_", "right", "\\u", "dollar", "\\u", "field_", "(_", "\"", "amo", "unt", "\"_", ",_", "\"", "Amo", "unt", "\"_", ")_", "\\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_", "Pend", "ing", "Charge", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Charge", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Charge", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Charge", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "[_", "\"", "invoic", "e", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "kind", "\"_", ",_", "\"", "state", "\"_", ",_", "\"", "object", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "core", "Hour", "s", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", ",_", "\"", "slice", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "kind", "\"_", ",_", "\"", "state", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "\"_", ",_", "\"", "core", "Hour", "s", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", ",_", "\"", "slice", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "account", "pend", "ing", "charge", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "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\\uDEDENT\\u\\u\\u_", "dollar", "\\u", "amount_", "=_", "right", "\\u", "dollar", "\\u", "field_", "(_", "\"", "amo", "unt", "\"_", ",_", "\"", "Amo", "unt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pend", "ing", "Charge", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "super_", "(_", "Pend", "ing", "Charge", "Inline_", ",_", "self_", ")_", "._", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "=_", "qs_", "._", "filter_", "(_", "state_", "=_", "\"", "pend", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "qs_", "\\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_", "Payment", "Inline_", "(_", "XO", "ST", "abu", "lar", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Payment", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Payment", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Payment", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "\"", "date", "\"_", ",_", "\"", "dollar", "\\u", "amo", "unt", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suit", "\\u", "classes_", "=_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "account", "payments", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "delete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dollar", "\\u", "amount_", "=_", "right", "\\u", "dollar", "\\u", "field_", "(_", "\"", "amo", "unt", "\"_", ",_", "\"", "Amo", "unt", "\"_", ")_", "\\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_", "Account", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "site", "\"_", ",_", "\"", "balance", "\\u", "due", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inlines_", "=_", "[_", "Invoice", "Inline_", ",_", "Payment", "Inline_", ",_", "Pend", "ing", "Charge", "Inline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "site", "'_", ",_", "'", "dollar", "\\u", "balance", "\\u", "due", "'_", ",_", "'", "dollar", "\\u", "total", "\\u", "invoices", "'_", ",_", "'", "dollar", "\\u", "total", "\\u", "payments", "'_", "]_", ",_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "site", "'_", ",_", "'", "dollar", "\\u", "balance", "\\u", "due", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dollar", "\\u", "total", "\\u", "invoices", "'_", ",_", "'", "dollar", "\\u", "total", "\\u", "payments", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suit", "\\u", "form", "\\u", "tabs_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "genera", "l", "'_", ",_", "'", "Account", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "accounti", "nv", "oi", "ce", "'_", ",_", "'", "Invoice", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "account", "payments", "'_", ",_", "'", "Payment", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "account", "pend", "ing", "charge", "s", "'_", ",_", "'", "Pend", "ing", " ", "Charge", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dollar", "\\u", "balance", "\\u", "due", "_", "=_", "dollar", "\\u", "field_", "(_", "\"", "balance", "\\u", "due", "\"_", ",_", "\"", "Balance", " ", "Du", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dollar", "\\u", "total", "\\u", "invoices", "_", "=_", "dollar", "\\u", "field_", "(_", "\"", "total", "\\u", "invoices", "\"_", ",_", "\"", "Total", " ", "Invoice", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dollar", "\\u", "total", "\\u", "payments", "_", "=_", "dollar", "\\u", "field_", "(_", "\"", "total", "\\u", "payments", "\"_", ",_", "\"", "Total", " ", "Payment", "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_", "class_", "Program", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Program_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "s", "'_", ":_", "Upload", "Text", "area", "Widget_", "(_", "attrs_", "=_", "{_", "'", "rows", "'_", ":_", "20_", ",_", "'", "cols", "'_", ":_", "80_", ",_", "'", "class", "'_", ":_", "\"", "input", "-", "xx", "large", "\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "forms_", "._", "Textarea_", "(_", "attrs_", "=_", "{_", "'", "rows", "'_", ":_", "3_", ",_", "'", "cols", "'_", ":_", "80_", ",_", "'", "class", "'_", ":_", "'", "input", "-", "xx", "large", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "s", "'_", ":_", "forms_", "._", "Textarea_", "(_", "attrs_", "=_", "{_", "'", "rows", "'_", ":_", "20_", ",_", "'", "cols", "'_", ":_", "80_", ",_", "'", "class", "'_", ":_", "'", "input", "-", "xx", "large", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "'_", ":_", "forms_", "._", "Textarea_", "(_", "attrs_", "=_", "{_", "'", "rows", "'_", ":_", "3_", ",_", "'", "cols", "'_", ":_", "80_", ",_", "'", "class", "'_", ":_", "'", "input", "-", "xx", "large", "'_", "}_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Program", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "name", "\"_", ",_", "\"", "status", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "name", "'_", ",_", "\"", "status", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Program", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "name", "'_", ",_", "'", "command", "'_", ",_", "'", "kind", "'_", ",_", "'", "description", "'_", ",_", "'", "output", "'_", ",_", "'", "status", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "content", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "content", "s", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "message", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "message", "s", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "status", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Program", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "suit", "\\u", "form", "\\u", "tabs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "=_", "[_", "(_", "'", "genera", "l", "'_", ",_", "'", "Program", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "s", "'_", ",_", "'", "Program", " ", "Sou", "rce", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "message", "s", "'_", ",_", "'", "Messag", "es", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "getattr_", "(_", "\\u", "thread", "\\u", "locals_", ",_", "\"", "request", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "and_", "request_", "._", "user_", "._", "is", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "._", "append_", "(_", "(_", "'", "admin", "-", "only", "'_", ",_", "'", "Admi", "n", "-", "On", "ly", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tabs_", "\\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_", "Address", "Poo", "l", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Program_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "addresse", "s", "'_", ":_", "Upload", "Text", "area", "Widget_", "(_", "attrs_", "=_", "{_", "'", "rows", "'_", ":_", "20_", ",_", "'", "cols", "'_", ":_", "80_", ",_", "'", "class", "'_", ":_", "\"", "input", "-", "xx", "large", "\"_", "}_", ")_", ",_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Address", "Poo", "l", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "display_", "=_", "(_", "\"", "name", "\"_", ",_", "\"", "cid", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Address", "Poo", "l", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fieldsets_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "{_", "'", "fields", "'_", ":_", "[_", "'", "name", "'_", ",_", "'", "cid", "r", "'_", ",_", "'", "gateway", "\\u", "ip", "'_", ",_", "'", "gateway", "\\u", "mac", "'_", ",_", "'", "addresse", "s", "'_", ",_", "'", "inu", "se", "'_", ",_", "'", "service", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "[_", "'", "suit", "-", "tab", " ", "suit", "-", "tab", "-", "genera", "l", "'_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", "\"", "status", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Address", "Poo", "l", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "suit", "\\u", "form", "\\u", "tabs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tabs_", "=_", "[_", "(_", "'", "genera", "l", "'_", ",_", "'", "Program", " ", "Det", "ail", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "content", "s", "'_", ",_", "'", "Program", " ", "Sou", "rce", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "message", "s", "'_", ",_", "'", "Messag", "es", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "request", "=", "getattr", "(\\u", "thread", "\\u", "locals", ",", " ", "\"", "request", "\",", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "request", " ", "and", " ", "request", ".", "user", ".", "is", "\\u", "admin", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "tabs", ".", "append", "(", " ", "('", "admin", "-", "only", "',", " ", "'", "Admi", "n", "-", "On", "ly", "')", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "tabs_", "\\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, 0, 1, 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, 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, 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 ]
Except block handles 'BaseException'
arachnys/cabot/cabot/cabotapp/models.py
[ { "content": " def unexpired_acknowledgement(self):\n try:\n return self.unexpired_acknowledgements()[0]\n except:\n return None", "metadata": "root.CheckGroupMixin.unexpired_acknowledgement", "header": "['class', 'CheckGroupMixin', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 216 }, { "content": " def last_result(self):\n try:\n return StatusCheckResult.objects.filter(check=self).order_by('-id').defer('raw_data')[0]\n except:\n return None", "metadata": "root.StatusCheck.last_result", "header": "['class', 'StatusCheck', '(', 'PolymorphicModel', ')', ':', '___EOS___']", "index": 494 }, { "content": " def _run(self):\n result = StatusCheckResult(check=self)\n\n failures = []\n graphite_output = parse_metric(self.metric, mins_to_check=self.frequency)\n\n try:\n result.raw_data = json.dumps(graphite_output['raw'])\n except:\n result.raw_data = graphite_output['raw']\n\n if graphite_output[\"error\"]:\n result.succeeded = False\n result.error = graphite_output[\"error\"]\n return result\n\n if graphite_output['num_series_with_data'] > 0:\n result.average_value = graphite_output['average_value']\n for s in graphite_output['series']:\n if not s[\"values\"]:\n continue\n failure_value = None\n if self.check_type == '<':\n if float(s['min']) < float(self.value):\n failure_value = s['min']\n elif self.check_type == '<=':\n if float(s['min']) <= float(self.value):\n failure_value = s['min']\n elif self.check_type == '>':\n if float(s['max']) > float(self.value):\n failure_value = s['max']\n elif self.check_type == '>=':\n if float(s['max']) >= float(self.value):\n failure_value = s['max']\n elif self.check_type == '==':\n if float(self.value) in s['values']:\n failure_value = float(self.value)\n else:\n raise Exception(u'Check type %s not supported' %\n self.check_type)\n\n if not failure_value is None:\n failures.append((s[\"target\"], failure_value))\n\n if len(failures) > self.allowed_num_failures:\n result.succeeded = False\n elif graphite_output['num_series_with_data'] < self.expected_num_hosts:\n result.succeeded = False\n else:\n result.succeeded = True\n\n if not result.succeeded:\n targets = [s[\"target\"] for s in graphite_output[\"series\"]]\n hosts = minimize_targets(targets)\n hosts_by_target = dict(zip(targets, hosts))\n\n result.error = self.format_error_message(\n failures,\n graphite_output['num_series_with_data'],\n hosts_by_target,\n )\n\n return result", "metadata": "root.GraphiteStatusCheck._run", "header": "['class', 'GraphiteStatusCheck', '(', 'StatusCheck', ')', ':', '___EOS___']", "index": 640 }, { "content": " @property\n def took(self):\n \"\"\"\n Time taken by check in ms\n \"\"\"\n try:\n diff = self.time_complete - self.time\n return (diff.microseconds + (diff.seconds + diff.days * 24 * 3600) * 10**6) / 1000\n except:\n return None", "metadata": "root.StatusCheckResult.took", "header": "['class', 'StatusCheckResult', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 845 } ]
[ { "span": "except:", "start_line": 219, "start_column": 8, "end_line": 219, "end_column": 15 }, { "span": "except:", "start_line": 497, "start_column": 8, "end_line": 497, "end_column": 15 }, { "span": "except:", "start_line": 648, "start_column": 8, "end_line": 648, "end_column": 15 }, { "span": "except:", "start_line": 853, "start_column": 8, "end_line": 853, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Check", "Group", "Mixin_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "une", "xp", "ired", "\\u", "acknowledge", "ment_", "(_", "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_", "._", "une", "xp", "ired", "\\u", "acknowledge", "ments_", "(_", ")_", "[_", "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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Status", "Check_", "(_", "Poly", "morphi", "c", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "last", "\\u", "result_", "(_", "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_", "Status", "Check", "Result_", "._", "objects_", "._", "filter_", "(_", "check_", "=_", "self_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "id", "'_", ")_", "._", "defer_", "(_", "'", "raw", "\\u", "data", "'_", ")_", "[_", "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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Graph", "ite", "Status", "Check_", "(_", "Status", "Check_", ")_", ":_", "\\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", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "Status", "Check", "Result_", "(_", "check_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "failures_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graphite", "\\u", "output_", "=_", "parse", "\\u", "metric_", "(_", "self_", "._", "metric_", ",_", "mins", "\\u", "to", "\\u", "check_", "=_", "self_", "._", "frequency_", ")_", "\\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 ", " _", "result_", "._", "raw", "\\u", "data_", "=_", "json_", "._", "dumps_", "(_", "graphite", "\\u", "output_", "[_", "'", "raw", "'_", "]_", ")_", "\\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 ", " _", "result_", "._", "raw", "\\u", "data_", "=_", "graphite", "\\u", "output_", "[_", "'", "raw", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "graphite", "\\u", "output_", "[_", "\"", "error", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "succeeded_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "error_", "=_", "graphite", "\\u", "output_", "[_", "\"", "error", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "graphite", "\\u", "output_", "[_", "'", "num", "\\u", "series", "\\u", "with", "\\u", "data", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "averag", "e\\u", "value_", "=_", "graphite", "\\u", "output_", "[_", "'", "averag", "e\\u", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "graphite", "\\u", "output_", "[_", "'", "series", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "s_", "[_", "\"", "values", "\"_", "]_", ":_", "\\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_", "fail", "ure", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "check", "\\u", "type_", "==_", "'<'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "float_", "(_", "s_", "[_", "'", "min", "'_", "]_", ")_", "<_", "float_", "(_", "self_", "._", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fail", "ure", "\\u", "value_", "=_", "s_", "[_", "'", "min", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "check", "\\u", "type_", "==_", "'<='_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "float_", "(_", "s_", "[_", "'", "min", "'_", "]_", ")_", "<=_", "float_", "(_", "self_", "._", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fail", "ure", "\\u", "value_", "=_", "s_", "[_", "'", "min", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "check", "\\u", "type_", "==_", "'>'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "float_", "(_", "s_", "[_", "'", "max", "'_", "]_", ")_", ">_", "float_", "(_", "self_", "._", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fail", "ure", "\\u", "value_", "=_", "s_", "[_", "'", "max", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "check", "\\u", "type_", "==_", "'>='_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "float_", "(_", "s_", "[_", "'", "max", "'_", "]_", ")_", ">=_", "float_", "(_", "self_", "._", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fail", "ure", "\\u", "value_", "=_", "s_", "[_", "'", "max", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "check", "\\u", "type_", "==_", "'=='_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "float_", "(_", "self_", "._", "value_", ")_", "in_", "s_", "[_", "'", "values", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fail", "ure", "\\u", "value_", "=_", "float_", "(_", "self_", "._", "value_", ")_", "\\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 ", " ", "_", "raise_", "Exception_", "(_", "u", "'", "Check", " ", "type", " ", "%", "s", " ", "not", " ", "support", "ed", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "check", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "fail", "ure", "\\u", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "failures_", "._", "append_", "(_", "(_", "s_", "[_", "\"", "target", "\"_", "]_", ",_", "fail", "ure", "\\u", "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_", "if_", "len_", "(_", "failures_", ")_", ">_", "self_", "._", "allow", "ed", "\\u", "num", "\\u", "failures_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "succeeded_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "graphite", "\\u", "output_", "[_", "'", "num", "\\u", "series", "\\u", "with", "\\u", "data", "'_", "]_", "<_", "self_", "._", "expected", "\\u", "num", "\\u", "hosts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "succeeded_", "=_", "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 ", " _", "result_", "._", "succeeded_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "result_", "._", "succeeded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "targets_", "=_", "[_", "s_", "[_", "\"", "target", "\"_", "]_", "for_", "s_", "in_", "graphite", "\\u", "output_", "[_", "\"", "series", "\"_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hosts_", "=_", "minimize", "\\u", "targets_", "(_", "targets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "s", "\\u", "by", "\\u", "target_", "=_", "dict_", "(_", "zip_", "(_", "targets_", ",_", "hosts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "._", "error_", "=_", "self_", "._", "format\\u", "error", "\\u", "message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "failures_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "graphite", "\\u", "output_", "[_", "'", "num", "\\u", "series", "\\u", "with", "\\u", "data", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host", "s", "\\u", "by", "\\u", "target_", ",_", "\\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_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Status", "Check", "Result_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "too", "k_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Time", " ", "take", "n", " ", "by", " ", "check", " ", "in", " ", "ms", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff_", "=_", "self_", "._", "time", "\\u", "complete_", "-_", "self_", "._", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "diff_", "._", "microseconds_", "+_", "(_", "diff_", "._", "seconds_", "+_", "diff_", "._", "days_", "*_", "24_", "*_", "3600_", ")_", "*_", "10_", "**_", "6_", ")_", "/_", "1000_", "\\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_", "None_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 4, 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, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused import
veeresht/CommPy/commpy/channels.py
[ { "content": "\n# Authors: Veeresh Taranalli <veeresht@gmail.com>\n# License: BSD 3-Clause\n\n\"\"\"\n============================================\nChannel Models (:mod:`commpy.channels`)\n============================================\n\n.. autosummary::\n :toctree: generated/\n\n bec -- Binary Erasure Channel.\n bsc -- Binary Symmetric Channel.\n awgn -- Additive White Gaussian Noise Channel.\n\n\"\"\"\n\nfrom numpy import complex, sum, pi, arange, array, size, shape, real, sqrt\nfrom numpy import matrix, sqrt, sum, zeros, concatenate, sinc\nfrom numpy.random import randn, seed, random\n#from scipy.special import gamma, jn\n#from scipy.signal import hamming, convolve, resample\n#from scipy.fftpack import ifft, fftshift, fftfreq\n#from scipy.interpolate import interp1d\n\n__all__=['bec', 'bsc', 'awgn']\n\n\n\n\n\n\n\n\n\n\n# =============================================================================\n# Incomplete code to implement fading channels\n# =============================================================================\n\n#def doppler_jakes(max_doppler, filter_length):\n\n# fs = 32.0*max_doppler\n# ts = 1/fs\n# m = arange(0, filter_length/2)\n\n # Generate the Jakes Doppler Spectrum impulse response h[m]\n# h_jakes_left = (gamma(3.0/4) *\n# pow((max_doppler/(pi*abs((m-(filter_length/2))*ts))), 0.25) *\n# jn(0.25, 2*pi*max_doppler*abs((m-(filter_length/2))*ts)))\n# h_jakes_center = array([(gamma(3.0/4)/gamma(5.0/4)) * pow(max_doppler, 0.5)])\n# h_jakes = concatenate((h_jakes_left[0:filter_length/2-1],\n# h_jakes_center, h_jakes_left[::-1]))\n# h_jakes = h_jakes*hamming(filter_length)\n# h_jakes = h_jakes/(sum(h_jakes**2)**0.5)\n\n# -----------------------------------------------------------------------------\n# jakes_psd_right = (1/(pi*max_doppler*(1-(freqs/max_doppler)**2)**0.5))**0.5\n# zero_pad = zeros([(fft_size-filter_length)/2, ])\n# jakes_psd = concatenate((zero_pad, jakes_psd_right[::-1],\n# jakes_psd_right, zero_pad))\n #print size(jakes_psd)\n# jakes_impulse = real(fftshift(ifft(jakes_psd, fft_size)))\n# h_jakes = jakes_impulse[(fft_size-filter_length)/2 + 1 : (fft_size-filter_length)/2 + filter_length + 1]\n# h_jakes = h_jakes*hamming(filter_length)\n# h_jakes = h_jakes/(sum(h_jakes**2)**0.5)\n# -----------------------------------------------------------------------------\n# return h_jakes\n\n#def rayleigh_channel(ts_input, max_doppler, block_length, path_gains,\n# path_delays):\n\n# fs_input = 1.0/ts_input\n# fs_channel = 32.0*max_doppler\n# ts_channel = 1.0/fs_channel\n# interp_factor = fs_input/fs_channel\n# channel_length = block_length/interp_factor\n# n1 = -10\n# n2 = 10\n\n# filter_length = 1024\n\n # Generate the Jakes Doppler Spectrum impulse response h[m]\n# h_jakes = doppler_jakes(max_doppler, filter_length)\n\n # Generate the complex Gaussian Random Process\n# g_var = 0.5\n# gain_process = zeros([len(path_gains), block_length], dtype=complex)\n# delay_process = zeros([n2+1-n1, len(path_delays)])\n# for k in xrange(len(path_gains)):\n# g = (g_var**0.5) * (randn(channel_length) + 1j*randn(channel_length))\n# g_filt = convolve(g, h_jakes, mode='same')\n# g_filt_interp = resample(g_filt, block_length)\n# gain_process[k,:] = pow(10, (path_gains[k]/10.0)) * g_filt_interp\n# delay_process[:,k] = sinc((path_delays[k]/ts_input) - arange(n1, n2+1))\n\n #channel_matrix = 0\n# channel_matrix = matrix(delay_process)*matrix(gain_process)\n\n# return channel_matrix, gain_process, h_jakes\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def bec(input_bits, p_e):\n \"\"\"\n Binary Erasure Channel.\n\n Parameters\n ----------\n input_bits : 1D ndarray containing {0, 1}\n Input arrary of bits to the channel.\n\n p_e : float in [0, 1]\n Erasure probability of the channel.\n\n Returns\n -------\n output_bits : 1D ndarray containing {0, 1}\n Output bits from the channel.\n \"\"\"\n output_bits = input_bits.copy()\n output_bits[random(len(output_bits)) <= p_e] = -1\n return output_bits", "metadata": "root.bec", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def bsc(input_bits, p_t):\n \"\"\"\n Binary Symmetric Channel.\n\n Parameters\n ----------\n input_bits : 1D ndarray containing {0, 1}\n Input arrary of bits to the channel.\n\n p_t : float in [0, 1]\n Transition/Error probability of the channel.\n\n Returns\n -------\n output_bits : 1D ndarray containing {0, 1}\n Output bits from the channel.\n \"\"\"\n output_bits = input_bits.copy()\n flip_locs = (random(len(output_bits)) <= p_t)\n output_bits[flip_locs] = 1 ^ output_bits[flip_locs]\n return output_bits", "metadata": "root.bsc", "header": "['module', '___EOS___']", "index": 49 }, { "content": "def awgn(input_signal, snr_dB, rate=1.0):\n \"\"\"\n Addditive White Gaussian Noise (AWGN) Channel.\n\n Parameters\n ----------\n input_signal : 1D ndarray of floats\n Input signal to the channel.\n\n snr_dB : float\n Output SNR required in dB.\n\n rate : float\n Rate of the a FEC code used if any, otherwise 1.\n\n Returns\n -------\n output_signal : 1D ndarray of floats\n Output signal from the channel with the specified SNR.\n \"\"\"\n\n avg_energy = sum(input_signal * input_signal)/len(input_signal)\n snr_linear = 10**(snr_dB/10.0)\n noise_variance = avg_energy/(2*rate*snr_linear)\n\n if input_signal.dtype is complex:\n noise = (sqrt(noise_variance) * randn(len(input_signal))) + (sqrt(noise_variance) * randn(len(input_signal))*1j)\n else:\n noise = sqrt(2*noise_variance) * randn(len(input_signal))\n\n output_signal = input_signal + noise\n\n return output_signal", "metadata": "root.awgn", "header": "['module', '___EOS___']", "index": 71 } ]
[ { "span": "from numpy import complex, sum, pi, arange, array, size, shape, real, sqrt", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 74 }, { "span": "from numpy import matrix, sqrt, sum, zeros, concatenate, sinc", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 61 }, { "span": "from numpy.random import randn, seed, random", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "Ve", "eres", "h", " ", "Tar", "anal", "li", " ", "<", "ve", "eres", "ht", "@", "gma", "il", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "BS", "D", " ", "3", "-", "Clause_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "==============", "==============", "==============", "==", "\\", "10", ";", "Chan", "nel", " ", "Model", "s", " ", "(:", "mod", ":`", "comm", "py", ".", "channel", "s", "`)", "\\", "10", ";", "==============", "==============", "==============", "==", "\\", "10", ";", "\\", "10", ";", "..", " ", "autosu", "mmar", "y", "::", "\\", "10", ";", " ", " ", " ", ":", "toc", "tree", ":", " ", "generat", "ed", "/", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "bec", " ", " ", " ", " ", " ", "--", " ", "Bin", "ary", " ", "Er", "asu", "re", " ", "Chan", "nel", ".", "\\", "10", ";", " ", " ", " ", "bsc", " ", " ", " ", " ", " ", "--", " ", "Bin", "ary", " ", "Symmetr", "ic", " ", "Chan", "nel", ".", "\\", "10", ";", " ", " ", " ", "aw", "gn", " ", " ", " ", " ", "--", " ", "Add", "iti", "ve", " ", "White", " ", "Gaussian", " ", "No", "ise", " ", "Chan", "nel", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "import_", "complex_", ",_", "sum_", ",_", "pi_", ",_", "arange_", ",_", "array_", ",_", "size_", ",_", "shape_", ",_", "real_", ",_", "sqrt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "matrix_", ",_", "sqrt_", ",_", "sum_", ",_", "zeros_", ",_", "concatenate_", ",_", "sinc", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "random_", "import_", "randn_", ",_", "seed_", ",_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "sci", "py", ".", "special", " ", "import", " ", "gamma", ",", " ", "jn", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "sci", "py", ".", "signal", " ", "import", " ", "hamming", ",", " ", "convolve", ",", " ", "resample_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "sci", "py", ".", "fft", "pack", " ", "import", " ", "ifft", ",", " ", "fft", "shift", ",", " ", "fft", "freq_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "sci", "py", ".", "interpolat", "e", " ", "import", " ", "interp1d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "bec", "'_", ",_", "'", "bsc", "'_", ",_", "'", "aw", "gn", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=======", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Incomp", "lete", " ", "code", " ", "to", " ", "implement", " ", "fad", "ing", " ", "channels_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=======", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "dop", "ple", "r", "\\u", "ja", "kes", "(", "max", "\\u", "dop", "ple", "r", ",", " ", "filter", "\\u", "length", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fs", " ", "=", " ", "32.", "0", "*", "max", "\\u", "dop", "ple", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ts", " ", "=", " ", "1", "/", "fs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "m", " ", "=", " ", "aran", "ge", "(", "0", ",", " ", "filter", "\\u", "length", "/", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "the", " ", "Ja", "kes", " ", "Do", "ppl", "er", " ", "Spect", "rum", " ", "impu", "lse", " ", "response", " ", "h", "[", "m", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", "\\u", "ja", "kes", "\\u", "left", " ", "=", " ", "(", "gamma", "(", "3.0", "/", "4", ")", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "pow", "((", "max", "\\u", "dop", "ple", "r", "/(", "pi", "*", "abs", "((", "m", "-(", "filter", "\\u", "length", "/", "2", "))", "*", "ts", ")))", ",", " ", "0.25", ")", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "jn", "(", "0.25", ",", " ", "2", "*", "pi", "*", "max", "\\u", "dop", "ple", "r", "*", "abs", "((", "m", "-(", "filter", "\\u", "length", "/", "2", "))", "*", "ts", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", "\\u", "ja", "kes", "\\u", "center", " ", "=", " ", "array", "([(", "gamma", "(", "3.0", "/", "4", ")/", "gamma", "(", "5.0", "/", "4", "))", " ", "*", " ", "pow", "(", "max", "\\u", "dop", "ple", "r", ",", " ", "0.", "5", ")])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", "\\u", "ja", "kes", " ", "=", " ", "concatenate", "((", "h", "\\u", "ja", "kes", "\\u", "left", "[", "0", ":", "filter", "\\u", "length", "/", "2", "-1", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "h", "\\u", "ja", "kes", "\\u", "center", ",", " ", "h", "\\u", "ja", "kes", "\\u", "left", "[:", ":-", "1", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", "\\u", "ja", "kes", " ", "=", " ", "h", "\\u", "ja", "kes", "*", "hamming", "(", "filter", "\\u", "length", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", "\\u", "ja", "kes", " ", "=", " ", "h", "\\u", "ja", "kes", "/(", "sum", "(", "h", "\\u", "ja", "kes", "**", "2", ")**", "0.", "5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ja", "kes", "\\u", "psd", "\\u", "right", " ", "=", " ", "(", "1", "/(", "pi", "*", "max", "\\u", "dop", "ple", "r", "*(", "1", "-(", "freqs", "/", "max", "\\u", "dop", "ple", "r", ")**", "2", ")**", "0.", "5", "))", "**", "0.5_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "zero", "\\u", "pad", " ", "=", " ", "zero", "s", "([(", "fft", "\\u", "size", "-", "filter", "\\u", "length", ")/", "2", ",", " ", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ja", "kes", "\\u", "psd", " ", "=", " ", "concatenate", "((", "zero", "\\u", "pad", ",", " ", "ja", "kes", "\\u", "psd", "\\u", "right", "[:", ":-", "1", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "ja", "kes", "\\u", "psd", "\\u", "right", ",", " ", "zero", "\\u", "pad", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "size", "(", "ja", "kes", "\\u", "psd", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ja", "kes", "\\u", "impu", "lse", " ", "=", " ", "real", "(", "fft", "shift", "(", "ifft", "(", "ja", "kes", "\\u", "psd", ",", " ", "fft", "\\u", "size", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", "\\u", "ja", "kes", " ", "=", " ", "ja", "kes", "\\u", "impu", "lse", "[(", "fft", "\\u", "size", "-", "filter", "\\u", "length", ")/", "2", " ", "+", " ", "1", " ", ":", " ", "(", "fft", "\\u", "size", "-", "filter", "\\u", "length", ")/", "2", " ", "+", " ", "filter", "\\u", "length", " ", "+", " ", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", "\\u", "ja", "kes", " ", "=", " ", "h", "\\u", "ja", "kes", "*", "hamming", "(", "filter", "\\u", "length", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", "\\u", "ja", "kes", " ", "=", " ", "h", "\\u", "ja", "kes", "/(", "sum", "(", "h", "\\u", "ja", "kes", "**", "2", ")**", "0.", "5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "return", " ", "h", "\\u", "ja", "kes", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "ray", "lei", "gh", "\\u", "channel", "(", "ts", "\\u", "input", ",", " ", "max", "\\u", "dop", "ple", "r", ",", " ", "block", "\\u", "length", ",", " ", "path", "\\u", "gains", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "path", "\\u", "delays", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fs", "\\u", "input", " ", "=", " ", "1.0", "/", "ts", "\\u", "input_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fs", "\\u", "channel", " ", "=", " ", "32.", "0", "*", "max", "\\u", "dop", "ple", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ts", "\\u", "channel", " ", "=", " ", "1.0", "/", "fs", "\\u", "channel_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "interp", "\\u", "factor", " ", "=", " ", "fs", "\\u", "input", "/", "fs", "\\u", "channel_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "channel", "\\u", "length", " ", "=", " ", "block", "\\u", "length", "/", "interp", "\\u", "factor_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "n1", " ", "=", " ", "-1", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "n2", " ", "=", " ", "10_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "filter", "\\u", "length", " ", "=", " ", "1024_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "the", " ", "Ja", "kes", " ", "Do", "ppl", "er", " ", "Spect", "rum", " ", "impu", "lse", " ", "response", " ", "h", "[", "m", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h", "\\u", "ja", "kes", " ", "=", " ", "dop", "ple", "r", "\\u", "ja", "kes", "(", "max", "\\u", "dop", "ple", "r", ",", " ", "filter", "\\u", "length", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "the", " ", "complex", " ", "Gaussian", " ", "Random", " ", "Process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "g", "\\u", "var", " ", "=", " ", "0.5_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "gain", "\\u", "process", " ", "=", " ", "zero", "s", "([", "len", "(", "path", "\\u", "gains", "),", " ", "block", "\\u", "length", "],", " ", "dt", "ype", "=", "complex", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "dela", "y", "\\u", "process", " ", "=", " ", "zero", "s", "([", "n2", "+", "1", "-", "n1", ",", " ", "len", "(", "path", "\\u", "delays", ")])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "k", " ", "in", " ", "xran", "ge", "(", "len", "(", "path", "\\u", "gains", "))", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "g", " ", "=", " ", "(", "g", "\\u", "var", "**", "0.", "5", ")", " ", "*", " ", "(", "rand", "n", "(", "channel", "\\u", "length", ")", " ", "+", " ", "1", "j", "*", "rand", "n", "(", "channel", "\\u", "length", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "g", "\\u", "filt", " ", "=", " ", "convolve", "(", "g", ",", " ", "h", "\\u", "ja", "kes", ",", " ", "mode", "='", "same", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "g", "\\u", "filt", "\\u", "interp", " ", "=", " ", "resample", "(", "g", "\\u", "filt", ",", " ", "block", "\\u", "length", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "gain", "\\u", "process", "[", "k", ",:", "]", " ", "=", " ", "pow", "(", "10", ",", " ", "(", "path", "\\u", "gains", "[", "k", "]/", "10.", "0", "))", " ", "*", " ", "g", "\\u", "filt", "\\u", "interp_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "dela", "y", "\\u", "process", "[:,", "k", "]", " ", "=", " ", "sinc", "((", "path", "\\u", "delays", "[", "k", "]/", "ts", "\\u", "input", ")", " ", "-", " ", "aran", "ge", "(", "n1", ",", " ", "n2", "+", "1", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "channel", "\\u", "matrix", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "channel", "\\u", "matrix", " ", "=", " ", "matrix", "(", "dela", "y", "\\u", "process", ")*", "matrix", "(", "gain", "\\u", "process", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "channel", "\\u", "matrix", ",", " ", "gain", "\\u", "process", ",", " ", "h", "\\u", "ja", "kes", "_", "\\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_", "bec", "_", "(_", "input", "\\u", "bits_", ",_", "p", "\\u", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bin", "ary", " ", "Er", "asu", "re", " ", "Chan", "nel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "input", "\\u", "bits", " ", ":", " ", "1", "D", " ", "ndar", "ray", " ", "contain", "ing", " ", "{", "0", ",", " ", "1", "}", "\\", "10", ";", " ", " ", " ", " ", "Inp", "ut", " ", "arr", "ary", " ", "of", " ", "bits", " ", "to", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "p", "\\u", "e", " ", ":", " ", "float", " ", "in", " ", "[", "0", ",", " ", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "Er", "asu", "re", " ", "probabilit", "y", " ", "of", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "output", "\\u", "bits", " ", ":", " ", "1", "D", " ", "ndar", "ray", " ", "contain", "ing", " ", "{", "0", ",", " ", "1", "}", "\\", "10", ";", " ", " ", " ", " ", "Output", " ", "bits", " ", "from", " ", "the", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "bits_", "=_", "input", "\\u", "bits_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "bits_", "[_", "random_", "(_", "len_", "(_", "output", "\\u", "bits_", ")_", ")_", "<=_", "p", "\\u", "e_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output", "\\u", "bits_", "\\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_", "bsc", "_", "(_", "input", "\\u", "bits_", ",_", "p", "\\u", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Bin", "ary", " ", "Symmetr", "ic", " ", "Chan", "nel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "input", "\\u", "bits", " ", ":", " ", "1", "D", " ", "ndar", "ray", " ", "contain", "ing", " ", "{", "0", ",", " ", "1", "}", "\\", "10", ";", " ", " ", " ", " ", "Inp", "ut", " ", "arr", "ary", " ", "of", " ", "bits", " ", "to", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "p", "\\u", "t", " ", ":", " ", "float", " ", "in", " ", "[", "0", ",", " ", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "Transiti", "on", "/", "Error", " ", "probabilit", "y", " ", "of", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "output", "\\u", "bits", " ", ":", " ", "1", "D", " ", "ndar", "ray", " ", "contain", "ing", " ", "{", "0", ",", " ", "1", "}", "\\", "10", ";", " ", " ", " ", " ", "Output", " ", "bits", " ", "from", " ", "the", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "bits_", "=_", "input", "\\u", "bits_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flip", "\\u", "locs_", "=_", "(_", "random_", "(_", "len_", "(_", "output", "\\u", "bits_", ")_", ")_", "<=_", "p", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "bits_", "[_", "flip", "\\u", "locs_", "]_", "=_", "1_", "^_", "output", "\\u", "bits_", "[_", "flip", "\\u", "locs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output", "\\u", "bits_", "\\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_", "aw", "gn_", "(_", "input", "\\u", "signal_", ",_", "snr", "\\u", "d", "B_", ",_", "rate_", "=_", "1.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", "dit", "ive", " ", "White", " ", "Gaussian", " ", "No", "ise", " ", "(", "AW", "GN", ")", " ", "Chan", "nel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "input", "\\u", "signal", " ", ":", " ", "1", "D", " ", "ndar", "ray", " ", "of", " ", "float", "s", "\\", "10", ";", " ", " ", " ", " ", "Inp", "ut", " ", "signal", " ", "to", " ", "the", " ", "channel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "snr", "\\u", "d", "B", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Output", " ", "SNR", " ", "require", "d", " ", "in", " ", "d", "B", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "rate", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "Rat", "e", " ", "of", " ", "the", " ", "a", " ", "FE", "C", " ", "code", " ", "used", " ", "if", " ", "any", ",", " ", "other", "wis", "e", " ", "1", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "output", "\\u", "signal", " ", ":", " ", "1", "D", " ", "ndar", "ray", " ", "of", " ", "float", "s", "\\", "10", ";", " ", " ", " ", " ", "Output", " ", "signal", " ", "from", " ", "the", " ", "channel", " ", "with", " ", "the", " ", "specified", " ", "SNR", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "avg", "\\u", "energy_", "=_", "sum_", "(_", "input", "\\u", "signal_", "*_", "input", "\\u", "signal_", ")_", "/_", "len_", "(_", "input", "\\u", "signal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snr", "\\u", "linear_", "=_", "10_", "**_", "(_", "snr", "\\u", "d", "B_", "/_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "noise", "\\u", "variance_", "=_", "avg", "\\u", "energy_", "/_", "(_", "2_", "*_", "rate_", "*_", "snr", "\\u", "linear_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "input", "\\u", "signal_", "._", "dtype_", "is_", "complex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "noise_", "=_", "(_", "sqrt_", "(_", "noise", "\\u", "variance_", ")_", "*_", "randn_", "(_", "len_", "(_", "input", "\\u", "signal_", ")_", ")_", ")_", "+_", "(_", "sqrt_", "(_", "noise", "\\u", "variance_", ")_", "*_", "randn_", "(_", "len_", "(_", "input", "\\u", "signal_", ")_", ")_", "*_", "1j_", ")_", "\\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 ", " _", "noise_", "=_", "sqrt_", "(_", "2_", "*_", "noise", "\\u", "variance_", ")_", "*_", "randn_", "(_", "len_", "(_", "input", "\\u", "signal_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "\\u", "signal_", "=_", "input", "\\u", "signal_", "+_", "noise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "output", "\\u", "signal_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2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False\n name = ''\n highway_type = None\n\n for tag in w.tags:\n if tag.k == 'name':\n name = tag.v\n # and tag.v in ['primary', 'secondary', 'tertiary', 'trunk']\n if tag.k == 'highway':\n highway_type = tag.v\n is_highway = True\n #try:\n # if tag.k == 'lanes' and int(tag.v[len(tag.v)-1]) >= 2:\n # is_big = True\n # # #for t in w.tags:\n # # # print \"tag {} {}\".format(t.k, t.v)\n #except:\n # print(\"exception, weird lanes designation {}\".format(tag.v))\n\n # or not is_big\n if not is_highway:\n return\n \n if not highway_type in self.types:\n self.types.append(highway_type)\n\n way_dict = {'visible': w.visible,\n 'deleted': w.deleted,\n 'uid': w.uid,\n 'highway_type': highway_type,\n 'ends_have_same_id': w.ends_have_same_id(),\n 'id': w.id,\n 'tags':[]}\n for tag in w.tags:\n way_dict['tags'].append((tag.k, tag.v))\n\n try:\n wkb = wkbfab.create_linestring(w)\n except:\n # throws on single point ways\n return\n line = wkblib.loads(wkb, hex=True)\n reverse_points = []\n for point in list(line.coords):\n reverse_points.append([point[1],point[0]])\n way_dict['linestring'] = reverse_points\n self.ways.append(way_dict)", "metadata": "root.WayExtracter.way", "header": "['class', 'WayExtracter', '(', 'o', '.', 'SimpleHandler', ')', ':', '___EOS___']", "index": 51 } ]
[ { "span": "is_big ", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 14 }, { "span": "name ", "start_line": 59, "start_column": 12, "end_line": 59, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Way", "Extract", "er_", "(_", "o_", "._", "Simple", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "way_", "(_", "self_", ",_", "w_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "highway", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "big_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "highway", "\\u", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tag_", "in_", "w_", "._", "tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tag_", "._", "k_", "==_", "'", "name", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "tag_", "._", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "and", " ", "tag", ".", "v", " ", "in", " ", "['", "primary", "',", " ", "'", "second", "ary", "',", " ", "'", "ter", "tia", "ry", "',", " ", "'", "trunk", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tag_", "._", "k_", "==_", "'", "highway", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "highway", "\\u", "type_", "=_", "tag_", "._", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "highway", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "if", " ", "tag", ".", "k", " ", "==", " ", "'", "lanes", "'", " ", "and", " ", "int", "(", "tag", ".", "v", "[", "len", "(", "tag", ".", "v", ")-", "1", "])", " ", ">=", " ", "2", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "is", "\\u", "big", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "#", " ", " ", " ", " ", "#", "for", " ", "t", " ", "in", " ", "w", ".", "tags", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "#", " ", " ", " ", " ", "#", " ", " ", "print", " ", "\"", "tag", " ", "{}", " ", "{}", "\".", "format", "(", "t", ".", "k", ",", " ", "t", ".", "v", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "print", "(\"", "exception", ",", " ", "weird", " ", "lanes", " ", "designat", "ion", " ", "{}", "\".", "format", "(", "tag", ".", "v", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "or", " ", "not", " ", "is", "\\u", "big_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "highway", "_", ":_", "\\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_", "if_", "not_", "highway", "\\u", "type_", "in_", "self_", "._", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "types_", "._", "append_", "(_", "highway", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "way", "\\u", "dict_", "=_", "{_", "'", "visi", "ble", "'_", ":_", "w_", "._", "visible_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d", "'_", ":_", "w_", "._", "deleted_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uid", "'_", ":_", "w_", "._", "uid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "highway", "\\u", "type", "'_", ":_", "highway", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ends", "\\u", "have", "\\u", "same", "\\u", "id", "'_", ":_", "w_", "._", "ends", "\\u", "have", "\\u", "same", "\\u", "id_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "w_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tags", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tag_", "in_", "w_", "._", "tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "way", "\\u", "dict_", "[_", "'", "tags", "'_", "]_", "._", "append_", "(_", "(_", "tag_", "._", "k_", ",_", "tag_", "._", "v_", ")_", ")_", "\\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 ", " _", "wk", "b_", "=_", "wk", "bf", "ab_", "._", "create", "\\u", "linest", "ring_", "(_", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "throw", "s", " ", "on", " ", "single", " ", "point", " ", "ways_", "\\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_", "line_", "=_", "wk", "bli", "b_", "._", "loads_", "(_", "wk", "b_", ",_", "hex_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reverse", "\\u", "points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "point_", "in_", "list_", "(_", "line_", "._", "coords_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reverse", "\\u", "points_", "._", "append_", "(_", "[_", "point_", "[_", "1_", "]_", ",_", "point_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "way", "\\u", "dict_", "[_", "'", "linest", "ring", "'_", "]_", "=_", "reverse", "\\u", "points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ways_", "._", "append_", "(_", "way", "\\u", "dict_", ")_", "\\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, 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, 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, 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/3d-cities-template/Workflows/3DCityMaintenance/featureidgenerator.py
[ { "content": " def execute(self, parameters, messages):\n \"\"\"The source code of the tool.\"\"\"\n\n arcpy.env.workspace = parameters[0].value\n schema_version = parameters[1].value\n\n # Number of low IDs per hi ID\n # Higher batch sizes mean less updating of the table, lower batch sizes more\n # efficient ID usage especially when multiple processes access the table.\n hi_batchsize = parameters[2].value\n\n # Name of the table used to maintain hi/lo counter status per feature class. Value depends on schema version.\n generate_ID_table_name = \"GenerateID\"\n seqnameField = \"name\"\n seqcounterField = \"hi\"\n seqintervalField = \"low\"\n if schema_version == \"1.4\" or schema_version == \"1.5\":\n generate_ID_table_name = \"GenerateId\"\n seqnameField = \"SEQNAME\"\n seqcounterField = \"SEQCOUNTER\"\n seqintervalField = \"SEQINTERV\"\n\n # check whether sequences table has already been created and create if not.\n new_table = None\n counter_tbl_list = arcpy.ListTables(generate_ID_table_name)\n if not counter_tbl_list:\n arcpy.AddMessage(\"Creating new \" + generate_ID_table_name +\" table.\")\n new_table = True\n generate_ID_table = arcpy.CreateTable_management(arcpy.env.workspace, generate_ID_table_name)\n if schema_version == \"1.3\":\n arcpy.AddField_management(generate_ID_table, seqnameField, \"TEXT\", None, None, 50, \"Feature Class Name\", \"NON_NULLABLE\", \"REQUIRED\")\n arcpy.AddField_management(generate_ID_table, seqcounterField, \"LONG\", None, None, None, \"Hi counter\", \"NON_NULLABLE\", \"REQUIRED\")\n arcpy.AddField_management(generate_ID_table, seqintervalField, \"LONG\", None, None, None, \"Low counter\", \"NON_NULLABLE\", \"REQUIRED\")\n if schema_version == \"1.4\" or schema_version == \"1.5\": # identical schema to attribute assistant\n arcpy.AddField_management(generate_ID_table, seqnameField, \"TEXT\", None, None, 50, \"Sequence Name\", \"NON_NULLABLE\", \"NON_REQUIRED\")\n arcpy.AddField_management(generate_ID_table, seqcounterField, \"LONG\", None, None, None, \"Sequence Counter\", \"NON_NULLABLE\", \"NON_REQUIRED\")\n arcpy.AddField_management(generate_ID_table, seqintervalField, \"SHORT\", None, None, None, \"Interval Value\", \"NULLABLE\", \"NON_REQUIRED\")\n arcpy.AddField_management(generate_ID_table, \"COMMENTS\", \"TEXT\", None, None, 255, \"Comments\", \"NULLABLE\", \"NON_REQUIRED\")\n else:\n new_table = False\n generate_ID_table = counter_tbl_list[0]\n\n # go through feature classes to create FIDs where needed.\n fc_list = arcpy.ListFeatureClasses()\n for fc in fc_list:\n arcpy.AddMessage(\"Processing \" + fc)\n counter = 0 # counter in this session, range is always 0 ... [interval - 1]\n baseCount = 0 # value\n interval = hi_batchsize # batchsize/interval size\n\n # if we only created the GenerateID table, we know we have to insert the counter.\n if new_table:\n insert_new_counter_cursor = arcpy.da.InsertCursor(generate_ID_table_name, [seqnameField, seqcounterField, seqintervalField])\n insert_new_counter_cursor.insertRow((fc, 0, hi_batchsize))\n del insert_new_counter_cursor\n\n # check if a counter of fc_name exists and retrieve value\n counterParams = None\n escaped_name = arcpy.AddFieldDelimiters(generate_ID_table_name, seqnameField)\n where_clause = escaped_name + \" = \" + \"'\" + fc + \"'\"\n with arcpy.da.SearchCursor(generate_ID_table_name, [seqnameField, seqcounterField, seqintervalField], where_clause) as rows:\n for counterRow in rows:\n counterParams = counterRow\n break\n\n if counterParams != None:\n baseCount = counterParams[1]\n interval = counterParams[2]\n else:\n # create that counter\n insert_new_counter_cursor = arcpy.da.InsertCursor(generate_ID_table_name, [seqnameField, seqcounterField, seqintervalField])\n insert_new_counter_cursor.insertRow((fc, 0, hi_batchsize))\n del insert_new_counter_cursor\n\n with arcpy.da.SearchCursor(generate_ID_table_name, [seqnameField, seqcounterField, seqintervalField]) as rows:\n for row in rows:\n if row[0] == fc:\n baseCount = row[1]\n interval = row[2]\n break\n\n # increment counter to indicate that it is in active usage\n self.incrementCounter(generate_ID_table_name, seqnameField, seqcounterField, fc, baseCount + interval)\n\n # check if feature class already has a FID, add it if not.\n fid_name = fc + \"FID\"\n fields_list = arcpy.ListFields(fc, fid_name)\n if not fields_list:\n arcpy.AddField_management(fc, fid_name, \"TEXT\", None, None, 50, \"Feature ID\", None, None)\n\n # modify FID of object if required\n with arcpy.da.UpdateCursor(fc, [fid_name]) as rows:\n for row in rows:\n if row[0] == None:\n if counter >= interval:\n # get new baseCount from GenerateId\n arcpy.AddMessage(\"Interval exhausted, getting next Interval.\")\n with arcpy.da.SearchCursor(generate_ID_table_name, [seqcounterField], where_clause) as rows:\n for counterRow in rows:\n baseCount = counterRow[0]\n break\n\n # Reset local counter\n counter = 0\n row[0] = fc + \"/\" + str(baseCount + counter)\n counter += 1\n rows.updateRow(row)\n\n # write back the new counter value to the GenerateID table.\n with arcpy.da.UpdateCursor(generate_ID_table_name, [seqnameField, seqcounterField]) as rows:\n for newRow in rows:\n if newRow[0] == fc:\n newRow[1] = baseCount + counter\n rows.updateRow(newRow)\n break\n\n arcpy.AddMessage(\"Completed adding of Feature IDs.\")\n return", "metadata": "root.FeatureIdGenerator.execute", "header": "['class', 'FeatureIdGenerator', '(', 'object', ')', ':', '___EOS___']", "index": 88 } ]
[ { "span": "row[0] == None:", "start_line": 181, "start_column": 23, "end_line": 181, "end_column": 37 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Feature", "Id", "Generator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "parameters_", ",_", "messages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "source", " ", "code", " ", "of", " ", "the", " ", "tool", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "env_", "._", "workspace_", "=_", "parameters_", "[_", "0_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema", "\\u", "version_", "=_", "parameters_", "[_", "1_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Number", " ", "of", " ", "low", " ", "ID", "s", " ", "per", " ", "hi", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Highe", "r", " ", "batch", " ", "size", "s", " ", "mean", " ", "less", " ", "updat", "ing", " ", "of", " ", "the", " ", "table", ",", " ", "lower", " ", "batch", " ", "size", "s", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "efficien", "t", " ", "ID", " ", "usage", " ", "especial", "ly", " ", "whe", "n", " ", "multiple", " ", "process", "es", " ", "access", " ", "the", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "hi", "\\u", "batchsize", "_", "=_", "parameters_", "[_", "2_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Name", " ", "of", " ", "the", " ", "table", " ", "used", " ", "to", " ", "maintain", " ", "hi", "/", "lo", " ", "counter", " ", "status", " ", "per", " ", "feature", " ", "class", ".", " ", "Value", " ", "depend", "s", " ", "on", " ", "schema", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", "=_", "\"", "Generate", "ID", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seqn", "ame", "Field_", "=_", "\"", "name", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq", "counter", "Field_", "=_", "\"", "hi", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq", "interval", "Field_", "=_", "\"", "low", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "schema", "\\u", "version_", "==_", "\"", "1.4", "\"_", "or_", "schema", "\\u", "version_", "==_", "\"", "1.5", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", "=_", "\"", "Generate", "Id", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seqn", "ame", "Field_", "=_", "\"", "SEQ", "NAME", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq", "counter", "Field_", "=_", "\"", "SEQ", "COUNTER", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq", "interval", "Field_", "=_", "\"", "SEQ", "INTER", "V", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "whe", "ther", " ", "sequence", "s", " ", "table", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "created", " ", "and", " ", "create", " ", "if", " ", "not", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "table_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counter", "\\u", "tbl", "\\u", "list_", "=_", "arcpy_", "._", "List", "Tables_", "(_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "counter", "\\u", "tbl", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Creat", "ing", " ", "new", " ", "\"_", "+_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", "+_", "\"", " ", "table", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "table_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generat", "e\\u", "ID", "\\u", "table_", "=_", "arcpy_", "._", "Creat", "e", "Table", "\\u", "management_", "(_", "arcpy_", "._", "env_", "._", "workspace_", ",_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "schema", "\\u", "version_", "==_", "\"", "1.3", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "generat", "e\\u", "ID", "\\u", "table_", ",_", "seqn", "ame", "Field_", ",_", "\"", "TEXT", "\"_", ",_", "None_", ",_", "None_", ",_", "50_", ",_", "\"", "Feature", " ", "Class", " ", "Name", "\"_", ",_", "\"", "NON", "\\u", "NULL", "AB", "LE", "\"_", ",_", "\"", "REQUIRE", "D", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "generat", "e\\u", "ID", "\\u", "table_", ",_", "seq", "counter", "Field_", ",_", "\"", "LONG", "\"_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "\"", "Hi", " ", "counter", "\"_", ",_", "\"", "NON", "\\u", "NULL", "AB", "LE", "\"_", ",_", "\"", "REQUIRE", "D", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "generat", "e\\u", "ID", "\\u", "table_", ",_", "seq", "interval", "Field_", ",_", "\"", "LONG", "\"_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "\"", "Lo", "w", " ", "counter", "\"_", ",_", "\"", "NON", "\\u", "NULL", "AB", "LE", "\"_", ",_", "\"", "REQUIRE", "D", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "schema", "\\u", "version_", "==_", "\"", "1.4", "\"_", "or_", "schema", "\\u", "version_", "==_", "\"", "1.5", "\"_", ":_", "#", " ", "identi", "cal", " ", "schema", " ", "to", " ", "attribute", " ", "assistan", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "generat", "e\\u", "ID", "\\u", "table_", ",_", "seqn", "ame", "Field_", ",_", "\"", "TEXT", "\"_", ",_", "None_", ",_", "None_", ",_", "50_", ",_", "\"", "Sequ", "ence", " ", "Name", "\"_", ",_", "\"", "NON", "\\u", "NULL", "AB", "LE", "\"_", ",_", "\"", "NON", "\\u", "REQUIRE", "D", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "generat", "e\\u", "ID", "\\u", "table_", ",_", "seq", "counter", "Field_", ",_", "\"", "LONG", "\"_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "\"", "Sequ", "ence", " ", "Counter", "\"_", ",_", "\"", "NON", "\\u", "NULL", "AB", "LE", "\"_", ",_", "\"", "NON", "\\u", "REQUIRE", "D", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "generat", "e\\u", "ID", "\\u", "table_", ",_", "seq", "interval", "Field_", ",_", "\"", "SHORT", "\"_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "\"", "Interv", "al", " ", "Value", "\"_", ",_", "\"", "NULL", "AB", "LE", "\"_", ",_", "\"", "NON", "\\u", "REQUIRE", "D", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "generat", "e\\u", "ID", "\\u", "table_", ",_", "\"", "COMMENT", "S", "\"_", ",_", "\"", "TEXT", "\"_", ",_", "None_", ",_", "None_", ",_", "255_", ",_", "\"", "Comme", "nts", "\"_", ",_", "\"", "NULL", "AB", "LE", "\"_", ",_", "\"", "NON", "\\u", "REQUIRE", "D", "\"_", ")_", "\\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 ", " _", "new", "\\u", "table_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generat", "e\\u", "ID", "\\u", "table_", "=_", "counter", "\\u", "tbl", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "go", " ", "through", " ", "feature", " ", "classe", "s", " ", "to", " ", "create", " ", "FID", "s", " ", "where", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fc", "\\u", "list_", "=_", "arcpy_", "._", "List", "Feature", "Classes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fc_", "in_", "fc", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Process", "ing", " ", "\"_", "+_", "fc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counter_", "=_", "0_", "#", " ", "counter", " ", "in", " ", "this", " ", "session", ",", " ", "range", " ", "is", " ", "alw", "ay", "s", " ", "0", " ", "...", " ", "[", "interval", " ", "-", " ", "1", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "Count_", "=_", "0_", "#", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval_", "=_", "hi", "\\u", "batchsize", "_", "#", " ", "batchsize", "/", "interval", " ", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "only", " ", "created", " ", "the", " ", "Generate", "ID", " ", "table", ",", " ", "we", " ", "know", " ", "we", " ", "have", " ", "to", " ", "insert", " ", "the", " ", "counter", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "new", "\\u", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insert", "\\u", "new", "\\u", "counter", "\\u", "cursor_", "=_", "arcpy_", "._", "da_", "._", "Insert", "Cursor_", "(_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ",_", "[_", "seqn", "ame", "Field_", ",_", "seq", "counter", "Field_", ",_", "seq", "interval", "Field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert", "\\u", "new", "\\u", "counter", "\\u", "cursor_", "._", "insert", "Row_", "(_", "(_", "fc_", ",_", "0_", ",_", "hi", "\\u", "batchsize", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "insert", "\\u", "new", "\\u", "counter", "\\u", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "a", " ", "counter", " ", "of", " ", "fc", "\\u", "name", " ", "exist", "s", " ", "and", " ", "retrieve", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "counter", "Params_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "escaped", "\\u", "name_", "=_", "arcpy_", "._", "Add", "Field", "Delimite", "rs_", "(_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ",_", "seqn", "ame", "Field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "where", "\\u", "clause_", "=_", "escaped", "\\u", "name_", "+_", "\"", " ", "=", " ", "\"_", "+_", "\"'\"_", "+_", "fc_", "+_", "\"'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Sear", "ch", "Cursor_", "(_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ",_", "[_", "seqn", "ame", "Field_", ",_", "seq", "counter", "Field_", ",_", "seq", "interval", "Field_", "]_", ",_", "where", "\\u", "clause_", ")_", "as_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "counter", "Row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "counter", "Params_", "=_", "counter", "Row_", "\\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_", "if_", "counter", "Params_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "Count_", "=_", "counter", "Params_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval_", "=_", "counter", "Params_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "tha", "t", " ", "counter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insert", "\\u", "new", "\\u", "counter", "\\u", "cursor_", "=_", "arcpy_", "._", "da_", "._", "Insert", "Cursor_", "(_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ",_", "[_", "seqn", "ame", "Field_", ",_", "seq", "counter", "Field_", ",_", "seq", "interval", "Field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert", "\\u", "new", "\\u", "counter", "\\u", "cursor_", "._", "insert", "Row_", "(_", "(_", "fc_", ",_", "0_", ",_", "hi", "\\u", "batchsize", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "insert", "\\u", "new", "\\u", "counter", "\\u", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Sear", "ch", "Cursor_", "(_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ",_", "[_", "seqn", "ame", "Field_", ",_", "seq", "counter", "Field_", ",_", "seq", "interval", "Field_", "]_", ")_", "as_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "row_", "[_", "0_", "]_", "==_", "fc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "base", "Count_", "=_", "row_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interval_", "=_", "row_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "increment", " ", "counter", " ", "to", " ", "indicat", "e", " ", "tha", "t", " ", "it", " ", "is", " ", "in", " ", "active", " ", "usage_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "increment", "Counter_", "(_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ",_", "seqn", "ame", "Field_", ",_", "seq", "counter", "Field_", ",_", "fc_", ",_", "base", "Count_", "+_", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "feature", " ", "class", " ", "alr", "ead", "y", " ", "has", " ", "a", " ", "FID", ",", " ", "add", " ", "it", " ", "if", " ", "not", "._", "\\u\\u\\uNL\\u\\u\\u_", "fid", "\\u", "name_", "=_", "fc_", "+_", "\"", "FID", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields", "\\u", "list_", "=_", "arcpy_", "._", "List", "Fields_", "(_", "fc_", ",_", "fid", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fields", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "fc_", ",_", "fid", "\\u", "name_", ",_", "\"", "TEXT", "\"_", ",_", "None_", ",_", "None_", ",_", "50_", ",_", "\"", "Feature", " ", "ID", "\"_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modif", "y", " ", "FID", " ", "of", " ", "object", " ", "if", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Update", "Cursor_", "(_", "fc_", ",_", "[_", "fid", "\\u", "name_", "]_", ")_", "as_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "row_", "[_", "0_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "counter_", ">=_", "interval_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "new", " ", "base", "Count", " ", "from", " ", "Generate", "Id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Interv", "al", " ", "exhaust", "ed", ",", " ", "getti", "ng", " ", "next", " ", "Interv", "al", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Sear", "ch", "Cursor_", "(_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ",_", "[_", "seq", "counter", "Field_", "]_", ",_", "where", "\\u", "clause_", ")_", "as_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "counter", "Row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "base", "Count_", "=_", "counter", "Row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reset", " ", "local", " ", "counter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "[_", "0_", "]_", "=_", "fc_", "+_", "\"/\"_", "+_", "str_", "(_", "base", "Count_", "+_", "counter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "update", "Row_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "back", " ", "the", " ", "new", " ", "counter", " ", "value", " ", "to", " ", "the", " ", "Generate", "ID", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "arcpy_", "._", "da_", "._", "Update", "Cursor_", "(_", "generat", "e\\u", "ID", "\\u", "table", "\\u", "name_", ",_", "[_", "seqn", "ame", "Field_", ",_", "seq", "counter", "Field_", "]_", ")_", "as_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "new", "Row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "new", "Row_", "[_", "0_", "]_", "==_", "fc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "new", "Row_", "[_", "1_", "]_", "=_", "base", "Count_", "+_", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "update", "Row_", "(_", "new", "Row_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Complete", "d", " ", "addin", "g", " ", "of", " ", "Feature", " ", "ID", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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,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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 ]
Unused import
hatRiot/clusterd/src/platform/tomcat/auxiliary/list_wars.py
[ { "content": "from src.platform.tomcat.authenticate import checkAuth\nfrom src.platform.tomcat.interfaces import TINTERFACES\nfrom auxiliary import Auxiliary\nfrom log import LOG\nimport utility\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Auxiliary:\n \"\"\" Obtain a list of deployed WARs\n \"\"\"\n\n\n", "metadata": "root.Auxiliary", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def __init__(self):\n self.name = 'List deployed WARs'\n self.versions = ['Any']\n self.flag = 'tc-list'", "metadata": "root.Auxiliary.__init__", "header": "['class', 'Auxiliary', ':', '___EOS___']", "index": 11 }, { "content": " def check(self, fingerprint):\n \"\"\"\n \"\"\"\n \n if fingerprint.title == TINTERFACES.MAN:\n return True\n\n return False", "metadata": "root.Auxiliary.check", "header": "['class', 'Auxiliary', ':', '___EOS___']", "index": 16 }, { "content": " def run(self, fingerengine, fingerprint):\n \"\"\" Obtain a list of deployed WARs on a remote Tomcat instance\n \"\"\"\n\n utility.Msg(\"Obtaining deployed applications...\")\n base = \"http://{0}:{1}\".format(fingerengine.options.ip,\n fingerprint.port)\n relative = '/manager/list'\n \n if fingerprint.version in [\"7.0\", \"8.0\"]:\n relative = '/manager/text/list'\n\n url = base + relative\n\n response = utility.requests_get(url)\n if response.status_code == 401:\n utility.Msg('Host %s:%s requires auth, checking...' %\n (fingerengine.options.ip, fingerprint.port), LOG.DEBUG)\n cookies = checkAuth(fingerengine.options.ip, fingerprint.port,\n fingerprint.title, fingerprint.version)\n\n if cookies:\n response = utility.requests_get(url, cookies=cookies[0], \n auth=cookies[1])\n else:\n utility.Msg(\"Could not get auth for %s:%s\" % \n (fingerengine.options.ip, fingerprint.port), LOG.ERROR)\n return\n \n if response.status_code == 200:\n\n apps = response.content.split('\\n')[1:-1]\n for app in apps:\n utility.Msg(\"App found: %s\" % app.split(':', 1)[0])\n\n else:\n utility.Msg(\"Unable to retrieve %s (HTTP %d)\" % (url, \n response.status_code), LOG.DEBUG)", "metadata": "root.Auxiliary.run", "header": "['class', 'Auxiliary', ':', '___EOS___']", "index": 25 } ]
[ { "span": "from auxiliary import Auxiliary", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "src_", "._", "platform_", "._", "tom", "cat_", "._", "authenticate_", "import_", "check", "Auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "src_", "._", "platform_", "._", "tom", "cat_", "._", "interfaces_", "import_", "TIN", "TER", "FACE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "auxiliary", "_", "import_", "Aux", "iliar", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "log_", "import_", "LOG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "utility_", "\\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_", "Aux", "iliar", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Obtain", " ", "a", " ", "list", " ", "of", " ", "deploye", "d", " ", "WAR", "s", "\\", "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_", "[SEP]_", "class_", "Aux", "iliar", "y_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "'", "List", " ", "deploye", "d", " ", "WAR", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "versions_", "=_", "[_", "'", "Any", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flag_", "=_", "'", "tc", "-", "list", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aux", "iliar", "y_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check_", "(_", "self_", ",_", "fingerprint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fingerprint_", "._", "title_", "==_", "TIN", "TER", "FACE", "S_", "._", "MAN", "_", ":_", "\\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_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aux", "iliar", "y_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "finger", "engine_", ",_", "fingerprint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Obtain", " ", "a", " ", "list", " ", "of", " ", "deploye", "d", " ", "WAR", "s", " ", "on", " ", "a", " ", "remote", " ", "Tom", "cat", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "utility_", "._", "Msg_", "(_", "\"", "Obtain", "ing", " ", "deploye", "d", " ", "applica", "tion", "s", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "=_", "\"", "http", "://", "{", "0", "}:", "{", "1", "}\"_", "._", "format_", "(_", "finger", "engine_", "._", "options_", "._", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fingerprint_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relative_", "=_", "'/", "manage", "r", "/", "list", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fingerprint_", "._", "version_", "in_", "[_", "\"", "7.0", "\"_", ",_", "\"", "8.0", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relative_", "=_", "'/", "manage", "r", "/", "text", "/", "list", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "base_", "+_", "relative_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "utility_", "._", "request", "s", "\\u", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "401_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utility_", "._", "Msg_", "(_", "'", "Host", " ", "%", "s", ":", "%", "s", " ", "require", "s", " ", "auth", ",", " ", "checking", "...'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "finger", "engine_", "._", "options_", "._", "ip_", ",_", "fingerprint_", "._", "port_", ")_", ",_", "LOG_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cookies_", "=_", "check", "Auth_", "(_", "finger", "engine_", "._", "options_", "._", "ip_", ",_", "fingerprint_", "._", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fingerprint_", "._", "title_", ",_", "fingerprint_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cookies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "utility_", "._", "request", "s", "\\u", "get_", "(_", "url_", ",_", "cookies_", "=_", "cookies_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth_", "=_", "cookies_", "[_", "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 ", " _", "utility_", "._", "Msg_", "(_", "\"", "Cou", "ld", " ", "not", " ", "get", " ", "auth", " ", "for", " ", "%", "s", ":", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "finger", "engine_", "._", "options_", "._", "ip_", ",_", "fingerprint_", "._", "port_", ")_", ",_", "LOG_", "._", "ERROR_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps_", "=_", "response_", "._", "content_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "1_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "app_", "in_", "apps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utility_", "._", "Msg_", "(_", "\"", "App", " ", "found", ":", " ", "%", "s", "\"_", "%_", "app_", "._", "split_", "(_", "':'_", ",_", "1_", ")_", "[_", "0_", "]_", ")_", "\\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 ", " _", "utility_", "._", "Msg_", "(_", "\"", "Una", "ble", " ", "to", " ", "retrieve", " ", "%", "s", " ", "(", "HTTP", " ", "%", "d", ")\"_", "%_", "(_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "status", "\\u", "code_", ")_", ",_", "LOG_", "._", "DEBUG_",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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, 2, 2, 2 ]
Unused import
ejeschke/ginga/ginga/mplw/ImageViewMpl.py
[ { "content": "#\n# ImageViewMpl.py -- a backend for Ginga using a Matplotlib figure\n#\n# This is open-source software licensed under a BSD license.\n# Please see the file LICENSE.txt for details.\n\nimport sys, re\nimport numpy\nimport threading\nimport math\nfrom io import BytesIO\n\n# Matplotlib imports\nimport matplotlib\nfrom matplotlib.image import FigureImage\nfrom matplotlib.figure import Figure\nimport matplotlib.lines as lines\n#from matplotlib.path import Path\n\nfrom ginga import ImageView\nfrom ginga import Mixins, Bindings, colors\nfrom . import transform\nfrom ginga.mplw.CanvasRenderMpl import CanvasRenderer\n\n# Override some matplotlib keyboard UI defaults\nrc = matplotlib.rcParams\n# TODO: figure out how to keep from overriding the user's desirable\n# rcParams\nrc.update(matplotlib.rcParamsDefault)\nrc['keymap.fullscreen'] = 'f' # toggling full screen\nrc['keymap.home'] = 'home' # home or reset mnemonic\nrc['keymap.back'] = 'left' # forward / backward keys to enable\nrc['keymap.forward'] = 'right' # left handed quick navigation\nrc['keymap.pan'] = [] # pan mnemonic\nrc['keymap.zoom'] = [] # zoom mnemonic\nrc['keymap.save'] = 'ctrl+s' # saving current figure\n#rc['keymap.quit'] = 'ctrl+w' # close the current figure\nrc['keymap.grid'] = 'ctrl+g' # switching on/off a grid in current axes\nrc['keymap.yscale'] = [] # toggle scaling of y-axes ('log'/'linear')\nrc['keymap.xscale'] = [] # toggle scaling of x-axes ('log'/'linear')\nrc['keymap.all_axes'] = [] # enable all axes\n\n\n\n\n\n\n\n\n\n#END\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ImageViewMplError(ImageView.ImageViewError):\n pass", "metadata": "root.ImageViewMplError", "header": "['module', '___EOS___']", "index": 43 }, { "content": "class ImageViewMpl(ImageView.ImageViewBase):\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.ImageViewMpl", "header": "['module', '___EOS___']", "index": 46 }, { "content": " def __init__(self, logger=None, rgbmap=None, settings=None):\n ImageView.ImageViewBase.__init__(self, logger=logger,\n rgbmap=rgbmap,\n settings=settings)\n # Our Figure\n self.figure = None\n # Our Axes\n self.ax_img = None\n self.ax_util = None\n # Holds the image on ax_img\n self.mpimage = None\n\n # NOTE: matplotlib manages it's Y coordinates by default with\n # the origin at the bottom (see base class)\n self._originUpper = False\n\n self.img_fg = (1.0, 1.0, 1.0)\n self.img_bg = (0.5, 0.5, 0.5)\n\n self.message = None\n\n self.in_axes = False\n # Matplotlib expects RGBA data for color images\n self._rgb_order = 'RGBA'\n\n self.renderer = CanvasRenderer(self)\n\n # cursors\n self.cursor = {}\n\n # For timing events\n self._msg_timer = None\n self._defer_timer = None\n\n self.t_.setDefaults(show_pan_position=False,\n onscreen_ff='Sans Serif')", "metadata": "root.ImageViewMpl.__init__", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def set_figure(self, figure):\n \"\"\"Call this with the matplotlib Figure() object.\"\"\"\n self.figure = figure\n\n ax = self.figure.add_axes((0, 0, 1, 1), frame_on=False)\n #ax = fig.add_subplot(111)\n self.ax_img = ax\n # We don't want the axes cleared every time plot() is called\n ax.hold(False)\n # TODO: is this needed, since frame_on == False?\n ax.get_xaxis().set_visible(False)\n ax.get_yaxis().set_visible(False)\n #ax.patch.set_alpha(0.0)\n ax.patch.set_visible(False)\n #ax.autoscale(enable=True, tight=True)\n ax.autoscale(enable=False)\n\n # Add an overlapped axis for drawing graphics\n newax = self.figure.add_axes(self.ax_img.get_position(),\n sharex=ax, sharey=ax,\n frameon=False)\n newax.hold(True)\n newax.autoscale(enable=False)\n newax.get_xaxis().set_visible(False)\n newax.get_yaxis().set_visible(False)\n self.ax_util = newax\n\n # Create timers\n self._msg_timer = None\n self._defer_timer = None\n\n if hasattr(figure.canvas, 'new_timer'):\n self._msg_timer = figure.canvas.new_timer()\n self._msg_timer.single_shot = True\n self._msg_timer.add_callback(self.onscreen_message_off)\n\n self._defer_timer = figure.canvas.new_timer()\n self._defer_timer.single_shot = True\n self._defer_timer.add_callback(self.delayed_redraw)\n\n # marker drawn at the center of the image for debugging\n self.cross1 = lines.Line2D((0.49, 0.51), (0.50, 0.50),\n transform=newax.transAxes,\n color='red', alpha=1.0)\n self.cross2 = lines.Line2D((0.50, 0.50), (0.49, 0.51),\n transform=newax.transAxes,\n color='red', alpha=1.0)\n\n canvas = figure.canvas\n if hasattr(canvas, 'viewer'):\n canvas.set_viewer(self)\n else:\n canvas.mpl_connect(\"resize_event\", self._resize_cb)\n\n # Because we don't know if resize callback works with all backends\n left, bottom, wd, ht = self.ax_img.bbox.bounds\n self.configure_window(wd, ht)", "metadata": "root.ImageViewMpl.set_figure", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 85 }, { "content": " def get_figure(self):\n return self.figure", "metadata": "root.ImageViewMpl.get_figure", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 143 }, { "content": " def set_widget(self, canvas):\n if hasattr(canvas, 'viewer'):\n canvas.set_viewer(self)", "metadata": "root.ImageViewMpl.set_widget", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 146 }, { "content": " def get_widget(self):\n return self.figure.canvas", "metadata": "root.ImageViewMpl.get_widget", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def get_rgb_order(self):\n return self._rgb_order", "metadata": "root.ImageViewMpl.get_rgb_order", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 153 }, { "content": " def calculate_aspect(self, shape, extent):\n dx = abs(extent[1] - extent[0]) / float(shape[1])\n dy = abs(extent[3] - extent[2]) / float(shape[0])\n return dx / dy", "metadata": "root.ImageViewMpl.calculate_aspect", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 156 }, { "content": " def render_image1(self, rgbobj, dst_x, dst_y):\n \"\"\"Render the image represented by (rgbobj) at dst_x, dst_y\n in the pixel space.\n\n NOTE: this version uses a Figure.FigImage to render the image.\n \"\"\"\n self.logger.debug(\"redraw surface\")\n if self.figure is None:\n return\n ## left, bottom, width, height = self.ax_img.bbox.bounds\n ## self._imgwin_wd, self._imgwin_ht = width, height\n\n # Grab the RGB array for the current image and place it in the\n # matplotlib figure axis\n data = self.getwin_array(order=self._rgb_order)\n\n dst_x = dst_y = 0\n\n # fill background color\n ## rect = self.figure.patch\n ## rect.set_facecolor(self.img_bg)\n\n # attempt 1: using a FigureImage (non-scaled)\n if self.mpimage is None:\n self.mpimage = self.figure.figimage(data, xo=dst_x, yo=dst_y,\n origin='upper')\n\n else:\n # note: this is not a typo--these offsets have a different\n # attribute name than in the constructor ('ox' vs. 'xo')\n self.mpimage.ox = dst_x\n self.mpimage.oy = dst_y\n self.mpimage.set_data(data)", "metadata": "root.ImageViewMpl.render_image1", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 161 }, { "content": " def render_image2(self, rgbobj, dst_x, dst_y):\n \"\"\"Render the image represented by (rgbobj) at dst_x, dst_y\n in the pixel space.\n\n NOTE: this version renders the image in an Axes with imshow().\n \"\"\"\n self.logger.debug(\"redraw surface\")\n if self.figure is None:\n return\n\n ## left, bottom, width, height = self.ax_img.bbox.bounds\n ## self._imgwin_wd, self._imgwin_ht = width, height\n\n # Grab the RGB array for the current image and place it in the\n # matplotlib figure axis\n arr = self.getwin_array(order=self._rgb_order)\n\n # Get the data extents\n x0, y0 = 0, 0\n y1, x1 = arr.shape[:2]\n flipx, flipy, swapxy = self.get_transforms()\n if swapxy:\n x0, x1, y0, y1 = y0, y1, x0, x1\n\n extent = (x0, x1, y1, y0)\n self.logger.debug(\"extent=%s\" % (str(extent)))\n\n # Calculate aspect ratio\n aspect = self.calculate_aspect(arr.shape, extent)\n\n if self.mpimage is None:\n img = self.ax_img.imshow(arr, interpolation='none',\n origin=\"upper\",\n vmin=0, vmax=255,\n extent=extent,\n aspect=aspect)\n self.mpimage = img\n\n else:\n self.mpimage.set_data(arr)\n self.ax_img.set_aspect(aspect)\n self.mpimage.set_extent(extent)\n #self.ax_img.relim()", "metadata": "root.ImageViewMpl.render_image2", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 195 }, { "content": " def render_image(self, rgbobj, dst_x, dst_y):\n\n # Ugly, ugly hack copied from matplotlib.lines to cause line\n # objects to recompute their cached transformed_path\n # Other mpl artists don't seem to have this affliction\n for ax in self.figure.axes:\n if not (ax in (self.ax_img, self.ax_util)):\n if hasattr(ax, \"lines\"):\n for line in ax.lines:\n try:\n line._transformed_path.invalidate()\n except AttributeError:\n pass\n\n # render_image1() currently seems a little faster\n if self.in_axes:\n self.render_image2(rgbobj, dst_x, dst_y)\n else:\n self.render_image1(rgbobj, dst_x, dst_y)\n\n # clear utility axis\n self.ax_util.cla()\n\n # Draw a cross in the center of the window in debug mode\n if self.t_['show_pan_position']:\n self.ax_util.add_line(self.cross1)\n self.ax_util.add_line(self.cross2)\n\n # render message if there is one currently\n if self.message:\n self.draw_message(self.message)\n\n # force an update of the figure\n self.figure.canvas.draw()\n\n # Set the axis limits\n # TODO: should we do this only for those who have autoaxis=True?\n ## wd, ht = self.get_window_size()\n ## x0, y0 = self.get_data_xy(0, 0)\n ## x1, tm = self.get_data_xy(wd-1, 0)\n ## tm, y1 = self.get_data_xy(0, ht-1)\n ## for ax in self.figure.axes:\n ## ax.set_xlim(x0, x1)\n ## ax.set_ylim(y0, y1)", "metadata": "root.ImageViewMpl.render_image", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 239 }, { "content": " def draw_message(self, message):\n # r, g, b = self.img_fg\n self.ax_util.text(0.5, 0.33, message,\n fontsize=24, horizontalalignment='center',\n color='white',\n verticalalignment='center',\n transform=self.ax_util.transAxes)", "metadata": "root.ImageViewMpl.draw_message", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 284 }, { "content": " def configure_window(self, width, height):\n self.configure(width, height)", "metadata": "root.ImageViewMpl.configure_window", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 292 }, { "content": " def _resize_cb(self, event):\n wd, ht = event.width, event.height\n self.logger.debug(\"canvas resized %dx%d\" % (wd, ht))\n self.configure_window(wd, ht)", "metadata": "root.ImageViewMpl._resize_cb", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 295 }, { "content": " def add_axes(self):\n ax = self.figure.add_axes(self.ax_img.get_position(),\n #sharex=self.ax_img, sharey=self.ax_img,\n frameon=False,\n viewer=self,\n projection='ginga')\n ax.get_xaxis().set_visible(False)\n ax.get_yaxis().set_visible(False)\n return ax", "metadata": "root.ImageViewMpl.add_axes", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 300 }, { "content": " def get_png_image_as_buffer(self, output=None):\n ibuf = output\n if ibuf is None:\n ibuf = BytesIO()\n qimg = self.figure.write_to_png(ibuf)\n return ibuf", "metadata": "root.ImageViewMpl.get_png_image_as_buffer", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 310 }, { "content": " def update_image(self):\n pass", "metadata": "root.ImageViewMpl.update_image", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 317 }, { "content": " def set_cursor(self, cursor):\n pass", "metadata": "root.ImageViewMpl.set_cursor", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 320 }, { "content": " def define_cursor(self, ctype, cursor):\n self.cursor[ctype] = cursor", "metadata": "root.ImageViewMpl.define_cursor", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 323 }, { "content": " def get_cursor(self, ctype):\n return self.cursor[ctype]", "metadata": "root.ImageViewMpl.get_cursor", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 326 }, { "content": " def switch_cursor(self, ctype):\n self.set_cursor(self.cursor[ctype])", "metadata": "root.ImageViewMpl.switch_cursor", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 329 }, { "content": " def set_fg(self, r, g, b):\n self.img_fg = (r, g, b)\n self.redraw(whence=3)", "metadata": "root.ImageViewMpl.set_fg", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 332 }, { "content": " def onscreen_message(self, text, delay=None):\n try:\n self._msg_timer.stop()\n except:\n pass\n\n self.message = text\n self.redraw(whence=3)\n\n if delay:\n time_ms = int(delay * 1000.0)\n self._msg_timer.interval = time_ms\n self._msg_timer.start()", "metadata": "root.ImageViewMpl.onscreen_message", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 336 }, { "content": " def onscreen_message_off(self):\n return self.onscreen_message(None)", "metadata": "root.ImageViewMpl.onscreen_message_off", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 350 }, { "content": " def reschedule_redraw(self, time_sec):\n\n if self._defer_timer is None:\n self.delayed_redraw()\n return\n\n try:\n self._defer_timer.stop()\n except:\n pass\n\n time_ms = int(time_sec * 1000)\n try:\n self._defer_timer.interval = time_ms\n self._defer_timer.start()\n\n except Exception as e:\n self.logger.warning(\"Exception starting timer: %s; \"\n \"using unoptomized redraw\" % (str(e)))\n self.delayed_redraw()", "metadata": "root.ImageViewMpl.reschedule_redraw", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 353 }, { "content": " def show_pan_mark(self, tf):\n self.t_.set(show_pan_position=tf)\n self.redraw(whence=3)", "metadata": "root.ImageViewMpl.show_pan_mark", "header": "['class', 'ImageViewMpl', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 374 }, { "content": "class ImageViewEvent(ImageViewMpl):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ImageViewEvent", "header": "['module', '___EOS___']", "index": 378 }, { "content": " def __init__(self, logger=None, rgbmap=None, settings=None):\n ImageViewMpl.__init__(self, logger=logger, rgbmap=rgbmap,\n settings=settings)\n\n # last known window mouse position\n self.last_win_x = 0\n self.last_win_y = 0\n # last known data mouse position\n self.last_data_x = 0\n self.last_data_y = 0\n # Does widget accept focus when mouse enters window\n self.enter_focus = self.t_.get('enter_focus', True)\n\n # @$%&^(_)*&^ gnome!!\n self._keytbl = {\n 'shift': 'shift_l',\n 'control': 'control_l',\n 'alt': 'alt_l',\n 'win': 'super_l',\n '`': 'backquote',\n '\"': 'doublequote',\n \"'\": 'singlequote',\n '\\\\': 'backslash',\n ' ': 'space',\n # NOTE: not working\n 'escape': 'escape',\n 'enter': 'return',\n # NOTE: not working\n 'tab': 'tab',\n # NOTE: all Fn keys not working\n 'f1': 'f1',\n 'f2': 'f2',\n 'f3': 'f3',\n 'f4': 'f4',\n 'f5': 'f5',\n 'f6': 'f6',\n 'f7': 'f7',\n 'f8': 'f8',\n 'f9': 'f9',\n 'f10': 'f10',\n 'f11': 'f11',\n 'f12': 'f12',\n }\n\n # Define cursors for pick and pan\n #hand = openHandCursor()\n hand = 0\n self.define_cursor('pan', hand)\n #cross = thinCrossCursor('aquamarine')\n cross = 1\n self.define_cursor('pick', cross)\n\n for name in ('motion', 'button-press', 'button-release',\n 'key-press', 'key-release', 'drag-drop',\n 'scroll', 'map', 'focus', 'enter', 'leave',\n ):\n self.enable_callback(name)", "metadata": "root.ImageViewEvent.__init__", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 380 }, { "content": " def set_figure(self, figure):\n super(ImageViewEvent, self).set_figure(figure)\n\n connect = figure.canvas.mpl_connect\n #connect(\"map_event\", self.map_event)\n #connect(\"focus_in_event\", self.focus_event, True)\n #connect(\"focus_out_event\", self.focus_event, False)\n connect(\"figure_enter_event\", self.enter_notify_event)\n connect(\"figure_leave_event\", self.leave_notify_event)\n #connect(\"axes_enter_event\", self.enter_notify_event)\n #connect(\"axes_leave_event\", self.leave_notify_event)\n connect(\"motion_notify_event\", self.motion_notify_event)\n connect(\"button_press_event\", self.button_press_event)\n connect(\"button_release_event\", self.button_release_event)\n connect(\"key_press_event\", self.key_press_event)\n connect(\"key_release_event\", self.key_release_event)\n connect(\"scroll_event\", self.scroll_event)\n\n # TODO: drag-drop event", "metadata": "root.ImageViewEvent.set_figure", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 438 }, { "content": " def transkey(self, keyname):\n self.logger.debug(\"matplotlib keyname='%s'\" % (keyname))\n if keyname is None:\n return keyname\n try:\n return self._keytbl[keyname.lower()]\n\n except KeyError:\n return keyname", "metadata": "root.ImageViewEvent.transkey", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 458 }, { "content": " def get_keyTable(self):\n return self._keytbl", "metadata": "root.ImageViewEvent.get_keyTable", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 468 }, { "content": " def set_enter_focus(self, tf):\n self.enter_focus = tf", "metadata": "root.ImageViewEvent.set_enter_focus", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 471 }, { "content": " def focus_event(self, event, hasFocus):\n return self.make_callback('focus', hasFocus)", "metadata": "root.ImageViewEvent.focus_event", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 474 }, { "content": " def enter_notify_event(self, event):\n if self.enter_focus:\n self.focus_event(event, True)\n return self.make_callback('enter')", "metadata": "root.ImageViewEvent.enter_notify_event", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 477 }, { "content": " def leave_notify_event(self, event):\n self.logger.debug(\"leaving widget...\")\n if self.enter_focus:\n self.focus_event(event, False)\n return self.make_callback('leave')", "metadata": "root.ImageViewEvent.leave_notify_event", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 482 }, { "content": " def key_press_event(self, event):\n keyname = event.key\n keyname = self.transkey(keyname)\n if keyname is not None:\n self.logger.debug(\"key press event, key=%s\" % (keyname))\n return self.make_ui_callback('key-press', keyname)", "metadata": "root.ImageViewEvent.key_press_event", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 488 }, { "content": " def key_release_event(self, event):\n keyname = event.key\n keyname = self.transkey(keyname)\n if keyname is not None:\n self.logger.debug(\"key release event, key=%s\" % (keyname))\n return self.make_ui_callback('key-release', keyname)", "metadata": "root.ImageViewEvent.key_release_event", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 495 }, { "content": " def button_press_event(self, event):\n x, y = event.x, event.y\n button = 0\n if event.button in (1, 2, 3):\n button |= 0x1 << (event.button - 1)\n self.logger.debug(\"button event at %dx%d, button=%x\" % (x, y, button))\n\n data_x, data_y = self.get_data_xy(x, y)\n return self.make_ui_callback('button-press', button, data_x, data_y)", "metadata": "root.ImageViewEvent.button_press_event", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 502 }, { "content": " def button_release_event(self, event):\n x, y = event.x, event.y\n button = 0\n if event.button in (1, 2, 3):\n button |= 0x1 << (event.button - 1)\n self.logger.debug(\"button release at %dx%d button=%x\" % (x, y, button))\n\n data_x, data_y = self.get_data_xy(x, y)\n return self.make_ui_callback('button-release', button, data_x, data_y)", "metadata": "root.ImageViewEvent.button_release_event", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 512 }, { "content": " def get_last_win_xy(self):\n return (self.last_win_x, self.last_win_y)", "metadata": "root.ImageViewEvent.get_last_win_xy", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 522 }, { "content": " def get_last_data_xy(self):\n return (self.last_data_x, self.last_data_y)", "metadata": "root.ImageViewEvent.get_last_data_xy", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 525 }, { "content": " def motion_notify_event(self, event):\n button = 0\n x, y = event.x, event.y\n self.last_win_x, self.last_win_y = x, y\n\n if event.button in (1, 2, 3):\n button |= 0x1 << (event.button - 1)\n self.logger.debug(\"motion event at %dx%d, button=%x\" % (x, y, button))\n\n data_x, data_y = self.get_data_xy(x, y)\n self.last_data_x, self.last_data_y = data_x, data_y\n self.logger.debug(\"motion event at DATA %dx%d\" % (data_x, data_y))\n\n return self.make_ui_callback('motion', button, data_x, data_y)", "metadata": "root.ImageViewEvent.motion_notify_event", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 528 }, { "content": " def scroll_event(self, event):\n x, y = event.x, event.y\n\n # Matplotlib only gives us the number of steps of the scroll,\n # positive for up and negative for down. No horizontal scrolling.\n direction = None\n if event.step > 0:\n direction = 0.0\n elif event.step < 0:\n direction = 180.0\n\n amount = abs(event.step) * 15.0\n\n self.logger.debug(\"scroll deg=%f direction=%f\" % (\n amount, direction))\n\n data_x, data_y = self.get_data_xy(x, y)\n self.last_data_x, self.last_data_y = data_x, data_y\n\n return self.make_ui_callback('scroll', direction, amount,\n data_x, data_y)", "metadata": "root.ImageViewEvent.scroll_event", "header": "['class', 'ImageViewEvent', '(', 'ImageViewMpl', ')', ':', '___EOS___']", "index": 543 }, { "content": "class ImageViewZoom(Mixins.UIMixin, ImageViewEvent):\n\n # class variables for binding map and bindings can be set\n bindmapClass = Bindings.BindingMapper\n bindingsClass = Bindings.ImageViewBindings\n\n\n\n\n\n", "metadata": "root.ImageViewZoom", "header": "['module', '___EOS___']", "index": 565 }, { "content": " @classmethod\n def set_bindingsClass(cls, klass):\n cls.bindingsClass = klass", "metadata": "root.ImageViewZoom.set_bindingsClass", "header": "['class', 'ImageViewZoom', '(', 'Mixins', '.', 'UIMixin', ',', 'ImageViewEvent', ')', ':', '___NEWLINE___', '___NL___', '# class variables for binding map and bindings can be set', '___NL___', '___EOS___']", "index": 571 }, { "content": " @classmethod\n def set_bindmapClass(cls, klass):\n cls.bindmapClass = klass", "metadata": "root.ImageViewZoom.set_bindmapClass", "header": "['class', 'ImageViewZoom', '(', 'Mixins', '.', 'UIMixin', ',', 'ImageViewEvent', ')', ':', '___NEWLINE___', '___NL___', '# class variables for binding map and bindings can be set', '___NL___', '___EOS___']", "index": 575 }, { "content": " def __init__(self, logger=None, rgbmap=None, settings=None,\n bindmap=None, bindings=None):\n ImageViewEvent.__init__(self, logger=logger, rgbmap=rgbmap,\n settings=settings)\n Mixins.UIMixin.__init__(self)\n\n self.ui_setActive(True)\n\n if bindmap is None:\n bindmap = ImageViewZoom.bindmapClass(self.logger)\n self.bindmap = bindmap\n bindmap.register_for_events(self)\n\n if bindings is None:\n bindings = ImageViewZoom.bindingsClass(self.logger)\n self.set_bindings(bindings)", "metadata": "root.ImageViewZoom.__init__", "header": "['class', 'ImageViewZoom', '(', 'Mixins', '.', 'UIMixin', ',', 'ImageViewEvent', ')', ':', '___NEWLINE___', '___NL___', '# class variables for binding map and bindings can be set', '___NL___', '___EOS___']", "index": 579 }, { "content": " def get_bindmap(self):\n return self.bindmap", "metadata": "root.ImageViewZoom.get_bindmap", "header": "['class', 'ImageViewZoom', '(', 'Mixins', '.', 'UIMixin', ',', 'ImageViewEvent', ')', ':', '___NEWLINE___', '___NL___', '# class variables for binding map and bindings can be set', '___NL___', '___EOS___']", "index": 596 }, { "content": " def get_bindings(self):\n return self.bindings", "metadata": "root.ImageViewZoom.get_bindings", "header": "['class', 'ImageViewZoom', '(', 'Mixins', '.', 'UIMixin', ',', 'ImageViewEvent', ')', ':', '___NEWLINE___', '___NL___', '# class variables for binding map and bindings can be set', '___NL___', '___EOS___']", "index": 599 }, { "content": " def set_bindings(self, bindings):\n self.bindings = bindings\n bindings.set_bindings(self)", "metadata": "root.ImageViewZoom.set_bindings", "header": "['class', 'ImageViewZoom', '(', 'Mixins', '.', 'UIMixin', ',', 'ImageViewEvent', ')', ':', '___NEWLINE___', '___NL___', '# class variables for binding map and bindings can be set', '___NL___', '___EOS___']", "index": 602 }, { "content": "class CanvasView(ImageViewZoom):\n\n", "metadata": "root.CanvasView", "header": "['module', '___EOS___']", "index": 607 }, { "content": " def __init__(self, logger=None, settings=None, rgbmap=None,\n bindmap=None, bindings=None):\n ImageViewZoom.__init__(self, logger=logger, settings=settings,\n rgbmap=rgbmap,\n bindmap=bindmap, bindings=bindings)\n\n # Needed for UIMixin to propagate events correctly\n self.objects = [self.private_canvas]", "metadata": "root.CanvasView.__init__", "header": "['class', 'CanvasView', '(', 'ImageViewZoom', ')', ':', '___EOS___']", "index": 609 }, { "content": " def set_canvas(self, canvas, private_canvas=None):\n super(CanvasView, self).set_canvas(canvas,\n private_canvas=private_canvas)\n\n self.objects[0] = self.private_canvas", "metadata": "root.CanvasView.set_canvas", "header": "['class', 'CanvasView', '(', 'ImageViewZoom', ')', ':', '___EOS___']", "index": 618 } ]
[ { "span": "import sys, re", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 14 }, { "span": "import numpy", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 12 }, { "span": "import threading", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 16 }, { "span": "import math", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 11 }, { "span": "from matplotlib.image import FigureImage", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 40 }, { "span": "from matplotlib.figure import Figure", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 36 }, { "span": "from ginga import Mixins, Bindings, colors", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 42 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Image", "View", "Mp", "l", ".", "py", " ", "--", " ", "a", " ", "back", "end", " ", "for", " ", "Gi", "nga", " ", "usi", "ng", " ", "a", " ", "Mat", "plotlib", " ", "figure_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "open", "-", "source", " ", "software", " ", "license", "d", " ", "under", " ", "a", " ", "BS", "D", " ", "license", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ple", "ase", " ", "see", " ", "the", " ", "file", " ", "LICENSE", ".", "txt", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mat", "plotlib", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "._", "image_", "import_", "Fig", "ure", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "._", "figure_", "import_", "Figure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "lines_", "as_", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "mat", "plotlib", ".", "path", " ", "import", " ", "Path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ging", "a_", "import_", "Image", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ging", "a_", "import_", "Mix", "ins_", ",_", "Bindings", "_", ",_", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ging", "a_", "._", "mpl", "w_", "._", "Can", "vas", "Render", "Mp", "l_", "import_", "Can", "vas", "Renderer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "some", " ", "mat", "plotlib", " ", "keyb", "oard", " ", "UI", " ", "defaults_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "=_", "matplotlib_", "._", "rc", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "figure", " ", "out", " ", "how", " ", "to", " ", "keep", " ", "from", " ", "overrid", "ing", " ", "the", " ", "user", "'", "s", " ", "desi", "rab", "le_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rc", "Params_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "._", "update_", "(_", "matplotlib_", "._", "rc", "Param", "s", "Default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "fullscreen", "'_", "]_", "=_", "'", "f", "'_", "#", " ", "tog", "glin", "g", " ", "full", " ", "screen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "home", "'_", "]_", "=_", "'", "home", "'_", "#", " ", "home", " ", "or", " ", "reset", " ", "mnemonic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "back", "'_", "]_", "=_", "'", "left", "'_", "#", " ", "forward", " ", "/", " ", "back", "ward", " ", "keys", " ", "to", " ", "enable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "forward", "'_", "]_", "=_", "'", "right", "'_", "#", " ", " ", " ", "left", " ", "hande", "d", " ", "quick", " ", "navigation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "pan", "'_", "]_", "=_", "[_", "]_", "#", " ", "pan", " ", "mnemonic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "zoom", "'_", "]_", "=_", "[_", "]_", "#", " ", "zoom", " ", "mnemonic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "save", "'_", "]_", "=_", "'", "ctrl", "+", "s", "'_", "#", " ", "saving", " ", "current", " ", "figure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "rc", "['", "keymap", ".", "quit", "']", " ", "=", " ", "'", "ctrl", "+", "w", "'", " ", "#", " ", "close", " ", "the", " ", "current", " ", "figure_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "grid", "'_", "]_", "=_", "'", "ctrl", "+", "g", "'_", "#", " ", "switching", " ", "on", "/", "off", " ", "a", " ", "grid", " ", "in", " ", "current", " ", "axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "ysc", "ale", "'_", "]_", "=_", "[_", "]_", "#", " ", "toggle", " ", "scal", "ing", " ", "of", " ", "y", "-", "axes", " ", "('", "log", "'/'", "linear", "')", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "xs", "cale", "'_", "]_", "=_", "[_", "]_", "#", " ", "toggle", " ", "scal", "ing", " ", "of", " ", "x", "-", "axes", " ", "('", "log", "'/'", "linear", "')", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "[_", "'", "keymap", ".", "all", "\\u", "axes", "'_", "]_", "=_", "[_", "]_", "#", " ", "enable", " ", "all", " ", "axes_", "\\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\\uNL\\u\\u\\u_", "#", "END_", "\\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_", "Image", "View", "Mp", "l", "Error_", "(_", "Image", "View_", "._", "Image", "View", "Error_", ")_", ":_", "\\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_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\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_", ",_", "logger_", "=_", "None_", ",_", "rgb", "map_", "=_", "None_", ",_", "settings_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "View_", "._", "Image", "View", "Base_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rgb", "map_", "=_", "rgb", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "=_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ou", "r", " ", "Figure_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "figure_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ou", "r", " ", "Axes_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ax", "\\u", "img_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ax", "\\u", "util_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hold", "s", " ", "the", " ", "image", " ", "on", " ", "ax", "\\u", "img_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mpi", "mage_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "mat", "plotlib", " ", "manage", "s", " ", "it", "'", "s", " ", "Y", " ", "coordinate", "s", " ", "by", " ", "default", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "orig", "in", " ", "at", " ", "the", " ", "bottom", " ", "(", "see", " ", "base", " ", "class", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "orig", "in", "Upp", "er_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "img", "\\u", "fg_", "=_", "(_", "1.0_", ",_", "1.0_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "img", "\\u", "bg_", "=_", "(_", "0.5_", ",_", "0.5_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "in", "\\u", "axes_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Mat", "plotlib", " ", "expect", "s", " ", "RGB", "A", " ", "data", " ", "for", " ", "color", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "rgb", "\\u", "order_", "=_", "'", "RGB", "A", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "renderer_", "=_", "Can", "vas", "Renderer_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cursors", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cursor_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "tim", "ing", " ", "events_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "msg", "\\u", "timer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "defer", "\\u", "timer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "t", "\\u_", "._", "set", "Defaults_", "(_", "show", "\\u", "pan", "\\u", "position_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ons", "creen", "\\u", "ff_", "=_", "'", "San", "s", " ", "Ser", "if", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "figure_", "(_", "self_", ",_", "figure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", " ", "this", " ", "with", " ", "the", " ", "mat", "plotlib", " ", "Fig", "ure", "()", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "figure_", "=_", "figure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "self_", "._", "figure_", "._", "add", "\\u", "axes_", "(_", "(_", "0_", ",_", "0_", ",_", "1_", ",_", "1_", ")_", ",_", "frame", "\\u", "on_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ax", " ", "=", " ", "fig", ".", "add", "\\u", "subplot", "(", "111", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ax", "\\u", "img_", "=_", "ax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "want", " ", "the", " ", "axes", " ", "clear", "ed", " ", "every", " ", "time", " ", "plot", "()", " ", "is", " ", "called_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "hold_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "is", " ", "this", " ", "need", "ed", ",", " ", "sinc", "e", " ", "frame", "\\u", "on", " ", "==", " ", "Fal", "se", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "get", "\\u", "xaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "get", "\\u", "yaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ax", ".", "patch", ".", "set\\u", "alpha", "(", "0.", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "patch_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ax", ".", "autoscale", "(", "enable", "=", "Tru", "e", ",", " ", "tig", "ht", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "autoscale", "_", "(_", "enable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "overl", "appe", "d", " ", "axis", " ", "for", " ", "drawing", " ", "graphics_", "\\u\\u\\uNL\\u\\u\\u_", "newa", "x_", "=_", "self_", "._", "figure_", "._", "add", "\\u", "axes_", "(_", "self_", "._", "ax", "\\u", "img_", "._", "get", "\\u", "position_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sharex", "_", "=_", "ax_", ",_", "share", "y_", "=_", "ax_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "on_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newa", "x_", "._", "hold_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newa", "x_", "._", "autoscale", "_", "(_", "enable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newa", "x_", "._", "get", "\\u", "xaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newa", "x_", "._", "get", "\\u", "yaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ax", "\\u", "util_", "=_", "newa", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "timers_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "msg", "\\u", "timer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "defer", "\\u", "timer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "figure_", "._", "canvas_", ",_", "'", "new", "\\u", "timer", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "msg", "\\u", "timer_", "=_", "figure_", "._", "canvas_", "._", "new", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "msg", "\\u", "timer_", "._", "single", "\\u", "shot_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "msg", "\\u", "timer_", "._", "add", "\\u", "callback_", "(_", "self_", "._", "ons", "creen", "\\u", "message", "\\u", "off_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "defer", "\\u", "timer_", "=_", "figure_", "._", "canvas_", "._", "new", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "defer", "\\u", "timer_", "._", "single", "\\u", "shot_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "defer", "\\u", "timer_", "._", "add", "\\u", "callback_", "(_", "self_", "._", "delayed", "\\u", "redraw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "marker", " ", "draw", "n", " ", "at", " ", "the", " ", "center", " ", "of", " ", "the", " ", "image", " ", "for", " ", "debugg", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cross", "1_", "=_", "lines_", "._", "Line", "2", "D_", "(_", "(_", "0.49", "_", ",_", "0.51", "_", ")_", ",_", "(_", "0.50", "_", ",_", "0.50", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform_", "=_", "newa", "x_", "._", "trans", "Axes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "'", "red", "'_", ",_", "alpha_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cross", "2_", "=_", "lines_", "._", "Line", "2", "D_", "(_", "(_", "0.50", "_", ",_", "0.50", "_", ")_", ",_", "(_", "0.49", "_", ",_", "0.51", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform_", "=_", "newa", "x_", "._", "trans", "Axes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "'", "red", "'_", ",_", "alpha_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "canvas_", "=_", "figure_", "._", "canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "canvas_", ",_", "'", "viewer", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "canvas_", "._", "set\\u", "viewer_", "(_", "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 ", " _", "canvas_", "._", "mpl", "\\u", "connect_", "(_", "\"", "resiz", "e\\u", "event", "\"_", ",_", "self_", "._", "\\u", "resiz", "e\\u", "cb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Be", "caus", "e", " ", "we", " ", "don", "'", "t", " ", "know", " ", "if", " ", "resiz", "e", " ", "callback", " ", "works", " ", "with", " ", "all", " ", "backends_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "left_", ",_", "bottom_", ",_", "wd_", ",_", "ht_", "=_", "self_", "._", "ax", "\\u", "img_", "._", "bbox_", "._", "bounds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "configur", "e\\u", "window_", "(_", "wd_", ",_", "ht_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "figure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "figure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "widget_", "(_", "self_", ",_", "canvas_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "canvas_", ",_", "'", "viewer", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "canvas_", "._", "set\\u", "viewer_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "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", "\\u", "widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "figure_", "._", "canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "rgb", "\\u", "order_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "rgb", "\\u", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calcul", "ate", "\\u", "aspect_", "(_", "self_", ",_", "shape_", ",_", "extent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx_", "=_", "abs_", "(_", "extent_", "[_", "1_", "]_", "-_", "extent_", "[_", "0_", "]_", ")_", "/_", "float_", "(_", "shape_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dy_", "=_", "abs_", "(_", "extent_", "[_", "3_", "]_", "-_", "extent_", "[_", "2_", "]_", ")_", "/_", "float_", "(_", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dx_", "/_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "image1", "_", "(_", "self_", ",_", "rgb", "obj_", ",_", "dst", "\\u", "x_", ",_", "dst", "\\u", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "the", " ", "image", " ", "represent", "ed", " ", "by", " ", "(", "rgb", "obj", ")", " ", "at", " ", "dst", "\\u", "x", ",", " ", "dst", "\\u", "y", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "pixel", " ", "space", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "NOTE", ":", " ", "this", " ", "version", " ", "use", "s", " ", "a", " ", "Fig", "ure", ".", "Fig", "Image", " ", "to", " ", "render", " ", "the", " ", "image", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "redraw", " ", "surf", "ace", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "figure_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "left", ",", " ", "bottom", ",", " ", "widt", "h", ",", " ", "height", " ", "=", " ", "self", ".", "ax", "\\u", "img", ".", "bbox", ".", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "self", ".\\u", "img", "win", "\\u", "wd", ",", " ", "self", ".\\u", "img", "win", "\\u", "ht", " ", "=", " ", "widt", "h", ",", " ", "height_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "RGB", " ", "array", " ", "for", " ", "the", " ", "current", " ", "image", " ", "and", " ", "place", " ", "it", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mat", "plotlib", " ", "figure", " ", "axis_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "getw", "in", "\\u", "array_", "(_", "order_", "=_", "self_", "._", "\\u", "rgb", "\\u", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dst", "\\u", "x_", "=_", "dst", "\\u", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fill", " ", "background", " ", "color_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "rect", " ", "=", " ", "self", ".", "figure", ".", "patch_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "rect", ".", "set\\u", "face", "color", "(", "self", ".", "img", "\\u", "bg", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "1", ":", " ", "usi", "ng", " ", "a", " ", "Fig", "ure", "Image", " ", "(", "non", "-", "scale", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "mpi", "mage_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mpi", "mage_", "=_", "self_", "._", "figure_", "._", "fig", "image_", "(_", "data_", ",_", "xo", "_", "=_", "dst", "\\u", "x_", ",_", "yo_", "=_", "dst", "\\u", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "'", "upper", "'_", ")_", "\\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_", "#", " ", "note", ":", " ", "this", " ", "is", " ", "not", " ", "a", " ", "typo", "--", "these", " ", "offset", "s", " ", "have", " ", "a", " ", "different", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "attribute", " ", "name", " ", "than", " ", "in", " ", "the", " ", "construct", "or", " ", "('", "ox", "'", " ", "vs", ".", " ", "'", "xo", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mpi", "mage_", "._", "ox_", "=_", "dst", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mpi", "mage_", "._", "oy", "_", "=_", "dst", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mpi", "mage_", "._", "set\\u", "data_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "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_", "render", "\\u", "image2", "_", "(_", "self_", ",_", "rgb", "obj_", ",_", "dst", "\\u", "x_", ",_", "dst", "\\u", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "the", " ", "image", " ", "represent", "ed", " ", "by", " ", "(", "rgb", "obj", ")", " ", "at", " ", "dst", "\\u", "x", ",", " ", "dst", "\\u", "y", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "pixel", " ", "space", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "NOTE", ":", " ", "this", " ", "version", " ", "render", "s", " ", "the", " ", "image", " ", "in", " ", "an", " ", "Axe", "s", " ", "with", " ", "ims", "how", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "redraw", " ", "surf", "ace", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "figure_", "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_", "##", " ", "left", ",", " ", "bottom", ",", " ", "widt", "h", ",", " ", "height", " ", "=", " ", "self", ".", "ax", "\\u", "img", ".", "bbox", ".", "bounds_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "self", ".\\u", "img", "win", "\\u", "wd", ",", " ", "self", ".\\u", "img", "win", "\\u", "ht", " ", "=", " ", "widt", "h", ",", " ", "height_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "RGB", " ", "array", " ", "for", " ", "the", " ", "current", " ", "image", " ", "and", " ", "place", " ", "it", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mat", "plotlib", " ", "figure", " ", "axis_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arr_", "=_", "self_", "._", "getw", "in", "\\u", "array_", "(_", "order_", "=_", "self_", "._", "\\u", "rgb", "\\u", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "data", " ", "extents_", "\\u\\u\\uNL\\u\\u\\u_", "x0_", ",_", "y0_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y1_", ",_", "x1_", "=_", "arr_", "._", "shape_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flip", "x_", ",_", "flip", "y_", ",_", "swap", "xy_", "=_", "self_", "._", "get", "\\u", "transforms_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "swap", "xy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x0_", ",_", "x1_", ",_", "y0_", ",_", "y1_", "=_", "y0_", ",_", "y1_", ",_", "x0_", ",_", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extent_", "=_", "(_", "x0_", ",_", "x1_", ",_", "y1_", ",_", "y0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "extent", "=", "%", "s", "\"_", "%_", "(_", "str_", "(_", "extent_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "aspect", " ", "ratio_", "\\u\\u\\uNL\\u\\u\\u_", "aspect_", "=_", "self_", "._", "calcul", "ate", "\\u", "aspect_", "(_", "arr_", "._", "shape_", ",_", "extent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "mpi", "mage_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "=_", "self_", "._", "ax", "\\u", "img_", "._", "imshow_", "(_", "arr_", ",_", "interpolation_", "=_", "'", "none", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "\"", "upper", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vmin_", "=_", "0_", ",_", "vmax_", "=_", "255_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extent_", "=_", "extent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect_", "=_", "aspect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mpi", "mage_", "=_", "img_", "\\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 ", " _", "self_", "._", "mpi", "mage_", "._", "set\\u", "data_", "(_", "arr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ax", "\\u", "img_", "._", "set\\u", "aspect_", "(_", "aspect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mpi", "mage_", "._", "set\\u", "extent_", "(_", "extent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "ax", "\\u", "img", ".", "reli", "m", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "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_", "render", "\\u", "image_", "(_", "self_", ",_", "rgb", "obj_", ",_", "dst", "\\u", "x_", ",_", "dst", "\\u", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ug", "ly", ",", " ", "ug", "ly", " ", "hack", " ", "copie", "d", " ", "from", " ", "mat", "plotlib", ".", "lines", " ", "to", " ", "caus", "e", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "object", "s", " ", "to", " ", "recompute", " ", "thei", "r", " ", "cache", "d", " ", "transforme", "d\\u", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", " ", "mpl", " ", "artist", "s", " ", "don", "'", "t", " ", "see", "m", " ", "to", " ", "have", " ", "this", " ", "aff", "lic", "tion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ax_", "in_", "self_", "._", "figure_", "._", "axes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "ax_", "in_", "(_", "self_", "._", "ax", "\\u", "img_", ",_", "self_", "._", "ax", "\\u", "util_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "ax_", ",_", "\"", "lines", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "line_", "in_", "ax_", "._", "lines_", ":_", "\\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 ", " ", " _", "line_", "._", "\\u", "transforme", "d\\u", "path_", "._", "invalidate", "_", "(_", ")_", "\\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 ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "render", "\\u", "image1", "()", " ", "currentl", "y", " ", "see", "ms", " ", "a", " ", "litt", "le", " ", "faste", "r_", "\\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_", "self_", "._", "in", "\\u", "axes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "render", "\\u", "image2", "_", "(_", "rgb", "obj_", ",_", "dst", "\\u", "x_", ",_", "dst", "\\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 ", " _", "self_", "._", "render", "\\u", "image1", "_", "(_", "rgb", "obj_", ",_", "dst", "\\u", "x_", ",_", "dst", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clear", " ", "utility", " ", "axis_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ax", "\\u", "util_", "._", "cla", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Draw", " ", "a", " ", "cross", " ", "in", " ", "the", " ", "center", " ", "of", " ", "the", " ", "window", " ", "in", " ", "debug", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "t", "\\u_", "[_", "'", "show", "\\u", "pan", "\\u", "position", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ax", "\\u", "util_", "._", "add", "\\u", "line_", "(_", "self_", "._", "cross", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ax", "\\u", "util_", "._", "add", "\\u", "line_", "(_", "self_", "._", "cross", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "render", " ", "message", " ", "if", " ", "there", " ", "is", " ", "one", " ", "currentl", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "draw", "\\u", "message_", "(_", "self_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "force", " ", "an", " ", "update", " ", "of", " ", "the", " ", "figure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "figure_", "._", "canvas_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "axis", " ", "limits_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "shou", "ld", " ", "we", " ", "do", " ", "this", " ", "only", " ", "for", " ", "tho", "se", " ", "who", " ", "have", " ", "auto", "axis", "=", "Tru", "e", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "wd", ",", " ", "ht", " ", "=", " ", "self", ".", "get", "\\u", "window", "\\u", "size", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "x0", ",", " ", "y", "0", " ", "=", " ", "self", ".", "get", "\\u", "data\\u", "xy", "(", "0", ",", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "x1", ",", " ", "tm", " ", "=", " ", "self", ".", "get", "\\u", "data\\u", "xy", "(", "wd", "-1", ",", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "tm", ",", " ", "y1", " ", "=", " ", "self", ".", "get", "\\u", "data\\u", "xy", "(", "0", ",", " ", "ht", "-1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "for", " ", "ax", " ", "in", " ", "self", ".", "figure", ".", "axes", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "ax", ".", "set\\u", "xlim", "(", "x0", ",", " ", "x1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "ax", ".", "set\\u", "ylim", "(", "y", "0", ",", " ", "y1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "\\u", "message_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "r", ",", " ", "g", ",", " ", "b", " ", "=", " ", "self", ".", "img", "\\u", "fg_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ax", "\\u", "util_", "._", "text_", "(_", "0.5_", ",_", "0.33", "_", ",_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fontsize_", "=_", "24_", ",_", "horizon", "tal", "alignment_", "=_", "'", "center", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "'", "white", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vertical", "alignment_", "=_", "'", "center", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform_", "=_", "self_", "._", "ax", "\\u", "util_", "._", "trans", "Axes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configur", "e\\u", "window_", "(_", "self_", ",_", "width_", ",_", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "configure_", "(_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "resiz", "e\\u", "cb_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wd_", ",_", "ht_", "=_", "event_", "._", "width_", ",_", "event_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "canv", "as", " ", "resized", " ", "%", "dx", "%", "d", "\"_", "%_", "(_", "wd_", ",_", "ht_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "configur", "e\\u", "window_", "(_", "wd_", ",_", "ht_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "axes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax_", "=_", "self_", "._", "figure_", "._", "add", "\\u", "axes_", "(_", "self_", "._", "ax", "\\u", "img_", "._", "get", "\\u", "position_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sharex", "=", "self", ".", "ax", "\\u", "img", ",", " ", "share", "y", "=", "self", ".", "ax", "\\u", "img", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "on_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "viewer_", "=_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "projection_", "=_", "'", "ging", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "get", "\\u", "xaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "get", "\\u", "yaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "png", "\\u", "image", "\\u", "as", "\\u", "buffer_", "(_", "self_", ",_", "output_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ibu", "f_", "=_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ibu", "f_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ibu", "f_", "=_", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qi", "mg_", "=_", "self_", "._", "figure_", "._", "write", "\\u", "to", "\\u", "png_", "(_", "ibu", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ibu", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "image_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "cursor_", "(_", "self_", ",_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "defin", "e\\u", "cursor_", "(_", "self_", ",_", "ctype_", ",_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cursor_", "[_", "ctype_", "]_", "=_", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cursor_", "(_", "self_", ",_", "ctype_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "cursor_", "[_", "ctype_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "switch", "\\u", "cursor_", "(_", "self_", ",_", "ctype_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "cursor_", "(_", "self_", "._", "cursor_", "[_", "ctype_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "fg_", "(_", "self_", ",_", "r_", ",_", "g_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "img", "\\u", "fg_", "=_", "(_", "r_", ",_", "g_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redraw_", "(_", "whe", "nce_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ons", "creen", "\\u", "message_", "(_", "self_", ",_", "text_", ",_", "delay_", "=_", "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 ", " _", "self_", "._", "\\u", "msg", "\\u", "timer_", "._", "stop_", "(_", ")_", "\\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_", "self_", "._", "message_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redraw_", "(_", "whe", "nce_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "delay_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "ms_", "=_", "int_", "(_", "delay_", "*_", "1000.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "msg", "\\u", "timer_", "._", "interval_", "=_", "time", "\\u", "ms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "msg", "\\u", "timer_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "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_", "ons", "creen", "\\u", "message", "\\u", "off_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "ons", "creen", "\\u", "message_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resc", "hedule", "\\u", "redraw_", "(_", "self_", ",_", "time", "\\u", "sec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "defer", "\\u", "timer_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "delayed", "\\u", "redraw_", "(_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "defer", "\\u", "timer_", "._", "stop_", "(_", ")_", "\\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_", "time", "\\u", "ms_", "=_", "int_", "(_", "time", "\\u", "sec_", "*_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "defer", "\\u", "timer_", "._", "interval_", "=_", "time", "\\u", "ms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "defer", "\\u", "timer_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "._", "warning_", "(_", "\"", "Except", "ion", " ", "startin", "g", " ", "timer", ":", " ", "%", "s", ";", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "usi", "ng", " ", "uno", "pto", "mi", "zed", " ", "redraw", "\"_", "%_", "(_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delayed", "\\u", "redraw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Mp", "l_", "(_", "Image", "View_", "._", "Image", "View", "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_", "show", "\\u", "pan", "\\u", "mark_", "(_", "self_", ",_", "tf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "t", "\\u_", "._", "set_", "(_", "show", "\\u", "pan", "\\u", "position_", "=_", "tf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redraw_", "(_", "whe", "nce_", "=_", "3_", ")_", "\\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_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\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_", ",_", "logger_", "=_", "None_", ",_", "rgb", "map_", "=_", "None_", ",_", "settings_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "View", "Mp", "l_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "logger_", "=_", "logger_", ",_", "rgb", "map_", "=_", "rgb", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "=_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "last", " ", "know", "n", " ", "window", " ", "mouse", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "last", "\\u", "win", "\\u", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "win", "\\u", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "last", " ", "know", "n", " ", "data", " ", "mouse", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "last", "\\u", "data\\u", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "data\\u", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", "es", " ", "widget", " ", "accept", " ", "foc", "us", " ", "whe", "n", " ", "mouse", " ", "enter", "s", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "enter", "\\u", "focus_", "=_", "self_", "._", "t", "\\u_", "._", "get_", "(_", "'", "enter", "\\u", "foc", "us", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@$", "%&", "^", "(\\u", ")*", "&", "^", " ", "gno", "me", "!!", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "keyt", "bl_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shift", "'_", ":_", "'", "shift", "\\u", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "control", "'_", ":_", "'", "control", "\\u", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alt", "'_", ":_", "'", "alt", "\\u", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "win", "'_", ":_", "'", "super", "\\u", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'`", "'_", ":_", "'", "back", "quote", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\"'_", ":_", "'", "double", "quote", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"'\"_", ":_", "'", "single", "quote", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\\\\'_", ":_", "'", "backslash", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "'_", ":_", "'", "space", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "not", " ", "working", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "escape", "'_", ":_", "'", "escape", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enter", "'_", ":_", "'", "return", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "not", " ", "working", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tab", "'_", ":_", "'", "tab", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "all", " ", "Fn", " ", "keys", " ", "not", " ", "working", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f1", "'_", ":_", "'", "f1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f2", "'_", ":_", "'", "f2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f3", "'_", ":_", "'", "f3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f4", "'_", ":_", "'", "f4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f5", "'_", ":_", "'", "f5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f6", "'_", ":_", "'", "f6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f7", "'_", ":_", "'", "f7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f8", "'_", ":_", "'", "f8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f9", "'_", ":_", "'", "f9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f1", "0", "'_", ":_", "'", "f1", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f1", "1", "'_", ":_", "'", "f1", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f1", "2", "'_", ":_", "'", "f1", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "cursors", " ", "for", " ", "pick", " ", "and", " ", "pan_", "\\u\\u\\uNL\\u\\u\\u_", "#", "hand", " ", "=", " ", "open", "Hand", "Curs", "or", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "hand_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "defin", "e\\u", "cursor_", "(_", "'", "pan", "'_", ",_", "hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cross", " ", "=", " ", "thin", "Cross", "Curs", "or", "('", "aqu", "amar", "ine", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "cross_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "defin", "e\\u", "cursor_", "(_", "'", "pick", "'_", ",_", "cross_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "(_", "'", "moti", "on", "'_", ",_", "'", "button", "-", "press", "'_", ",_", "'", "button", "-", "release", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "-", "press", "'_", ",_", "'", "key", "-", "release", "'_", ",_", "'", "drag", "-", "drop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "scroll", "'_", ",_", "'", "map", "'_", ",_", "'", "foc", "us", "'_", ",_", "'", "enter", "'_", ",_", "'", "lea", "ve", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "enable", "\\u", "callback_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\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_", "set\\u", "figure_", "(_", "self_", ",_", "figure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Image", "View", "Event_", ",_", "self_", ")_", "._", "set\\u", "figure_", "(_", "figure_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "connect_", "=_", "figure_", "._", "canvas_", "._", "mpl", "\\u", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "connect", "(\"", "map", "\\u", "event", "\",", " ", "self", ".", "map", "\\u", "event", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "connect", "(\"", "foc", "us", "\\u", "in", "\\u", "event", "\",", " ", "self", ".", "foc", "us", "\\u", "event", ",", " ", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "connect", "(\"", "foc", "us", "\\u", "out", "\\u", "event", "\",", " ", "self", ".", "foc", "us", "\\u", "event", ",", " ", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "connect_", "(_", "\"", "figure", "\\u", "enter", "\\u", "event", "\"_", ",_", "self_", "._", "enter", "\\u", "notif", "y", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect_", "(_", "\"", "figure", "\\u", "lea", "ve", "\\u", "event", "\"_", ",_", "self_", "._", "lea", "ve", "\\u", "notif", "y", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "connect", "(\"", "axes", "\\u", "enter", "\\u", "event", "\",", " ", "self", ".", "enter", "\\u", "notif", "y", "\\u", "event", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "connect", "(\"", "axes", "\\u", "lea", "ve", "\\u", "event", "\",", " ", "self", ".", "lea", "ve", "\\u", "notif", "y", "\\u", "event", ")_", "\\u\\u\\uNL\\u\\u\\u_", "connect_", "(_", "\"", "moti", "on", "\\u", "notif", "y", "\\u", "event", "\"_", ",_", "self_", "._", "moti", "on", "\\u", "notif", "y", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect_", "(_", "\"", "button", "\\u", "press", "\\u", "event", "\"_", ",_", "self_", "._", "button", "\\u", "press", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect_", "(_", "\"", "button", "\\u", "release", "\\u", "event", "\"_", ",_", "self_", "._", "button", "\\u", "release", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect_", "(_", "\"", "key", "\\u", "press", "\\u", "event", "\"_", ",_", "self_", "._", "key", "\\u", "press", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect_", "(_", "\"", "key", "\\u", "release", "\\u", "event", "\"_", ",_", "self_", "._", "key", "\\u", "release", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect_", "(_", "\"", "scroll", "\\u", "event", "\"_", ",_", "self_", "._", "scroll", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "drag", "-", "drop", " ", "event_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "trans", "key_", "(_", "self_", ",_", "keyname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "mat", "plotlib", " ", "keyn", "ame", "='", "%", "s", "'\"_", "%_", "(_", "keyname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "keyname_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "keyname_", "\\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_", "self_", "._", "\\u", "keyt", "bl_", "[_", "keyname_", "._", "lower_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "keyname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\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", "key", "Table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "keyt", "bl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "enter", "\\u", "focus_", "(_", "self_", ",_", "tf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "enter", "\\u", "focus_", "=_", "tf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "foc", "us", "\\u", "event_", "(_", "self_", ",_", "event_", ",_", "has", "Focus_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "make", "\\u", "callback_", "(_", "'", "foc", "us", "'_", ",_", "has", "Focus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "enter", "\\u", "notif", "y", "\\u", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "enter", "\\u", "focus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "foc", "us", "\\u", "event_", "(_", "event_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "make", "\\u", "callback_", "(_", "'", "enter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lea", "ve", "\\u", "notif", "y", "\\u", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "leaving", " ", "widget", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "enter", "\\u", "focus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "foc", "us", "\\u", "event_", "(_", "event_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "make", "\\u", "callback_", "(_", "'", "lea", "ve", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "key", "\\u", "press", "\\u", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyname_", "=_", "event_", "._", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyname_", "=_", "self_", "._", "trans", "key_", "(_", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "keyname_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "key", " ", "press", " ", "event", ",", " ", "key", "=", "%", "s", "\"_", "%_", "(_", "keyname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "make", "\\u", "ui", "\\u", "callback_", "(_", "'", "key", "-", "press", "'_", ",_", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\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_", "key", "\\u", "release", "\\u", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyname_", "=_", "event_", "._", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyname_", "=_", "self_", "._", "trans", "key_", "(_", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "keyname_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "key", " ", "release", " ", "event", ",", " ", "key", "=", "%", "s", "\"_", "%_", "(_", "keyname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "make", "\\u", "ui", "\\u", "callback_", "(_", "'", "key", "-", "release", "'_", ",_", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\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_", "button", "\\u", "press", "\\u", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", "=_", "event_", "._", "x_", ",_", "event_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "._", "button_", "in_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "button_", "|=_", "0x1_", "<<_", "(_", "event_", "._", "button_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "button", " ", "event", " ", "at", " ", "%", "dx", "%", "d", ",", " ", "button", "=", "%", "x", "\"_", "%_", "(_", "x_", ",_", "y_", ",_", "button_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "x_", ",_", "data\\u", "y_", "=_", "self_", "._", "get", "\\u", "data\\u", "xy_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "make", "\\u", "ui", "\\u", "callback_", "(_", "'", "button", "-", "press", "'_", ",_", "button_", ",_", "data\\u", "x_", ",_", "data\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "button", "\\u", "release", "\\u", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", "=_", "event_", "._", "x_", ",_", "event_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "._", "button_", "in_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "button_", "|=_", "0x1_", "<<_", "(_", "event_", "._", "button_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "button", " ", "release", " ", "at", " ", "%", "dx", "%", "d", " ", "button", "=", "%", "x", "\"_", "%_", "(_", "x_", ",_", "y_", ",_", "button_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "x_", ",_", "data\\u", "y_", "=_", "self_", "._", "get", "\\u", "data\\u", "xy_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "make", "\\u", "ui", "\\u", "callback_", "(_", "'", "button", "-", "release", "'_", ",_", "button_", ",_", "data\\u", "x_", ",_", "data\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "last", "\\u", "win", "\\u", "xy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "last", "\\u", "win", "\\u", "x_", ",_", "self_", "._", "last", "\\u", "win", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "last", "\\u", "data\\u", "xy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "last", "\\u", "data\\u", "x_", ",_", "self_", "._", "last", "\\u", "data\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "moti", "on", "\\u", "notif", "y", "\\u", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "button_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "event_", "._", "x_", ",_", "event_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "win", "\\u", "x_", ",_", "self_", "._", "last", "\\u", "win", "\\u", "y_", "=_", "x_", ",_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "event_", "._", "button_", "in_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "button_", "|=_", "0x1_", "<<_", "(_", "event_", "._", "button_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "moti", "on", " ", "event", " ", "at", " ", "%", "dx", "%", "d", ",", " ", "button", "=", "%", "x", "\"_", "%_", "(_", "x_", ",_", "y_", ",_", "button_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "x_", ",_", "data\\u", "y_", "=_", "self_", "._", "get", "\\u", "data\\u", "xy_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "data\\u", "x_", ",_", "self_", "._", "last", "\\u", "data\\u", "y_", "=_", "data\\u", "x_", ",_", "data\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "moti", "on", " ", "event", " ", "at", " ", "DATA", " ", "%", "dx", "%", "d", "\"_", "%_", "(_", "data\\u", "x_", ",_", "data\\u", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "make", "\\u", "ui", "\\u", "callback_", "(_", "'", "moti", "on", "'_", ",_", "button_", ",_", "data\\u", "x_", ",_", "data\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Event_", "(_", "Image", "View", "Mp", "l_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "scroll", "\\u", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", "=_", "event_", "._", "x_", ",_", "event_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mat", "plotlib", " ", "only", " ", "give", "s", " ", "us", " ", "the", " ", "number", " ", "of", " ", "step", "s", " ", "of", " ", "the", " ", "scroll", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "posit", "ive", " ", "for", " ", "up", " ", "and", " ", "negati", "ve", " ", "for", " ", "down", ".", " ", " ", "No", " ", "horizon", "tal", " ", "scrolling", "._", "\\u\\u\\uNL\\u\\u\\u_", "direction_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "._", "step_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "direction_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "._", "step_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "direction_", "=_", "180.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "amount_", "=_", "abs_", "(_", "event_", "._", "step_", ")_", "*_", "15.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "scroll", " ", "deg", "=", "%", "f", " ", "direction", "=", "%", "f", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "amount_", ",_", "direction_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "x_", ",_", "data\\u", "y_", "=_", "self_", "._", "get", "\\u", "data\\u", "xy_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "data\\u", "x_", ",_", "self_", "._", "last", "\\u", "data\\u", "y_", "=_", "data\\u", "x_", ",_", "data\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "make", "\\u", "ui", "\\u", "callback_", "(_", "'", "scroll", "'_", ",_", "direction_", ",_", "amount_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "x_", ",_", "data\\u", "y_", ")_", "\\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_", "Image", "View", "Zoom", "_", "(_", "Mix", "ins_", "._", "UI", "Mixin_", ",_", "Image", "View", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "variab", "les", " ", "for", " ", "bindi", "ng", " ", "map", " ", "and", " ", "bindi", "ngs", " ", "can", " ", "be", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bind", "map", "Class_", "=_", "Bindings", "_", "._", "Bind", "ing", "Mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bindi", "ngs", "Class_", "=_", "Bindings", "_", "._", "Image", "View", "Bindings", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Image", "View", "Zoom", "_", "(_", "Mix", "ins_", "._", "UI", "Mixin_", ",_", "Image", "View", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "variab", "les", " ", "for", " ", "bindi", "ng", " ", "map", " ", "and", " ", "bindi", "ngs", " ", "can", " ", "be", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set\\u", "bindi", "ngs", "Class_", "(_", "cls_", ",_", "klass_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "bindi", "ngs", "Class_", "=_", "klass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Zoom", "_", "(_", "Mix", "ins_", "._", "UI", "Mixin_", ",_", "Image", "View", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "variab", "les", " ", "for", " ", "bindi", "ng", " ", "map", " ", "and", " ", "bindi", "ngs", " ", "can", " ", "be", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\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\\u", "bind", "map", "Class_", "(_", "cls_", ",_", "klass_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "bind", "map", "Class_", "=_", "klass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Zoom", "_", "(_", "Mix", "ins_", "._", "UI", "Mixin_", ",_", "Image", "View", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "variab", "les", " ", "for", " ", "bindi", "ng", " ", "map", " ", "and", " ", "bindi", "ngs", " ", "can", " ", "be", " ", "set_", "\\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_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "logger_", "=_", "None_", ",_", "rgb", "map_", "=_", "None_", ",_", "settings_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "map_", "=_", "None_", ",_", "bindings_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "View", "Event_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "logger_", "=_", "logger_", ",_", "rgb", "map_", "=_", "rgb", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "=_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mix", "ins_", "._", "UI", "Mixin_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ui", "\\u", "set", "Active_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bind", "map_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bind", "map_", "=_", "Image", "View", "Zoom", "_", "._", "bind", "map", "Class_", "(_", "self_", "._", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "bind", "map_", "=_", "bind", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bind", "map_", "._", "register", "\\u", "for", "\\u", "events_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bindings_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bindings_", "=_", "Image", "View", "Zoom", "_", "._", "bindi", "ngs", "Class_", "(_", "self_", "._", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "bindings_", "(_", "bindings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Zoom", "_", "(_", "Mix", "ins_", "._", "UI", "Mixin_", ",_", "Image", "View", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "variab", "les", " ", "for", " ", "bindi", "ng", " ", "map", " ", "and", " ", "bindi", "ngs", " ", "can", " ", "be", " ", "set_", "\\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_", "get", "\\u", "bind", "map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "bind", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Zoom", "_", "(_", "Mix", "ins_", "._", "UI", "Mixin_", ",_", "Image", "View", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "variab", "les", " ", "for", " ", "bindi", "ng", " ", "map", " ", "and", " ", "bindi", "ngs", " ", "can", " ", "be", " ", "set_", "\\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_", "get", "\\u", "bindings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "bindings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Zoom", "_", "(_", "Mix", "ins_", "._", "UI", "Mixin_", ",_", "Image", "View", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "variab", "les", " ", "for", " ", "bindi", "ng", " ", "map", " ", "and", " ", "bindi", "ngs", " ", "can", " ", "be", " ", "set_", "\\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_", "set\\u", "bindings_", "(_", "self_", ",_", "bindings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bindings_", "=_", "bindings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bindings_", "._", "set\\u", "bindings_", "(_", "self_", ")_", "\\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_", "Can", "vas", "View_", "(_", "Image", "View", "Zoom", "_", ")_", ":_", "\\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_", "Can", "vas", "View_", "(_", "Image", "View", "Zoom", "_", ")_", ":_", "\\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_", ",_", "logger_", "=_", "None_", ",_", "settings_", "=_", "None_", ",_", "rgb", "map_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "map_", "=_", "None_", ",_", "bindings_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "View", "Zoom", "_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "logger_", "=_", "logger_", ",_", "settings_", "=_", "settings_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rgb", "map_", "=_", "rgb", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "map_", "=_", "bind", "map_", ",_", "bindings_", "=_", "bindings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Needed", " ", "for", " ", "UI", "Mix", "in", " ", "to", " ", "propagate", " ", "events", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "objects_", "=_", "[_", "self_", "._", "private", "\\u", "canvas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Can", "vas", "View_", "(_", "Image", "View", "Zoom", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "canvas_", "(_", "self_", ",_", "canvas_", ",_", "private", "\\u", "canvas_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Can", "vas", "View_", ",_", "self_", ")_", "._", "set\\u", "canvas_", "(_", "canvas_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "private", "\\u", "canvas_", "=_", "private", "\\u", "canvas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "objects_", "[_", "0_", "]_", "=_", "self_", "._", "private", "\\u", "canvas_", "\\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, 0, 1, 1, 1, 2, 0, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 { "content": " def update_metadata(self, loadbalancer, metadata, node=None):\n \"\"\"\n Updates the existing metadata with the supplied dictionary. If\n 'node' is supplied, the metadata for that node is updated instead\n of for the load balancer.\n \"\"\"\n # Get the existing metadata\n md = self.get_metadata(loadbalancer, raw=True)\n id_lookup = dict([(itm[\"key\"], itm[\"id\"]) for itm in md])\n metadata_list = []\n # Updates must be done individually\n for key, val in metadata.items():\n try:\n meta_id = id_lookup[key]\n if node:\n uri = \"/loadbalancers/%s/nodes/%s/metadata/%s\" % (\n utils.get_id(loadbalancer), utils.get_id(node),\n meta_id)\n else:\n uri = \"/loadbalancers/%s/metadata\" % utils.get_id(loadbalancer)\n req_body = {\"meta\": {\"value\": val}}\n resp, body = self.api.method_put(uri, body=req_body)\n except KeyError:\n # Not an existing key; add to metadata_list\n metadata_list.append({\"key\": key, \"value\": val})\n if metadata_list:\n # New items; POST them\n if node:\n uri = \"/loadbalancers/%s/nodes/%s/metadata\" % (\n utils.get_id(loadbalancer), utils.get_id(node))\n else:\n uri = \"/loadbalancers/%s/metadata\" % utils.get_id(loadbalancer)\n req_body = {\"metadata\": metadata_list}\n resp, body = self.api.method_post(uri, body=req_body)", "metadata": "root.CloudLoadBalancerManager.update_metadata", "header": "['class', 'CloudLoadBalancerManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 838 } ]
[ { "span": "resp,", "start_line": 859, "start_column": 16, "end_line": 859, "end_column": 20 }, { "span": "body ", "start_line": 859, "start_column": 22, "end_line": 859, "end_column": 26 } ]
[ { "span": "resp,", "start_line": 871, "start_column": 12, "end_line": 871, "end_column": 16 }, { "span": "body ", "start_line": 871, "start_column": 18, "end_line": 871, "end_column": 22 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Cloud", "Load", "Balance", "r", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "metadata_", "(_", "self_", ",_", "loadbalancer", "_", ",_", "metadata_", ",_", "node_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", "s", " ", "the", " ", "exist", "ing", " ", "metadata", " ", "with", " ", "the", " ", "supplie", "d", " ", "dictionar", "y", ".", " ", "If", "\\", "10", ";", " ", " ", " ", " ", "'", "node", "'", " ", "is", " ", "supplie", "d", ",", " ", "the", " ", "metadata", " ", "for", " ", "tha", "t", " ", "node", " ", "is", " ", "update", "d", " ", "inst", "ead", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "for", " ", "the", " ", "load", " ", "balancer", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "exist", "ing", " ", "metadata_", "\\u\\u\\uNL\\u\\u\\u_", "md_", "=_", "self_", "._", "get", "\\u", "metadata_", "(_", "loadbalancer", "_", ",_", "raw_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "lookup_", "=_", "dict_", "(_", "[_", "(_", "itm_", "[_", "\"", "key", "\"_", "]_", ",_", "itm_", "[_", "\"", "id", "\"_", "]_", ")_", "for_", "itm_", "in_", "md_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", "s", " ", "must", " ", "be", " ", "don", "e", " ", "individual", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "metadata_", "._", "items_", "(_", ")_", ":_", "\\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 ", " _", "meta", "\\u", "id_", "=_", "id", "\\u", "lookup_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "nodes", "/", "%", "s", "/", "metadata", "/", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", ",_", "utils_", "._", "get", "\\u", "id_", "(_", "node_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "meta", "\\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 ", " ", "_", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "metadata", "\"_", "%_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req", "\\u", "body_", "=_", "{_", "\"", "meta", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "val_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", ",_", "body_", "=_", "self_", "._", "api_", "._", "method", "\\u", "put_", "(_", "uri_", ",_", "body_", "=_", "req", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "an", " ", "exist", "ing", " ", "key", ";", " ", "add", " ", "to", " ", "metadata", "\\u", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata", "\\u", "list_", "._", "append_", "(_", "{_", "\"", "key", "\"_", ":_", "key_", ",_", "\"", "value", "\"_", ":_", "val_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "metadata", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "New", " ", "items", ";", " ", "POST", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "nodes", "/", "%", "s", "/", "metadata", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", ",_", "utils_", "._", "get", "\\u", "id_", "(_", "node_", ")_", ")_", "\\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 ", " _", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "metadata", "\"_", "%_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req", "\\u", "body_", "=_", "{_", "\"", "metadata", "\"_", ":_", "metadata", "\\u", "list_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", ",_", "body_", "=_", "self_", "._", "api_", "._", "method", "\\u", "post_", "(_", "uri_", ",_", "body_", "=_", "req", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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, 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Duplicate key in dict literal
slimkrazy/python-google-places/googleplaces/tests/testfixtures.py
[ { "content": "\"\"\"\nSample JSON responses pulled from Google Places API.\n\"\"\"\n\nPLACES_QUERY_RESPONSE = {\n \"html_attributions\" : [\n \"Listings by \\u003ca href=\\\"http://www.yellowpages.com.au/\\\"\\u003eYellow Pages\\u003c/a\\u003e\"\n ],\n \"results\" : [\n {\n \"geometry\" : {\n \"location\" : {\n \"lat\" : -33.8719830,\n \"lng\" : 151.1990860\n }\n },\n \"icon\" : \"http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png\",\n \"id\" : \"677679492a58049a7eae079e0890897eb953d79b\",\n \"name\" : \"Zaaffran Restaurant - BBQ and GRILL, Darling Harbour\",\n \"rating\" : 3.90,\n \"reference\" : \"CpQBjAAAAFAOaZhKjoDYfDsnISY6p4DKgdtrXTLJBhYsF0WnLBrkLHN3LdLpxc9VsbQKfbtg87nnDsl-SdCKT60Vs4Sxe_lCNCgRBxgq0JBBj8maNZ9pEp_LWjq8O-shdjh-LexdN5o-ZYLVBXhqX2az4TFvuOqme0eRirqMyatKgfn9nuKEkKR2a5tfFQlMfSZSlbyoOxIQVffhpcBqaua-_Yb364wx9xoUC1I-81Wj7aBmSmkctXv_YE7jqgQ\",\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYxxx\",\n \"types\" : [ \"restaurant\", \"food\", \"establishment\" ],\n \"vicinity\" : \"Harbourside Centre 10 Darling Drive, Darling Harbour, Sydney\"\n },\n {\n \"geometry\" : {\n \"location\" : {\n \"lat\" : -33.8721970,\n \"lng\" : 151.1987820\n }\n },\n \"icon\" : \"http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png\",\n \"id\" : \"27ea39c8fed1c0437069066b8dccf958a2d06f19\",\n \"name\" : \"Criniti's\",\n \"rating\" : 3.10,\n \"reference\" : \"CmRgAAAAm4ajUz0FWaV2gB5mBbdIFhg-Jn98p1AQOrr1QxUWh7Q0nhEUhZL-hY9L4l5ifvRfGttf_gyBpSsGaxMjnr_pcPGUIQKES0vScLQpwM7jsS3BQKB83G9B_SlJFcRuD5dDEhCoNxepsgfJ5YSuXlYjVo9tGhQaKigmZ0WQul__A702AiH3WIy6-A\",\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYsss\",\n \"types\" : [ \"restaurant\", \"food\", \"establishment\" ],\n \"vicinity\" : \"231/10 Darling Dr, DARLING HARBOUR\"\n },\n {\n \"geometry\" : {\n \"location\" : {\n \"lat\" : -33.8720340,\n \"lng\" : 151.198540\n }\n },\n \"icon\" : \"http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png\",\n \"id\" : \"cb853832ab8368db3adc52c657fe063dac0f3b11\",\n \"name\" : \"Al Ponte Harbour View Restaurant\",\n \"reference\" : \"CoQBeAAAAMQ4yYBquhcHj8qzcgUNdwgeiIOhh-Eyf21y9J58y9JXVO7yzw1mFd_wKKjEYJLR_PPjbPRGJEDFnR6eCK_zw1qwrzdyxjnM2zwvdiJ-MLwt3PxVvkkPAjLJYp1cerBc0KTyUVfBo7B4U7RFt4r3DueQ4mz6N-6G7CBoddtfRnm5EhCSGc8yi1k4EQ8whHhKfzxpGhTA1mKVV8kydhqLCsbWDitFMxqzvA\",\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYyyy\",\n \"types\" : [ \"restaurant\", \"food\", \"establishment\" ],\n \"vicinity\" : \"10 Darling Dr, Sydney CBD\"\n },\n {\n \"geometry\" : {\n \"location\" : {\n \"lat\" : -33.8711490,\n \"lng\" : 151.1985180\n }\n },\n \"icon\" : \"http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png\",\n \"id\" : \"400d8b4ee30d39175f69fddfcc50590860e59d62\",\n \"name\" : \"JB's Bar at Holiday Inn Darling Harbour\",\n \"reference\" : \"CoQBfgAAACn9RQ5w_BCAcdF14KQjTh_youPZUA5a7Fbbc74gu3gWaGkl78jlDnIYuUCNOEBs4Up-iw_KrHHDRx58A91Pwqnhrf5RSMihz5gAj3M7X7IW8a_Qxl7-MuAbkoNd6rTbHXtTTWtFtKAhQBljsHPahn0kDPXXSwrhn3WjSfFQX6FfEhCWPSB0ISfYioqpCBWFveZlGhSdW7eYv0NUEAtgTAzJ7x0r4NDHPQ\",\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYzzz\",\n \"types\" : [ \"restaurant\", \"food\", \"establishment\" ],\n \"vicinity\" : \"Furama Hotel, 68 Harbour Street, Darling Harbour, Sydney\"\n },\n {\n \"geometry\" : {\n \"location\" : {\n \"lat\" : -33.8711490,\n \"lng\" : 151.1985180\n }\n },\n \"icon\" : \"http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png\",\n \"id\" : \"f12a10b450db59528c18e57dea9f56f88c65c2fa\",\n \"name\" : \"Health Harbour\",\n \"reference\" : \"CnRlAAAA97YiSpT9ArwBWRZ_7FeddhMtQ4rGTy9v277_B4Y3jxUFKkZVczf3YHrhSLGuKugNQQpCDMWjYKv6LkSA8CiECzh5z7B2wOMkhn0PGjpq01p0QRapJuA6z9pQFS_oTeUq0M_paSCQ_GEB8A5-PpkJXxIQHAuoj0nyrgNwjLtByDHAgBoUdHaA6D2ceLp8ga5IJqxfqOnOwS4\",\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYmmm\",\n \"types\" : [ \"food\", \"store\", \"establishment\" ],\n \"vicinity\" : \"Darling Harbour\"\n }\n ],\n \"status\" : \"OK\"\n}\n\nAUTOCOMPLETE_QUERY_RESPONSE = {\n 'predictions': [\n {\n 'description': u\"Hattie B's Hot Chicken, 19th Avenue South, Nashville, TN, United States\",\n 'id': '8d41b3887c71f5240a26d8b5badc792708e5ea2a',\n 'matched_substrings': [{'length': 6, 'offset': 0}],\n 'place_id': 'ChIJSbQCipNmZIgRm4c6Nz9sGaE',\n 'reference': 'CmRWAAAAqGYRANjgide_-pBFmUnaOY-m5Cy0RV8by6-pDkB_FsqouiehU-j-dV6oAdZuoMueEvKAqE1FAXcNivsB0mx9a40EEpPOXKKSiag_8wuFAlwGpeQUoXwn_ccF5zs6vldhEhAm161WaDqwSfBFKqjRE04vGhS3BcwJ2MeUbpuPbtVTUx3w3OEpLQ',\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYnnn\",\n 'terms': [\n {'offset': 0, 'value': u\"Hattie B's Hot Chicken\"},\n {'offset': 24, 'value': '19th Avenue South'},\n {'offset': 43, 'value': 'Nashville'},\n {'offset': 54, 'value': 'TN'},\n {'offset': 58, 'value': 'United States'}\n ],\n 'types': ['establishment']\n },\n {\n 'description': 'Hattiesburg, MS, United States',\n 'id': '25f9c17302a8a1a8e432c53d6d4c712063e93188',\n 'matched_substrings': [{'length': 6, 'offset': 0}],\n 'place_id': 'ChIJ3yio1UncnIgRyrUcLZK_sXQ',\n 'reference': 'CkQ2AAAAwRcCnvJl5ZvhsZ6TxUrkpDqPIW7mVIANGti65-SK7MlCNEPj7vGkN2Dh_KnxI7XI6pyDcTsXCoi7wLnQrr4H7xIQ_D35yzn61ZNmQelYcjk9xBoUsgP8yimN1xd9J4L6k4b6ZpK_E94',\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYooo\",\n 'terms': [\n {'offset': 0, 'value': 'Hattiesburg'},\n {'offset': 13, 'value': 'MS'},\n {'offset': 17, 'value': 'United States'}\n ],\n 'types': ['locality', 'political', 'geocode']\\\n },\n {\n 'description': 'Hattie Cotton Elementary School, Nashville, TN, United States',\n 'id': 'f8998e62bf80300a07a8d007b890bb17368b3fd4',\n 'matched_substrings': [{'length': 6, 'offset': 0}],\n 'place_id': 'ChIJXzft89tnZIgRm0ovqWZebMs',\n 'reference': 'ClRMAAAAVe4DIy63p4YGFHVQpmlrgBXkA1K0T6xZbWm2SHitS28bZcPl2ctmi7QNKR2EX_2RNY5ckfPVIBL3iDOmhzjeuCrn48qNnoE0z9QJzskfdnASEKo5EvKlKYNuqep4dyThEDcaFFYegROsLxF0tssPzZAYyL9ra70z',\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYppp\",\n 'terms': [\n {'offset': 0, 'value': 'Hattie Cotton Elementary School'},\n {'offset': 33, 'value': 'Nashville'},\n {'offset': 44, 'value': 'TN'},\n {'offset': 48, 'value': 'United States'}\n ],\n 'types': ['establishment']\n },\n {\n 'description': 'Hattie Ct, Hendersonville, TN, United States',\n 'id': 'eaeb7403d82be002de3ae52ab811d4014d4dff5b',\n 'matched_substrings': [{'length': 6, 'offset': 0}],\n 'place_id': 'EixIYXR0aWUgQ3QsIEhlbmRlcnNvbnZpbGxlLCBUTiwgVW5pdGVkIFN0YXRlcw',\n 'reference': 'CjQwAAAA16vktOVr7wLMig9H8Eb0CQFaDuIhqsG-3G7YCH7NE9qKxImG9p8W_mXbhjnkg9f4EhA6hP-p7r4I-iBMu6vcpb2VGhRFB4IPb0QupUlhD_B-Q8T6UJ8NQQ',\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYqqq\",\n 'terms': [\n {'offset': 0, 'value': 'Hattie Ct'},\n {'offset': 11, 'value': 'Hendersonville'},\n {'offset': 27, 'value': 'TN'},\n {'offset': 31, 'value': 'United States'}\n ],\n 'types': ['route', 'geocode']\n },\n {\n 'description': 'Hattieville, AR, United States',\n 'id': '4a144096d3107fd6f3ef0254c5ca4dd106abebcd',\n 'matched_substrings': [{'length': 6, 'offset': 0}],\n 'place_id': 'ChIJjTUp5w2izYcRwRTy8ZpwjkI',\n 'reference': 'CkQ2AAAA-9G9z7Y3SSTPJOxNcCSVhUxeaC7OTL_ADLq00_WXSHBhXi1PTsm08gX2Zz_uLnLTBFJhqxm4g9HrbTO8Rm25lBIQepnjuQ02A6BqH2lNVjsIzRoUM_ndW4AhrGZFxnKOWSAPWfAm7hY',\n \"place_id\": \"ChIJfZmx2Jxw44kR11GqlDbYrrr\",\n 'terms': [\n {'offset': 0, 'value': 'Hattieville'},\n {'offset': 13, 'value': 'AR'},\n {'offset': 17, 'value': 'United States'}\n ],\n 'types': ['locality', 'political', 'geocode']\n }\n ],\n 'status': 'OK'\n}", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "'place_id':", "start_line": 96, "start_column": 12, "end_line": 96, "end_column": 22 }, { "span": "'place_id':", "start_line": 112, "start_column": 12, "end_line": 112, "end_column": 22 }, { "span": "'place_id':", "start_line": 126, "start_column": 12, "end_line": 126, "end_column": 22 }, { "span": "'place_id':", "start_line": 141, "start_column": 12, "end_line": 141, "end_column": 22 }, { "span": "'place_id':", "start_line": 156, "start_column": 12, "end_line": 156, "end_column": 22 } ]
[ { "span": "\"place_id\":", "start_line": 98, "start_column": 12, "end_line": 98, "end_column": 22 }, { "span": "\"place_id\":", "start_line": 114, "start_column": 12, "end_line": 114, "end_column": 22 }, { "span": "\"place_id\":", "start_line": 128, "start_column": 12, "end_line": 128, "end_column": 22 }, { "span": "\"place_id\":", "start_line": 143, "start_column": 12, "end_line": 143, "end_column": 22 }, { "span": "\"place_id\":", "start_line": 158, "start_column": 12, "end_line": 158, "end_column": 22 } ]
1
true
[ "[CLS]_", "Duplicate", "_", "key_", "in_", "dict_", "literal_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Sampl", "e", " ", "JSO", "N", " ", "response", "s", " ", "pull", "ed", " ", "from", " ", "Goo", "gle", " ", "Places", " ", "API", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PLACE", "S", "\\u", "QUE", "RY", "\\u", "RESPONSE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "html", "\\u", "attribution", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Listi", "ngs", " ", "by", " ", "\\\\", "u0", "03", "ca", " ", "href", "=\\\\\"", "http", "://", "www", ".", "yell", "ow", "page", "s", ".", "com", ".", "au", "/\\\\", "\"\\\\", "u0", "03", "e", "Ye", "llow", " ", "Page", "s", "\\\\", "u0", "03", "c", "/", "a", "\\\\", "u0", "03", "e", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "results", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "geom", "etry", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "location", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lat", "\"_", ":_", "-_", "33.", "871", "983", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ln", "g", "\"_", ":_", "151", ".1", "990", "860", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "\"", "http", "://", "maps", ".", "gst", "atic", ".", "com", "/", "mapfile", "s", "/", "place", "\\u", "api", "/", "icons", "/", "restaurant", "-", "71.", "png", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "677", "679", "492", "a5", "804", "9", "a7", "ea", "e0", "7", "9e", "089", "089", "7e", "b9", "5", "3d", "7", "9", "b", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Za", "aff", "ran", " ", "Rest", "aura", "nt", " ", "-", " ", "BB", "Q", " ", "and", " ", "GRI", "LL", ",", " ", "Dar", "ling", " ", "Har", "bour", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rati", "ng", "\"_", ":_", "3.9", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reference", "\"_", ":_", "\"", "Cp", "QB", "j", "AAAA", "FA", "Oa", "Zh", "Kj", "o", "DY", "f", "Ds", "n", "IS", "Y", "6", "p4", "DK", "gd", "tr", "XT", "LJ", "Bh", "Ys", "F0", "Wn", "LB", "rk", "LH", "N3", "Ld", "Lp", "xc", "9", "Vs", "b", "QK", "fb", "tg", "87", "nn", "Ds", "l", "-", "Sd", "CK", "T6", "0", "Vs", "4", "Sx", "e\\u", "l", "CN", "Cg", "RB", "xg", "q", "0", "JB", "Bj", "8", "ma", "NZ", "9", "p", "Ep", "\\u", "LW", "jq", "8", "O", "-", "sh", "dj", "h", "-", "Lex", "d", "N", "5", "o", "-", "ZY", "LV", "BX", "hq", "X", "2a", "z", "4", "TF", "vu", "Oq", "me", "0e", "Ri", "rq", "My", "at", "K", "gf", "n", "9", "nu", "KE", "k", "KR", "2a", "5", "tf", "FQ", "l", "Mf", "SZ", "Sl", "by", "o", "Ox", "IQ", "Vf", "fh", "pc", "B", "qa", "ua", "-\\u", "Yb", "364", "wx", "9", "xo", "UC", "1", "I", "-", "8", "1", "Wj", "7a", "Bm", "Sm", "kc", "t", "Xv", "\\u", "YE", "7", "jq", "g", "Q", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Y", "xxx", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "types", "\"_", ":_", "[_", "\"", "restaurant", "\"_", ",_", "\"", "food", "\"_", ",_", "\"", "establish", "ment", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vic", "init", "y", "\"_", ":_", "\"", "Har", "bour", "side", " ", "Centre", " ", "10", " ", "Dar", "ling", " ", "Drive", ",", " ", "Dar", "ling", " ", "Har", "bour", ",", " ", "Sy", "dne", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "geom", "etry", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "location", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lat", "\"_", ":_", "-_", "33.", "872", "1970_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ln", "g", "\"_", ":_", "151", ".1", "987", "820", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "\"", "http", "://", "maps", ".", "gst", "atic", ".", "com", "/", "mapfile", "s", "/", "place", "\\u", "api", "/", "icons", "/", "restaurant", "-", "71.", "png", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "2", "7e", "a3", "9c", "8f", "ed", "1c", "043", "706", "906", "6b", "8d", "ccf", "958", "a2", "d0", "6f", "1", "9", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Cri", "niti", "'", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rati", "ng", "\"_", ":_", "3.1", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reference", "\"_", ":_", "\"", "Cm", "Rg", "AAAA", "m4", "aj", "Uz", "0", "FW", "a", "V2", "g", "B5", "m", "Bb", "d", "IF", "hg", "-", "Jn", "98", "p1", "AQ", "Or", "r1", "Q", "x", "UW", "h", "7", "Q", "0", "nh", "EU", "h", "ZL", "-", "h", "Y", "9", "L4", "l", "5", "if", "v", "Rf", "Gt", "tf", "\\u", "gy", "Bp", "Ss", "Ga", "x", "Mj", "nr", "\\u", "pc", "PG", "UI", "QK", "ES", "0", "v", "Sc", "LQ", "pw", "M", "7", "js", "S", "3", "BQ", "KB", "8", "3", "G", "9", "B", "\\u", "Sl", "JF", "c", "Ru", "D5", "d", "DE", "h", "Co", "Nx", "epsg", "f", "J", "5", "YS", "u", "Xl", "Y", "j", "Vo", "9", "t", "Gh", "Qa", "Ki", "gm", "Z", "0", "WQ", "ul", "\\u\\u", "A7", "02", "Ai", "H", "3", "WI", "y", "6", "-", "A", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Ys", "ss", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "types", "\"_", ":_", "[_", "\"", "restaurant", "\"_", ",_", "\"", "food", "\"_", ",_", "\"", "establish", "ment", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vic", "init", "y", "\"_", ":_", "\"", "231", "/", "10", " ", "Dar", "ling", " ", "Dr", ",", " ", "DAR", "LING", " ", "HAR", "BO", "UR", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "geom", "etry", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "location", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lat", "\"_", ":_", "-_", "33.", "872", "034", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ln", "g", "\"_", ":_", "151", ".1", "985", "40_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "\"", "http", "://", "maps", ".", "gst", "atic", ".", "com", "/", "mapfile", "s", "/", "place", "\\u", "api", "/", "icons", "/", "restaurant", "-", "71.", "png", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "cb", "853", "832", "ab", "836", "8d", "b3", "adc", "5", "2c", "657", "fe", "063", "dac", "0f", "3b", "11", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Al", " ", "Pon", "te", " ", "Har", "bour", " ", "View", " ", "Rest", "aura", "nt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reference", "\"_", ":_", "\"", "Co", "QB", "e", "AAAA", "MQ", "4", "y", "YB", "qu", "hc", "Hj", "8", "qz", "cg", "UN", "dw", "ge", "i", "IO", "hh", "-", "Ey", "f2", "1", "y", "9", "J", "5", "8", "y", "9", "JX", "VO", "7", "yz", "w", "1", "m", "Fd", "\\u", "w", "KK", "j", "EY", "JL", "R", "\\u", "PP", "jb", "PR", "GJ", "ED", "Fn", "R", "6e", "CK", "\\u", "zw", "1", "qw", "rz", "dy", "xj", "n", "M2", "zw", "vdi", "J", "-", "ML", "wt", "3", "Px", "V", "vk", "k", "PA", "j", "LJ", "Yp", "1c", "er", "Bc", "0", "KT", "y", "UV", "f", "Bo", "7", "B4", "U", "7", "RF", "t", "4", "r3", "Du", "e", "Q", "4", "mz", "6", "N", "-", "6", "G", "7", "CB", "odd", "tf", "Rn", "m", "5", "Eh", "CS", "Gc", "8", "yi", "1", "k", "4", "EQ", "8", "wh", "Hh", "K", "fz", "xp", "Gh", "TA", "1", "m", "KV", "V", "8", "ky", "dh", "q", "LC", "sb", "WD", "it", "FM", "xq", "zv", "A", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Y", "yyy", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "types", "\"_", ":_", "[_", "\"", "restaurant", "\"_", ",_", "\"", "food", "\"_", ",_", "\"", "establish", "ment", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vic", "init", "y", "\"_", ":_", "\"", "10", " ", "Dar", "ling", " ", "Dr", ",", " ", "Sy", "dne", "y", " ", "CB", "D", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "geom", "etry", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "location", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lat", "\"_", ":_", "-_", "33.", "871", "149", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ln", "g", "\"_", ":_", "151", ".1", "985", "180_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "\"", "http", "://", "maps", ".", "gst", "atic", ".", "com", "/", "mapfile", "s", "/", "place", "\\u", "api", "/", "icons", "/", "restaurant", "-", "71.", "png", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "400", "d8", "b4", "ee", "30", "d3", "917", "5f", "6", "9", "fdd", "fcc", "505", "908", "60", "e5", "9", "d6", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "JB", "'", "s", " ", "Bar", " ", "at", " ", "Hol", "ida", "y", " ", "In", "n", " ", "Dar", "ling", " ", "Har", "bour", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reference", "\"_", ":_", "\"", "Co", "QB", "fg", "AAAC", "n", "9", "RQ", "5", "w", "\\u", "BC", "Ac", "d", "F1", "4", "KQ", "j", "Th", "\\u", "you", "PZ", "UA", "5a", "7", "Fb", "bc", "7", "4", "gu", "3", "g", "Wa", "G", "kl", "7", "8", "jl", "Dn", "I", "Yu", "UC", "NO", "EB", "s", "4", "Up", "-", "iw", "\\u", "Kr", "HH", "DR", "x5", "8", "A9", "1", "Pw", "qn", "hr", "f5", "RS", "Mi", "hz", "5", "g", "Aj", "3", "M", "7", "X", "7", "IW", "8a", "\\u", "Q", "xl", "7", "-", "Mu", "Ab", "ko", "Nd", "6", "r", "Tb", "HX", "t", "TT", "Wt", "Ft", "KA", "h", "QB", "lj", "s", "HP", "ah", "n", "0", "k", "DP", "XX", "Sw", "rh", "n", "3", "Wj", "Sf", "FQ", "X", "6", "Ff", "Eh", "CW", "PS", "B0", "IS", "f", "Yi", "oq", "p", "CB", "WF", "ve", "Zl", "Gh", "Sd", "W", "7e", "Yv", "0", "NU", "EA", "tg", "TA", "z", "J", "7", "x0", "r4", "ND", "HP", "Q", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Y", "zzz", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "types", "\"_", ":_", "[_", "\"", "restaurant", "\"_", ",_", "\"", "food", "\"_", ",_", "\"", "establish", "ment", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vic", "init", "y", "\"_", ":_", "\"", "Fur", "ama", " ", "Hot", "el", ",", " ", "6", "8", " ", "Har", "bour", " ", "Stre", "et", ",", " ", "Dar", "ling", " ", "Har", "bour", ",", " ", "Sy", "dne", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "geom", "etry", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "location", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lat", "\"_", ":_", "-_", "33.", "871", "149", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ln", "g", "\"_", ":_", "151", ".1", "985", "180_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "icon", "\"_", ":_", "\"", "http", "://", "maps", ".", "gst", "atic", ".", "com", "/", "mapfile", "s", "/", "place", "\\u", "api", "/", "icons", "/", "gener", "ic", "\\u", "business", "-", "71.", "png", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "f1", "2a", "10", "b4", "50", "db", "595", "2", "8c", "1", "8e", "5", "7d", "ea", "9", "f5", "6f", "88", "c6", "5c", "2f", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Health", " ", "Har", "bour", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reference", "\"_", ":_", "\"", "Cn", "Rl", "AAAA", "9", "7", "Yi", "Sp", "T", "9", "Ar", "w", "BW", "RZ", "\\u", "7", "Fe", "dd", "h", "Mt", "Q", "4", "r", "GT", "y", "9", "v2", "7", "7", "\\u", "B4", "Y", "3", "jx", "UF", "Kk", "Z", "Vc", "zf", "3", "YH", "rh", "SL", "Gu", "Ku", "g", "NQ", "Qp", "CD", "MW", "j", "YK", "v6", "L", "k", "SA", "8", "Ci", "EC", "zh", "5", "z", "7", "B2", "w", "OM", "kh", "n", "0", "PG", "jp", "q", "01", "p0", "QR", "ap", "Ju", "A6", "z", "9", "p", "QF", "S", "\\u", "o", "Te", "Uq", "0", "M", "\\u", "pa", "SC", "Q", "\\u", "GE", "B8", "A5", "-", "Pp", "k", "JX", "x", "IQ", "HA", "uo", "j", "0", "ny", "rg", "Nw", "j", "Lt", "By", "DH", "Ag", "Bo", "Ud", "Ha", "A6", "D2", "ce", "Lp", "8", "ga", "5", "IJ", "qx", "fq", "On", "Ow", "S4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Ym", "mm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "types", "\"_", ":_", "[_", "\"", "food", "\"_", ",_", "\"", "store", "\"_", ",_", "\"", "establish", "ment", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vic", "init", "y", "\"_", ":_", "\"", "Dar", "ling", " ", "Har", "bour", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ":_", "\"", "OK", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "AUTO", "COMPLET", "E", "\\u", "QUE", "RY", "\\u", "RESPONSE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "predicti", "ons", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "u", "\"", "Hat", "tie", " ", "B", "'", "s", " ", "Hot", " ", "Chi", "cke", "n", ",", " ", "1", "9", "th", " ", "Ave", "nue", " ", "South", ",", " ", "Nas", "hv", "ille", ",", " ", "TN", ",", " ", "Unit", "ed", " ", "State", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "8d", "4", "1b", "388", "7c", "7", "1f", "524", "0a", "2", "6d", "8b", "5b", "adc", "792", "708", "e5", "ea", "2a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "d\\u", "substring", "s", "'_", ":_", "[_", "{_", "'", "length", "'_", ":_", "6_", ",_", "'", "offset", "'_", ":_", "0_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "place", "\\u", "id", "'_", ":_", "'", "Ch", "IJ", "Sb", "QC", "ip", "Nm", "ZI", "g", "Rm", "4c", "6", "Nz", "9", "s", "Ga", "E", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "'_", ":_", "'", "Cm", "RW", "AAAA", "q", "GY", "RAN", "jg", "ide", "\\u", "-", "p", "BF", "m", "Una", "OY", "-", "m", "5", "Cy", "0", "RV", "8b", "y", "6", "-", "p", "Dk", "B", "\\u", "Fs", "qo", "uie", "h", "U", "-", "j", "-", "d", "V6", "o", "Ad", "Zu", "o", "Mu", "e", "Ev", "KA", "q", "E1", "FA", "Xc", "Ni", "vs", "B0", "mx", "9", "a4", "0E", "Ep", "PO", "XK", "KS", "iag", "\\u", "8", "wu", "FA", "lw", "Gp", "e", "QU", "o", "X", "wn", "\\u", "cc", "F5", "zs", "6", "vl", "dh", "Eh", "Am", "161", "Wa", "Dq", "w", "Sf", "BF", "Kq", "j", "RE", "04", "v", "Gh", "S", "3", "Bc", "w", "J", "2", "Me", "Ub", "pu", "Pb", "t", "VT", "U", "x3", "w3", "OE", "p", "LQ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Y", "nn", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "term", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "0_", ",_", "'", "value", "'_", ":_", "u", "\"", "Hat", "tie", " ", "B", "'", "s", " ", "Hot", " ", "Chi", "cke", "n", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "24_", ",_", "'", "value", "'_", ":_", "'", "1", "9", "th", " ", "Ave", "nue", " ", "South", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "43_", ",_", "'", "value", "'_", ":_", "'", "Nas", "hv", "ille", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "54_", ",_", "'", "value", "'_", ":_", "'", "TN", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "58_", ",_", "'", "value", "'_", ":_", "'", "Unit", "ed", " ", "State", "s", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "types", "'_", ":_", "[_", "'", "establish", "ment", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "Hat", "ties", "burg", ",", " ", "MS", ",", " ", "Unit", "ed", " ", "State", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "25", "f9", "c1", "730", "2a", "8a", "1a", "8e", "432", "c5", "3d", "6d", "4c", "712", "063", "e9", "318", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "d\\u", "substring", "s", "'_", ":_", "[_", "{_", "'", "length", "'_", ":_", "6_", ",_", "'", "offset", "'_", ":_", "0_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "place", "\\u", "id", "'_", ":_", "'", "Ch", "IJ", "3", "yi", "o", "1", "Unc", "n", "Ig", "Ry", "r", "Uc", "LZ", "K", "\\u", "s", "XQ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "'_", ":_", "'", "Ck", "Q2", "AAAA", "w", "Rc", "Cn", "v", "Jl", "5", "Zv", "hs", "Z", "6", "Tx", "Ur", "kp", "Dq", "PI", "W", "7", "m", "VI", "ANG", "ti", "6", "5", "-", "SK", "7", "Ml", "CN", "EP", "j", "7", "v", "G", "k", "N", "2", "Dh", "\\u", "Kn", "x", "I", "7", "XI", "6", "py", "Dc", "Ts", "XC", "oi", "7", "w", "Ln", "Qr", "r4", "H", "7", "x", "IQ", "\\u", "D3", "5", "yz", "n", "6", "1", "ZN", "m", "Qe", "l", "Yc", "jk", "9", "x", "Bo", "Us", "g", "P", "8", "yi", "m", "N1", "xd", "9", "J", "4", "L", "6", "k", "4b", "6", "Zp", "K", "\\u", "E", "9", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Yo", "oo", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "term", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "0_", ",_", "'", "value", "'_", ":_", "'", "Hat", "ties", "burg", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "13_", ",_", "'", "value", "'_", ":_", "'", "MS", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "17_", ",_", "'", "value", "'_", ":_", "'", "Unit", "ed", " ", "State", "s", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "types", "'_", ":_", "[_", "'", "locality", "'_", ",_", "'", "politic", "al", "'_", ",_", "'", "geocode", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "Hat", "tie", " ", "Co", "tto", "n", " ", "Element", "ary", " ", "Scho", "ol", ",", " ", "Nas", "hv", "ille", ",", " ", "TN", ",", " ", "Unit", "ed", " ", "State", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "f8", "998", "e", "6", "2b", "f8", "0300", "a0", "7a", "8d", "007", "b8", "90", "bb", "173", "6", "8b", "3f", "d4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "d\\u", "substring", "s", "'_", ":_", "[_", "{_", "'", "length", "'_", ":_", "6_", ",_", "'", "offset", "'_", ":_", "0_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "place", "\\u", "id", "'_", ":_", "'", "Ch", "IJ", "X", "zf", "t", "89", "tn", "ZI", "g", "Rm", "0o", "vq", "WZ", "eb", "Ms", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "'_", ":_", "'", "Cl", "RM", "AAAA", "Ve", "4", "DI", "y", "6", "3p", "4", "YG", "FH", "VQ", "pm", "lr", "g", "BX", "k", "A1", "K", "0", "T6", "x", "Zb", "Wm", "2", "SH", "it", "S2", "8b", "Zc", "Pl", "2c", "tmi", "7", "QN", "KR", "2E", "X", "\\u", "2", "RN", "Y", "5c", "kf", "PV", "IB", "L3", "i", "DO", "mh", "zj", "eu", "Cr", "n4", "8", "q", "Nn", "o", "E0", "z", "9", "QJ", "zs", "kf", "dn", "AS", "EK", "o", "5", "Ev", "Kl", "KY", "Nu", "qe", "p4", "dy", "Th", "ED", "ca", "FF", "Ye", "g", "RO", "s", "Lx", "F0", "tss", "P", "z", "ZA", "Y", "y", "L", "9", "ra", "7", "0", "z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Yp", "pp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "term", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "0_", ",_", "'", "value", "'_", ":_", "'", "Hat", "tie", " ", "Co", "tto", "n", " ", "Element", "ary", " ", "Scho", "ol", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "33_", ",_", "'", "value", "'_", ":_", "'", "Nas", "hv", "ille", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "44_", ",_", "'", "value", "'_", ":_", "'", "TN", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "48_", ",_", "'", "value", "'_", ":_", "'", "Unit", "ed", " ", "State", "s", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "types", "'_", ":_", "[_", "'", "establish", "ment", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "Hat", "tie", " ", "Ct", ",", " ", "Hen", "ders", "onv", "ille", ",", " ", "TN", ",", " ", "Unit", "ed", " ", "State", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "ea", "eb", "740", "3d", "8", "2b", "e0", "02", "de", "3a", "e5", "2a", "b8", "11", "d4", "014", "d4", "dff", "5b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "d\\u", "substring", "s", "'_", ":_", "[_", "{_", "'", "length", "'_", ":_", "6_", ",_", "'", "offset", "'_", ":_", "0_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "place", "\\u", "id", "'_", ":_", "'", "Ei", "x", "I", "YX", "R0", "a", "WU", "g", "Q", "3", "Qs", "IE", "hl", "bm", "Rl", "cn", "Nvb", "n", "Zp", "b", "Gx", "l", "LC", "BUT", "iw", "g", "VW", "5", "pd", "GV", "k", "IF", "N", "0", "YX", "Rl", "cw", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "'_", ":_", "'", "C", "j", "Q", "w", "AAAA", "16", "vk", "t", "OV", "r", "7", "w", "LM", "ig", "9", "H", "8", "Eb", "0", "CQ", "Fa", "Du", "Ih", "qs", "G", "-", "3", "G", "7", "YC", "H", "7", "NE", "9", "q", "K", "x", "Im", "G", "9", "p", "8", "W", "\\u", "m", "Xb", "hj", "nk", "g", "9", "f4", "Eh", "A6", "h", "P", "-", "p", "7", "r4", "I", "-", "i", "BM", "u", "6", "vc", "pb", "2", "VG", "h", "RF", "B4", "IP", "b0", "Qu", "p", "Ul", "h", "D", "\\u", "B", "-", "Q", "8", "T6", "UJ", "8", "NQ", "Q", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Yq", "qq", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "term", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "0_", ",_", "'", "value", "'_", ":_", "'", "Hat", "tie", " ", "Ct", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "11_", ",_", "'", "value", "'_", ":_", "'", "Hen", "ders", "onv", "ille", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "27_", ",_", "'", "value", "'_", ":_", "'", "TN", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "31_", ",_", "'", "value", "'_", ":_", "'", "Unit", "ed", " ", "State", "s", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "types", "'_", ":_", "[_", "'", "route", "'_", ",_", "'", "geocode", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "Hat", "tie", "vil", "le", ",", " ", "AR", ",", " ", "Unit", "ed", " ", "State", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "4a", "1440", "96", "d3", "107", "fd", "6f", "3e", "f0", "254", "c5", "ca", "4d", "d1", "0", "6a", "be", "bcd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "d\\u", "substring", "s", "'_", ":_", "[_", "{_", "'", "length", "'_", ":_", "6_", ",_", "'", "offset", "'_", ":_", "0_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "place", "\\u", "id", "'_", ":_", "'", "Ch", "IJ", "j", "TU", "p5", "w2", "iz", "Yc", "Rw", "RT", "y", "8", "Zp", "wj", "k", "I", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "'_", ":_", "'", "Ck", "Q2", "AAAA", "-", "9", "G", "9", "z", "7", "Y", "3", "SS", "TP", "JO", "x", "Nc", "CSV", "h", "U", "xe", "a", "C", "7", "OT", "L", "\\u", "AD", "Lq", "00", "\\u", "WX", "SH", "Bh", "Xi", "1", "PT", "sm", "0", "8", "g", "X", "2", "Z", "z", "\\u", "u", "Ln", "LT", "BF", "Jh", "qx", "m4", "g", "9", "Hr", "b", "TO", "8", "Rm", "25", "l", "BI", "Qe", "pn", "ju", "Q", "02", "A6", "B", "q", "H2", "l", "NV", "js", "Iz", "Ro", "UM", "\\u", "nd", "W", "4", "Ah", "r", "GZ", "Fx", "n", "KO", "WS", "AP", "Wf", "Am", "7", "h", "Y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "place", "\\u", "id", "\"_", ":_", "\"", "Ch", "IJ", "f", "Zm", "x2", "J", "xw", "4", "4", "k", "R1", "1", "Gq", "l", "Db", "Yr", "rr", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "term", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "0_", ",_", "'", "value", "'_", ":_", "'", "Hat", "tie", "vil", "le", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "13_", ",_", "'", "value", "'_", ":_", "'", "AR", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "offset", "'_", ":_", "17_", ",_", "'", "value", "'_", ":_", "'", "Unit", "ed", " ", "State", "s", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "types", "'_", ":_", "[_", "'", "locality", "'_", ",_", "'", "politic", "al", "'_", ",_", "'", "geocode", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "OK", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_" ]
[ 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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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, 3, 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 ]
Variable defined multiple times
opencolorado/OpenColorado-Tools-and-Utilities/Scripts/Harvest/Drcog/ckanclient/tests/test_ckanclient.py
[ { "content": " def test_11_package_relationship_post(self):\n res = self.c.package_relationship_register_get('annakarenina')\n assert self.c.last_status == 200, self.c.last_status\n assert not self.c.last_message, self.c.last_body\n\n # create relationship\n res = self.c.package_relationship_entity_post('annakarenina', 'child_of', 'warandpeace', 'some comment')\n try:\n assert self.c.last_status == 201, self.c.last_status\n finally:\n self.delete_relationships()", "metadata": "root.TestCkanClient.test_11_package_relationship_post", "header": "['class', 'TestCkanClient', '(', 'CkanServerCase', ')', ':', '___EOS___']", "index": 273 }, { "content": " def test_12_package_relationship_get(self):\n # create relationship\n res = self.c.package_relationship_entity_post('annakarenina', 'child_of', 'warandpeace', 'some comment')\n \n # read relationship\n try:\n res = self.c.package_relationship_register_get('annakarenina')\n assert self.c.last_status == 200, self.c.last_status\n rels = self.c.last_message\n assert len(rels) == 1, rels\n assert rels[0]['subject'] == 'annakarenina', rels[0]\n assert rels[0]['object'] == 'warandpeace', rels[0]\n assert rels[0]['type'] == 'child_of', rels[0]\n assert rels[0]['comment'] == 'some comment', rels[0]\n finally:\n self.delete_relationships()", "metadata": "root.TestCkanClient.test_12_package_relationship_get", "header": "['class', 'TestCkanClient', '(', 'CkanServerCase', ')', ':', '___EOS___']", "index": 285 }, { "content": " def test_13_package_relationship_put(self):\n # create relationship\n res = self.c.package_relationship_entity_post('annakarenina', 'child_of', 'warandpeace', 'some comment')\n # update relationship\n try:\n res = self.c.package_relationship_entity_put('annakarenina', 'child_of', 'warandpeace', 'new comment')\n assert self.c.last_status == 200, self.c.last_status\n\n # read relationship\n res = self.c.package_relationship_register_get('annakarenina')\n assert self.c.last_status == 200, self.c.last_status\n rels = self.c.last_message\n assert len(rels) == 1, rels\n assert rels[0]['comment'] == 'new comment', rels[0]\n finally:\n self.delete_relationships()", "metadata": "root.TestCkanClient.test_13_package_relationship_put", "header": "['class', 'TestCkanClient', '(', 'CkanServerCase', ')', ':', '___EOS___']", "index": 302 }, { "content": " def test_14_package_relationship_delete(self):\n # create relationship\n res = self.c.package_relationship_entity_post('annakarenina', 'child_of', 'warandpeace', 'some comment')\n try:\n self.c.package_relationship_entity_delete('annakarenina',\n 'child_of', 'warandpeace')\n\n # read relationship gives 404\n assert_raises(CkanApiError,\n self.c.package_relationship_register_get,\n 'annakarenina', 'child_of', 'warandpeace')\n assert self.c.last_status == 404, self.c.last_status\n\n # and register of relationships is blank\n res = self.c.package_relationship_register_get('annakarenina', 'relationships', 'warandpeace')\n assert self.c.last_status == 200, self.c.last_status\n assert not res, res\n finally:\n self.delete_relationships()", "metadata": "root.TestCkanClient.test_14_package_relationship_delete", "header": "['class', 'TestCkanClient', '(', 'CkanServerCase', ')', ':', '___EOS___']", "index": 319 } ]
[ { "span": "res ", "start_line": 274, "start_column": 8, "end_line": 274, "end_column": 11 }, { "span": "res ", "start_line": 287, "start_column": 8, "end_line": 287, "end_column": 11 }, { "span": "res ", "start_line": 304, "start_column": 8, "end_line": 304, "end_column": 11 }, { "span": "res ", "start_line": 307, "start_column": 12, "end_line": 307, "end_column": 15 }, { "span": "res ", "start_line": 321, "start_column": 8, "end_line": 321, "end_column": 11 } ]
[ { "span": "res ", "start_line": 279, "start_column": 8, "end_line": 279, "end_column": 11 }, { "span": "res ", "start_line": 291, "start_column": 12, "end_line": 291, "end_column": 15 }, { "span": "res ", "start_line": 311, "start_column": 12, "end_line": 311, "end_column": 15 }, { "span": "res ", "start_line": 333, "start_column": 12, "end_line": 333, "end_column": 15 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Ck", "an", "Client_", "(_", "Ck", "an", "Server", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "11", "\\u", "package", "\\u", "relation", "ship", "\\u", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "register", "\\u", "get_", "(_", "'", "anna", "kar", "eni", "na", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "c_", "._", "last", "\\u", "status_", "==_", "200_", ",_", "self_", "._", "c_", "._", "last", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "c_", "._", "last", "\\u", "message_", ",_", "self_", "._", "c_", "._", "last", "\\u", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "relationship_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "entity", "\\u", "post_", "(_", "'", "anna", "kar", "eni", "na", "'_", ",_", "'", "child", "\\u", "of", "'_", ",_", "'", "war", "and", "peac", "e", "'_", ",_", "'", "some", " ", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "c_", "._", "last", "\\u", "status_", "==_", "201_", ",_", "self_", "._", "c_", "._", "last", "\\u", "status_", "\\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_", "._", "delete", "\\u", "relationships_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ck", "an", "Client_", "(_", "Ck", "an", "Server", "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", "1", "2", "\\u", "package", "\\u", "relation", "ship", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "relationship_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "entity", "\\u", "post_", "(_", "'", "anna", "kar", "eni", "na", "'_", ",_", "'", "child", "\\u", "of", "'_", ",_", "'", "war", "and", "peac", "e", "'_", ",_", "'", "some", " ", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "relationship_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "register", "\\u", "get_", "(_", "'", "anna", "kar", "eni", "na", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "c_", "._", "last", "\\u", "status_", "==_", "200_", ",_", "self_", "._", "c_", "._", "last", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rels_", "=_", "self_", "._", "c_", "._", "last", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "rels_", ")_", "==_", "1_", ",_", "rels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rels_", "[_", "0_", "]_", "[_", "'", "subject", "'_", "]_", "==_", "'", "anna", "kar", "eni", "na", "'_", ",_", "rels_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rels_", "[_", "0_", "]_", "[_", "'", "object", "'_", "]_", "==_", "'", "war", "and", "peac", "e", "'_", ",_", "rels_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rels_", "[_", "0_", "]_", "[_", "'", "type", "'_", "]_", "==_", "'", "child", "\\u", "of", "'_", ",_", "rels_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rels_", "[_", "0_", "]_", "[_", "'", "comment", "'_", "]_", "==_", "'", "some", " ", "comment", "'_", ",_", "rels_", "[_", "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 ", " _", "self_", "._", "delete", "\\u", "relationships_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ck", "an", "Client_", "(_", "Ck", "an", "Server", "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", "13", "\\u", "package", "\\u", "relation", "ship", "\\u", "put_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "relationship_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "entity", "\\u", "post_", "(_", "'", "anna", "kar", "eni", "na", "'_", ",_", "'", "child", "\\u", "of", "'_", ",_", "'", "war", "and", "peac", "e", "'_", ",_", "'", "some", " ", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "relationship_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "entity", "\\u", "put_", "(_", "'", "anna", "kar", "eni", "na", "'_", ",_", "'", "child", "\\u", "of", "'_", ",_", "'", "war", "and", "peac", "e", "'_", ",_", "'", "new", " ", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "c_", "._", "last", "\\u", "status_", "==_", "200_", ",_", "self_", "._", "c_", "._", "last", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "relationship_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "register", "\\u", "get_", "(_", "'", "anna", "kar", "eni", "na", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "c_", "._", "last", "\\u", "status_", "==_", "200_", ",_", "self_", "._", "c_", "._", "last", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rels_", "=_", "self_", "._", "c_", "._", "last", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "rels_", ")_", "==_", "1_", ",_", "rels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rels_", "[_", "0_", "]_", "[_", "'", "comment", "'_", "]_", "==_", "'", "new", " ", "comment", "'_", ",_", "rels_", "[_", "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 ", " _", "self_", "._", "delete", "\\u", "relationships_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ck", "an", "Client_", "(_", "Ck", "an", "Server", "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", "14", "\\u", "package", "\\u", "relation", "ship", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "relationship_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "entity", "\\u", "post_", "(_", "'", "anna", "kar", "eni", "na", "'_", ",_", "'", "child", "\\u", "of", "'_", ",_", "'", "war", "and", "peac", "e", "'_", ",_", "'", "some", " ", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "entity", "\\u", "delete_", "(_", "'", "anna", "kar", "eni", "na", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "child", "\\u", "of", "'_", ",_", "'", "war", "and", "peac", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "relation", "ship", " ", "give", "s", " ", "404_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Ck", "an", "Ap", "i", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "register", "\\u", "get_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "anna", "kar", "eni", "na", "'_", ",_", "'", "child", "\\u", "of", "'_", ",_", "'", "war", "and", "peac", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "c_", "._", "last", "\\u", "status_", "==_", "404_", ",_", "self_", "._", "c_", "._", "last", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "register", " ", "of", " ", "relation", "ships", " ", "is", " ", "blank_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "c_", "._", "package", "\\u", "relation", "ship", "\\u", "register", "\\u", "get_", "(_", "'", "anna", "kar", "eni", "na", "'_", ",_", "'", "relation", "ships", "'_", ",_", "'", "war", "and", "peac", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "c_", "._", "last", "\\u", "status_", "==_", "200_", ",_", "self_", "._", "c_", "._", "last", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "res_", ",_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u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2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
DataDog/dogapi/tests/integration/test_dog_http_api.py
[ { "content": " @attr('dashboards')\n def test_dash(self):\n graph = {\n \"title\": \"test metric graph\",\n \"definition\":\n {\n \"requests\": [{\"q\": \"testing.metric.1{host:blah.host.1}\"}],\n \"viz\": \"timeseries\",\n }\n }\n\n dash_id = dog.create_dashboard('api dash', 'my api dash', [graph])\n remote_dash = dog.dashboard(dash_id)\n\n eq('api dash', remote_dash['title'])\n eq('my api dash', remote_dash['description'])\n eq(graph['definition']['requests'], remote_dash['graphs'][0]['definition']['requests'])\n\n graph = {\n \"title\": \"updated test metric graph\",\n \"definition\": {\n \"requests\": [{\"q\": \"testing.metric.1{host:blah.host.1}\"}],\n \"viz\": \"timeseries\",\n }\n }\n\n dash_id = dog.update_dashboard(dash_id, 'updated api dash',\n 'my updated api dash', [graph],\n template_variables=['foo', 'bar'])\n\n # Query and ensure all is well.\n remote_dash = dog.dashboard(dash_id)\n\n eq('updated api dash', remote_dash['title'])\n eq('my updated api dash', remote_dash['description'])\n self.assertEqual([\n {'default': None, 'name': 'foo', 'prefix': None},\n {'default': None, 'name': 'bar', 'prefix': None},\n ], remote_dash['template_variables'])\n\n p = graph['definition']['requests']\n eq(p, remote_dash['graphs'][0]['definition']['requests'])\n\n # Query all dashboards and make sure it's in there.\n\n dashes = dog.dashboards()\n ids = [dash[\"id\"] for dash in dashes]\n assert dash_id in ids or str(dash_id) in ids\n\n dog.delete_dashboard(dash_id)\n\n try:\n d = dog.dashboard(dash_id)\n except:\n pass\n else:\n # the previous get *should* throw an exception\n assert False", "metadata": "root.TestDatadog.test_dash", "header": "['class', 'TestDatadog', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 252 }, { "content": " def test_metrics(self):\n now = datetime.datetime.now()\n now_ts = int(time.mktime(now.timetuple()))\n\n dog.metric('test.metric.' + str(now_ts), 1, host=\"test.host.\" + str(now_ts))\n time.sleep(4)\n\n results = dog.search('metrics:test.metric.' + str(now_ts))\n # FIXME mattp: cache issue. move this test to server side.\n #assert len(results['metrics']) == 1, results\n\n matt_series = [\n (int(time.mktime((now - datetime.timedelta(minutes=25)).timetuple())), 5),\n (int(time.mktime((now - datetime.timedelta(minutes=25)).timetuple())) + 1, 15),\n (int(time.mktime((now - datetime.timedelta(minutes=24)).timetuple())), 10),\n (int(time.mktime((now - datetime.timedelta(minutes=23)).timetuple())), 15),\n (int(time.mktime((now - datetime.timedelta(minutes=23)).timetuple())) + 1, 5),\n (int(time.mktime((now - datetime.timedelta(minutes=22)).timetuple())), 5),\n (int(time.mktime((now - datetime.timedelta(minutes=20)).timetuple())), 15),\n (int(time.mktime((now - datetime.timedelta(minutes=18)).timetuple())), 5),\n (int(time.mktime((now - datetime.timedelta(minutes=17)).timetuple())), 5),\n (int(time.mktime((now - datetime.timedelta(minutes=17)).timetuple())) + 1, 15),\n (int(time.mktime((now - datetime.timedelta(minutes=15)).timetuple())), 15),\n (int(time.mktime((now - datetime.timedelta(minutes=15)).timetuple())) + 1, 5),\n (int(time.mktime((now - datetime.timedelta(minutes=14)).timetuple())), 5),\n (int(time.mktime((now - datetime.timedelta(minutes=14)).timetuple())) + 1, 15),\n (int(time.mktime((now - datetime.timedelta(minutes=12)).timetuple())), 15),\n (int(time.mktime((now - datetime.timedelta(minutes=12)).timetuple())) + 1, 5),\n (int(time.mktime((now - datetime.timedelta(minutes=11)).timetuple())), 5),\n ]\n\n dog.metric('matt.metric', matt_series, host=\"matt.metric.host\")\n\n dog.metrics({\n 'test.metric1': [(1000000000, 1), (1000000000, 2)],\n 'test.metric2': [(1000000000, 2), (1000000000, 4)],\n })", "metadata": "root.TestDatadog.test_metrics", "header": "['class', 'TestDatadog', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 316 }, { "content": " def test_user_error(self):\n query = \"avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 100\"\n\n dog.swallow = True\n dog.json_responses = True\n\n alert = dog.alert(query)\n assert 'id' in alert, alert\n result = dog.update_alert(alert['id'], 'aaa', silenced=True)\n assert 'errors' in result, result\n\n dog.swallow = True\n dog.json_responses = False\n\n alert_id = dog.alert(query)\n assert alert_id == int(alert_id), alert_id\n result = dog.update_alert(alert_id, 'aaa', silenced=True)\n assert 'errors' in result, result\n\n dog.swallow = False\n dog.json_responses = False\n\n alert_id = dog.alert(query)\n assert alert_id == int(alert_id), alert_id\n try:\n result = dog.update_alert(alert_id, 'aaa', silenced=True)\n except ApiError, e:\n pass\n else:\n raise False, \"Should have raised an exception\"", "metadata": "root.TestDatadog.test_user_error", "header": "['class', 'TestDatadog', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 400 }, { "content": " @attr('monitor')\n def test_service_check(self):\n res = dog.service_check('check_pg', 'host0', 1,\n message='PG is WARNING', tags=['db:prod_data'])", "metadata": "root.TestDatadog.test_service_check", "header": "['class', 'TestDatadog', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 710 } ]
[ { "span": "d ", "start_line": 304, "start_column": 12, "end_line": 304, "end_column": 13 }, { "span": "results ", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 15 }, { "span": "result ", "start_line": 425, "start_column": 12, "end_line": 425, "end_column": 18 }, { "span": "res ", "start_line": 712, "start_column": 8, "end_line": 712, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Data", "dog", "_", "(_", "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_", "@_", "attr_", "(_", "'", "dashboards", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "dash_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "title", "\"_", ":_", "\"", "test", " ", "metric", " ", "graph", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "definit", "ion", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "request", "s", "\"_", ":_", "[_", "{_", "\"", "q", "\"_", ":_", "\"", "testi", "ng", ".", "metric", ".1", "{", "host", ":", "bla", "h", ".", "host", ".1", "}\"_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "viz", "\"_", ":_", "\"", "times", "eries", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dash", "\\u", "id_", "=_", "dog", "_", "._", "create", "\\u", "dashboard_", "(_", "'", "api", " ", "dash", "'_", ",_", "'", "my", " ", "api", " ", "dash", "'_", ",_", "[_", "graph_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "dash_", "=_", "dog", "_", "._", "dashboard_", "(_", "dash", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq_", "(_", "'", "api", " ", "dash", "'_", ",_", "remote", "\\u", "dash_", "[_", "'", "title", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "'", "my", " ", "api", " ", "dash", "'_", ",_", "remote", "\\u", "dash_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "graph_", "[_", "'", "definit", "ion", "'_", "]_", "[_", "'", "request", "s", "'_", "]_", ",_", "remote", "\\u", "dash_", "[_", "'", "graph", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "definit", "ion", "'_", "]_", "[_", "'", "request", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "title", "\"_", ":_", "\"", "update", "d", " ", "test", " ", "metric", " ", "graph", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "definit", "ion", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "request", "s", "\"_", ":_", "[_", "{_", "\"", "q", "\"_", ":_", "\"", "testi", "ng", ".", "metric", ".1", "{", "host", ":", "bla", "h", ".", "host", ".1", "}\"_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "viz", "\"_", ":_", "\"", "times", "eries", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dash", "\\u", "id_", "=_", "dog", "_", "._", "update", "\\u", "dashboard_", "(_", "dash", "\\u", "id_", ",_", "'", "update", "d", " ", "api", " ", "dash", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "my", " ", "update", "d", " ", "api", " ", "dash", "'_", ",_", "[_", "graph_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "variables_", "=_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Query", " ", "and", " ", "ensure", " ", "all", " ", "is", " ", "well", "._", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "dash_", "=_", "dog", "_", "._", "dashboard_", "(_", "dash", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq_", "(_", "'", "update", "d", " ", "api", " ", "dash", "'_", ",_", "remote", "\\u", "dash_", "[_", "'", "title", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "'", "my", " ", "update", "d", " ", "api", " ", "dash", "'_", ",_", "remote", "\\u", "dash_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "default", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "'", "foo", "'_", ",_", "'", "prefix", "'_", ":_", "None_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "default", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "'", "bar", "'_", ",_", "'", "prefix", "'_", ":_", "None_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "remote", "\\u", "dash_", "[_", "'", "template", "\\u", "variab", "les", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "graph_", "[_", "'", "definit", "ion", "'_", "]_", "[_", "'", "request", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "p_", ",_", "remote", "\\u", "dash_", "[_", "'", "graph", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "definit", "ion", "'_", "]_", "[_", "'", "request", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Query", " ", "all", " ", "dashboards", " ", "and", " ", "make", " ", "sure", " ", "it", "'", "s", " ", "in", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dashes", "_", "=_", "dog", "_", "._", "dashboards", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "[_", "dash_", "[_", "\"", "id", "\"_", "]_", "for_", "dash_", "in_", "dashes", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dash", "\\u", "id_", "in_", "ids_", "or_", "str_", "(_", "dash", "\\u", "id_", ")_", "in_", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "delete", "\\u", "dashboard_", "(_", "dash", "\\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 ", " _", "d_", "=_", "dog", "_", "._", "dashboard_", "(_", "dash", "\\u", "id_", ")_", "\\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_", "#", " ", "the", " ", "previ", "ous", " ", "get", " ", "*", "shou", "ld", "*", " ", "throw", " ", "an", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Data", "dog", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "metrics_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now", "\\u", "ts_", "=_", "int_", "(_", "time_", "._", "mktime_", "(_", "now_", "._", "timetuple_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "metric_", "(_", "'", "test", ".", "metric", ".'_", "+_", "str_", "(_", "now", "\\u", "ts_", ")_", ",_", "1_", ",_", "host_", "=_", "\"", "test", ".", "host", ".\"_", "+_", "str_", "(_", "now", "\\u", "ts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "dog", "_", "._", "search_", "(_", "'", "metric", "s", ":", "test", ".", "metric", ".'_", "+_", "str_", "(_", "now", "\\u", "ts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "matt", "p", ":", " ", "cache", " ", "issue", ".", " ", "move", " ", "this", " ", "test", " ", "to", " ", "server", " ", "side", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", " ", "len", "(", "results", "['", "metric", "s", "'])", " ", "==", " ", "1", ",", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "matt", "\\u", "series_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "25_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "25_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", "+_", "1_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "24_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "23_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "23_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", "+_", "1_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "22_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "20_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "18_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "17_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "17_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", "+_", "1_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "15_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "15_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", "+_", "1_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "14_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "14_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", "+_", "1_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "12_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "12_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", "+_", "1_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "11_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "metric_", "(_", "'", "matt", ".", "metric", "'_", ",_", "matt", "\\u", "series_", ",_", "host_", "=_", "\"", "matt", ".", "metric", ".", "host", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "metrics_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", ".", "metric", "1", "'_", ":_", "[_", "(_", "1000000000", "_", ",_", "1_", ")_", ",_", "(_", "1000000000", "_", ",_", "2_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", ".", "metric", "2", "'_", ":_", "[_", "(_", "1000000000", "_", ",_", "2_", ")_", ",_", "(_", "1000000000", "_", ",_", "4_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Data", "dog", "_", "(_", "unittest_", "._", "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", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"", "avg", "(", "last", "\\u", "1", "h", "):", "sum", ":", "system", ".", "net", ".", "bytes", "\\u", "rcv", "d", "{", "host", ":", "host", "0", "}", " ", ">", " ", "100", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "swa", "llow", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dog", "_", "._", "json", "\\u", "responses_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alert_", "=_", "dog", "_", "._", "alert_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "id", "'_", "in_", "alert_", ",_", "alert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dog", "_", "._", "update", "\\u", "alert_", "(_", "alert_", "[_", "'", "id", "'_", "]_", ",_", "'", "aaa", "'_", ",_", "silence", "d_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "error", "s", "'_", "in_", "result_", ",_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "swa", "llow", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dog", "_", "._", "json", "\\u", "responses_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alert", "\\u", "id_", "=_", "dog", "_", "._", "alert_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert", "\\u", "id_", "==_", "int_", "(_", "alert", "\\u", "id_", ")_", ",_", "alert", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dog", "_", "._", "update", "\\u", "alert_", "(_", "alert", "\\u", "id_", ",_", "'", "aaa", "'_", ",_", "silence", "d_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "error", "s", "'_", "in_", "result_", ",_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "swa", "llow", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dog", "_", "._", "json", "\\u", "responses_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alert", "\\u", "id_", "=_", "dog", "_", "._", "alert_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert", "\\u", "id_", "==_", "int_", "(_", "alert", "\\u", "id_", ")_", ",_", "alert", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "dog", "_", "._", "update", "\\u", "alert_", "(_", "alert", "\\u", "id_", ",_", "'", "aaa", "'_", ",_", "silence", "d_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ap", "i", "Error_", ",_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "False_", ",_", "\"", "Sho", "ul", "d", " ", "have", " ", "raise", "d", " ", "an", " ", "exception", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Data", "dog", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "attr_", "(_", "'", "monit", "or", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "service", "\\u", "check_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "dog", "_", "._", "service", "\\u", "check_", "(_", "'", "check", "\\u", "pg", "'_", ",_", "'", "host", "0", "'_", ",_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "PG", " ", "is", " ", "WARN", "ING", "'_", ",_", "tags_", "=_", "[_", "'", "db", ":", "prod", "\\u", "data", "'_", "]_", ")_", "\\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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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, 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, 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, 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 ]
Unused import
CGATOxford/cgat/obsolete/Stats2Plot.py
[ { "content": "################################################################################\n#\n# MRC FGU Computational Genomics Group\n#\n# $Id$\n#\n# Copyright (C) 2009 Andreas Heger\n#\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2\n# of the License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n#################################################################################\n'''\nStats2Plot.py - \n======================================================\n\n:Author: Andreas Heger\n:Release: $Id$\n:Date: |today|\n:Tags: Python\n\nCode\n----\n\n'''\nimport sys\nimport os\nimport string\nimport re\n\nfrom Rsdb2Plot import Rsdb2Plot\n\n \n \n \n \n \n \n \n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Rsdb2Plot_test( Rsdb2Plot):\n\n", "metadata": "root.Rsdb2Plot_test", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def __init__( self, grap ):\n Rsdb2Plot.__init__( self, graph )", "metadata": "root.Rsdb2Plot_test.__init__", "header": "['class', 'Rsdb2Plot_test', '(', 'Rsdb2Plot', ')', ':', '___EOS___']", "index": 44 }, { "content": " def ParseColumns( self, columns ):\n return columns", "metadata": "root.Rsdb2Plot_test.ParseColumns", "header": "['class', 'Rsdb2Plot_test', '(', 'Rsdb2Plot', ')', ':', '___EOS___']", "index": 47 }, { "content": "class Rsdb2Plot_clustering ( Rsdb2Plot ):\n\n\n", "metadata": "root.Rsdb2Plot_clustering", "header": "['module', '___EOS___']", "index": 51 }, { "content": " def __init__( self, graph, columns ):\n Rsdb2Plot.__init__( self, graph )\n self.mColumns = columns", "metadata": "root.Rsdb2Plot_clustering.__init__", "header": "['class', 'Rsdb2Plot_clustering', '(', 'Rsdb2Plot', ')', ':', '___EOS___']", "index": 53 }, { "content": " def ParseHeader( self, line ):\n columns = string.split( line[:-1], \"\\t\")\n result = []\n for col in self.mColumns:\n result.append( columns[col] )\n \n self.mGraph.SetLegend( result )", "metadata": "root.Rsdb2Plot_clustering.ParseHeader", "header": "['class', 'Rsdb2Plot_clustering', '(', 'Rsdb2Plot', ')', ':', '___EOS___']", "index": 57 }, { "content": " def ParseColumns( self, columns ):\n result = []\n for col in self.mColumns:\n result.append( columns[col] )\n return result", "metadata": "root.Rsdb2Plot_clustering.ParseColumns", "header": "['class', 'Rsdb2Plot_clustering', '(', 'Rsdb2Plot', ')', ':', '___EOS___']", "index": 65 } ]
[ { "span": "import sys", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 10 }, { "span": "import os", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 9 }, { "span": "import re", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 9 } ]
[]
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_", "#", " ", " ", " ", "MR", "C", " ", "FG", "U", " ", "Computation", "al", " ", "Geno", "mic", "s", " ", "Group_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "$", "Id", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", " ", "Andre", "as", " ", "He", "ger_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ";", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "modif", "y", " ", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "as", " ", "publi", "shed", " ", "by", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ";", " ", "eit", "her", " ", "version", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "of", " ", "the", " ", "License", ",", " ", "or", " ", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Thi", "s", " ", "program", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "along", " ", "with", " ", "this", " ", "program", ";", " ", "if", " ", "not", ",", " ", "write", " ", "to", " ", "the", " ", "Free", " ", "Sof", "twa", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Foun", "dati", "on", ",", " ", "Inc", ".,", " ", "5", "9", " ", "Temp", "le", " ", "Place", " ", "-", " ", "Suit", "e", " ", "330", ",", " ", "Bo", "ston", ",", " ", "MA", " ", " ", "0211", "1", "-1", "307", ",", " ", "USA", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Stat", "s2", "Plot", ".", "py", " ", "-", " ", "\\", "10", ";", "==============", "==============", "==============", "============", "\\", "10", ";", "\\", "10", ";", ":", "Author", ":", " ", "Andre", "as", " ", "He", "ger", "\\", "10", ";", ":", "Release", ":", " ", "$", "Id", "$", "\\", "10", ";", ":", "Date", ":", " ", "|", "toda", "y", "|", "\\", "10", ";", ":", "Ta", "gs", ":", " ", "Pyth", "on", "\\", "10", ";", "\\", "10", ";", "Code", "\\", "10", ";", "----", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Rs", "db", "2", "Plot_", "import_", "Rs", "db", "2", "Plot_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Rs", "db", "2", "Plot", "\\u", "test_", "(_", "Rs", "db", "2", "Plot_", ")_", ":_", "\\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_", "Rs", "db", "2", "Plot", "\\u", "test_", "(_", "Rs", "db", "2", "Plot_", ")_", ":_", "\\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_", ",_", "gra", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Rs", "db", "2", "Plot_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "db", "2", "Plot", "\\u", "test_", "(_", "Rs", "db", "2", "Plot_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Columns_", "(_", "self_", ",_", "columns_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "columns_", "\\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_", "Rs", "db", "2", "Plot", "\\u", "clustering_", "(_", "Rs", "db", "2", "Plot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Rs", "db", "2", "Plot", "\\u", "clustering_", "(_", "Rs", "db", "2", "Plot_", ")_", ":_", "\\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_", ",_", "graph_", ",_", "columns_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Rs", "db", "2", "Plot_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "m", "Columns_", "=_", "columns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "db", "2", "Plot", "\\u", "clustering_", "(_", "Rs", "db", "2", "Plot_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Header_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "columns_", "=_", "string_", "._", "split_", "(_", "line_", "[_", ":_", "-_", "1_", "]_", ",_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col_", "in_", "self_", "._", "m", "Columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "columns_", "[_", "col_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "m", "Graph_", "._", "Set", "Legend", "_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rs", "db", "2", "Plot", "\\u", "clustering_", "(_", "Rs", "db", "2", "Plot_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Columns_", "(_", "self_", ",_", "columns_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col_", "in_", "self_", "._", "m", "Columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "columns_", "[_", "col_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_" ]
[ 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 ]
Unused local variable
mvantellingen/localshop/tests/apps/dashboard/test_forms.py
[ { "content": " def test_init(self):\n repository = RepositoryFactory()\n form = forms.RepositoryTeamForm(repository=repository)", "metadata": "root.TestRepositoryTeamForm.test_init", "header": "['class', 'TestRepositoryTeamForm', '(', 'TestCase', ')', ':', '___EOS___']", "index": 23 } ]
[ { "span": "form ", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Repos", "itor", "y", "Tea", "m", "Form_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repository_", "=_", "Repos", "itor", "y", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "forms_", "._", "Repos", "itor", "y", "Tea", "m", "Form_", "(_", "repository_", "=_", "repository_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
mopidy/mopidy/mopidy/audio/scan.py
[ { "content": " def scan(self, uri, timeout=None):\n \"\"\"\n Scan the given uri collecting relevant metadata.\n\n :param uri: URI of the resource to scan.\n :type uri: string\n :param timeout: timeout for scanning a URI in ms. Defaults to the\n ``timeout`` value used when creating the scanner.\n :type timeout: int\n :return: A named tuple containing\n ``(uri, tags, duration, seekable, mime)``.\n ``tags`` is a dictionary of lists for all the tags we found.\n ``duration`` is the length of the URI in milliseconds, or\n :class:`None` if the URI has no duration. ``seekable`` is boolean.\n indicating if a seek would succeed.\n \"\"\"\n timeout = int(timeout or self._timeout_ms)\n tags, duration, seekable, mime = None, None, None, None\n pipeline, signals = _setup_pipeline(uri, self._proxy_config)\n\n try:\n _start_pipeline(pipeline)\n tags, mime, have_audio, duration = _process(pipeline, timeout)\n seekable = _query_seekable(pipeline)\n finally:\n signals.clear()\n pipeline.set_state(Gst.State.NULL)\n del pipeline\n\n return _Result(uri, tags, duration, seekable, mime, have_audio)", "metadata": "root.Scanner.scan", "header": "['class', 'Scanner', '(', 'object', ')', ':', '___EOS___']", "index": 41 } ]
[ { "span": "tags,", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 12 }, { "span": "duration,", "start_line": 58, "start_column": 14, "end_line": 58, "end_column": 22 }, { "span": "seekable,", "start_line": 58, "start_column": 24, "end_line": 58, "end_column": 32 }, { "span": "mime ", "start_line": 58, "start_column": 34, "end_line": 58, "end_column": 38 } ]
[ { "span": "tags,", "start_line": 63, "start_column": 12, "end_line": 63, "end_column": 16 }, { "span": "mime,", "start_line": 63, "start_column": 18, "end_line": 63, "end_column": 22 }, { "span": "duration ", "start_line": 63, "start_column": 36, "end_line": 63, "end_column": 44 }, { "span": "seekable ", "start_line": 64, "start_column": 12, "end_line": 64, "end_column": 20 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Scanner_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "scan_", "(_", "self_", ",_", "uri_", ",_", "timeout_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sca", "n", " ", "the", " ", "give", "n", " ", "uri", " ", "collecti", "ng", " ", "rele", "van", "t", " ", "metadata", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "uri", ":", " ", "URI", " ", "of", " ", "the", " ", "resource", " ", "to", " ", "scan", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "uri", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "timeo", "ut", ":", " ", "timeo", "ut", " ", "for", " ", "scanning", " ", "a", " ", "URI", " ", "in", " ", "ms", ".", " ", "Default", "s", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "``", "timeo", "ut", "``", " ", "value", " ", "used", " ", "whe", "n", " ", "creati", "ng", " ", "the", " ", "scanner", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "timeo", "ut", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "A", " ", "named", " ", "tuple", " ", "contain", "ing", "\\", "10", ";", " ", " ", " ", " ", "``", "(", "uri", ",", " ", "tags", ",", " ", "duration", ",", " ", "seek", "able", ",", " ", "mime", ")``.", "\\", "10", ";", " ", " ", " ", " ", "``", "tags", "``", " ", "is", " ", "a", " ", "dictionar", "y", " ", "of", " ", "lists", " ", "for", " ", "all", " ", "the", " ", "tags", " ", "we", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "``", "duration", "``", " ", "is", " ", "the", " ", "length", " ", "of", " ", "the", " ", "URI", " ", "in", " ", "milliseconds", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", "Non", "e", "`", " ", "if", " ", "the", " ", "URI", " ", "has", " ", "no", " ", "duration", ".", " ", "``", "seek", "able", "``", " ", "is", " ", "boolean", ".", "\\", "10", ";", " ", " ", " ", " ", "indicati", "ng", " ", "if", " ", "a", " ", "seek", " ", "wou", "ld", " ", "succe", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timeout_", "=_", "int_", "(_", "timeout_", "or_", "self_", "._", "\\u", "timeo", "ut", "\\u", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", ",_", "duration_", ",_", "seek", "able_", ",_", "mime_", "=_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pipeline_", ",_", "signals_", "=_", "\\u", "setup", "\\u", "pipeline_", "(_", "uri_", ",_", "self_", "._", "\\u", "proxy", "\\u", "config_", ")_", "\\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 ", " _", "\\u", "start", "\\u", "pipeline_", "(_", "pipeline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", ",_", "mime_", ",_", "have", "\\u", "audio_", ",_", "duration_", "=_", "\\u", "process_", "(_", "pipeline_", ",_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seek", "able_", "=_", "\\u", "query", "\\u", "seek", "able_", "(_", "pipeline_", ")_", "\\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 ", " _", "signals_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pipeline_", "._", "set\\u", "state_", "(_", "Gst", "_", "._", "State_", "._", "NULL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "Result_", "(_", "uri_", ",_", "tags_", ",_", "duration_", ",_", "seek", "able_", ",_",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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, 0, 2, 0, 2, 0, 1, 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, 3, 2, 3, 2, 2, 2, 2, 2, 3, 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 ]
Unused import
baz/app-sales-machine/chart.py
[ { "content": "import sys\nimport settings\nimport models.data\nimport datetime\nfrom google.appengine.ext import db\nsys.path.insert(0, settings.APP_ROOT_DIR + '/lib')\nfrom graphy.backends import google_chart_api\nfrom graphy import formatters\nfrom graphy import line_chart\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SalesChart(object):\n", "metadata": "root.SalesChart", "header": "['module', '___EOS___']", "index": 10 }, { "content": "\tdef units_chart(self, pid):\n\t\toverall_chart = google_chart_api.LineChart()\n\n\t\tsales_query = db.Query(models.data.Sale)\n\t\tsales_query.filter('pid =', pid)\n\t\tsales_query.order('report_date')\n\t\tsales = []\n\t\tfor sale in sales_query:\n\t\t\tsales.append([sale.income_units, sale.report_date])\n\n\t\tif len(sales) == 0: return (None, None)\n\t\tsales, dates = zip(*sales)\n\n\t\t# Make dates readable\n\t\tdates = [date.strftime('%d %b') for date in dates]\n\n\t\t# Add sales line\n\t\toverall_chart.AddLine(sales, width=line_chart.LineStyle.THICK, label='Sales')\n\n\t\t# Determine if an upgrades line needs to be drawn\n\t\tsales_start = sales_query.get().report_date\n\t\t# Use settings file as the definitive source of upgrade start date because iTunes Connect sometimes reports false upgrade numbers\n\t\tversions = settings.PRODUCTS[pid]['versions']\n\t\tupgrades = []\n\t\tif len(versions) > 1:\n\t\t\t# Convert to datetime to allow for timedelta calculation\n\t\t\tupgrades_start = datetime.datetime.combine(versions[1]['date'], datetime.time(sales_start.hour, sales_start.minute))\n\t\t\tdifference_in_days = (upgrades_start - sales_start).days\n\n\t\t\tupgrades_query = db.Query(models.data.Upgrade)\n\t\t\tupgrades_query.filter('pid =', pid)\n\t\t\tupgrades_query.order('report_date')\n\t\t\tupgrades_query.filter('report_date >', upgrades_start)\n\n\t\t\t# Pad upgrades list with time before upgrade commenced\n\t\t\tfor i in range(0, difference_in_days):\n\t\t\t\tupgrades.append(0)\n\t\t\tfor upgrade in upgrades_query:\n\t\t\t\tupgrades.append(upgrade.income_units)\n\t\t\t# Add upgrades line\n\t\t\toverall_chart.AddLine(upgrades, width=line_chart.LineStyle.THICK, label='Upgrades')\n\n\t\t# Add horizontal labels\n\t\tmax_num_horizontal_labels = 15\n\t\tsegment_gap = 1\n\t\tif len(dates) > max_num_horizontal_labels:\n\t\t\tsegment_gap = len(dates) / max_num_horizontal_labels\n\n\t\toverall_chart.bottom.min = 0\n\t\toverall_chart.bottom.max = max_num_horizontal_labels\n\t\toverall_chart.bottom.labels = dates\n\t\toverall_chart.bottom.labels = dates[::segment_gap]\n\n\t\t# Add vertical labels\n\t\tmax_num_vertical_labels = 15\n\n\t\tmax_sales = 0\n\t\tmin_sales = 0\n\t\tmax_upgrades = 0\n\t\tmin_upgrades = 0\n\t\tif sales:\n\t\t\tmax_sales = max(sales)\n\t\t\tmin_sales = min(sales)\n\t\tif upgrades:\n\t\t\tmax_upgrades = max(upgrades)\n\t\t\tmin_upgrades = min(upgrades)\n\n\t\toverall_chart.left.max = max_upgrades if max_upgrades > max_sales else max_sales\n\t\toverall_chart.left.min = min_upgrades if min_upgrades < min_sales else min_sales\n\t\tvertical_labels = []\n\t\tsegment_gap = overall_chart.left.max / max_num_vertical_labels\n\t\tfor i in range(0, max_num_vertical_labels + 1):\n\t\t\tvertical_labels.append(i * segment_gap)\n\t\t\tif len(vertical_labels) == max_num_vertical_labels + 1: break\n\n\t\toverall_chart.left.labels = vertical_labels\n\t\toverall_chart.bottom.label_gridlines = True\n\n\t\t# Build concentrated chart if there is enough data for one\n\t\tconcentrated_chart = self.concentrated_units_chart(sales, upgrades, dates)\n\t\tif concentrated_chart != None:\n\t\t\tconcentrated_chart = concentrated_chart.display.Url(1000, 300)\n\n\t\treturn (overall_chart.display.Url(1000, 300), concentrated_chart)", "metadata": "root.SalesChart.units_chart", "header": "['class', 'SalesChart', '(', 'object', ')', ':', '___EOS___']", "index": 11 }, { "content": "\tdef concentrated_units_chart(self, sales, upgrades, dates):\n\t\t# Want results for the last 2 weeks\n\t\tconcentrated_result_set_num = 14\n\t\tconcentrated_chart = None\n\t\tif len(sales) > concentrated_result_set_num:\n\t\t\tconcentrated_chart = google_chart_api.LineChart()\n\t\t\t# Slice to create the line for the concentrated chart\n\t\t\tcalc_concentrated_result_set = lambda x: x[len(sales) - concentrated_result_set_num :len(sales)]\n\t\t\tsales_concentrated = calc_concentrated_result_set(sales)\n\t\t\tdates_concentrated = calc_concentrated_result_set(dates)\n\t\t\tupgrades_concentrated = calc_concentrated_result_set(upgrades)\n\n\t\t\tconcentrated_chart.AddLine(sales_concentrated, width=line_chart.LineStyle.THICK, label='Sales')\n\t\t\tif len(upgrades_concentrated) == concentrated_result_set_num - 1:\n\t\t\t\tconcentrated_chart.AddLine(upgrades_concentrated, width=line_chart.LineStyle.THICK, label='Upgrades')\n\n\t\t\tconcentrated_chart.left.min = 0\n\t\t\tmax_upgrades_concentrated = 0\n\t\t\tmax_sales_concentrated = 0\n\t\t\tif upgrades_concentrated:\n\t\t\t\tmax_upgrades_concentrated = max(upgrades_concentrated)\n\t\t\tif sales_concentrated:\n\t\t\t\tmax_sales_concentrated = max(sales_concentrated)\n\n\t\t\tconcentrated_chart.left.max = max_upgrades_concentrated if max_upgrades_concentrated > max_sales_concentrated else max_sales_concentrated\n\t\t\tsegment_gap = concentrated_chart.left.max / concentrated_result_set_num\n\t\t\tconcentrated_vertical_labels = []\n\n\t\t\tfor i in range(0, concentrated_result_set_num + 1):\n\t\t\t\tconcentrated_vertical_labels.append(i * segment_gap)\n\t\t\t\tif len(concentrated_vertical_labels) == concentrated_result_set_num + 1: break\n\t\t\tif concentrated_vertical_labels[-1] < concentrated_chart.left.max:\n\t\t\t\tnew_max = concentrated_vertical_labels[-1] + segment_gap\n\t\t\t\tconcentrated_vertical_labels.append(new_max)\n\t\t\t\tconcentrated_chart.left.max = new_max\n\n\t\t\tconcentrated_chart.left.labels = concentrated_vertical_labels\n\t\t\tconcentrated_chart.bottom.labels = dates_concentrated\n\t\t\tconcentrated_chart.left.label_gridlines = True\n\t\t\tconcentrated_chart.bottom.label_gridlines = True\n\t\t\treturn concentrated_chart\n\t\telse:\n\t\t\treturn None", "metadata": "root.SalesChart.concentrated_units_chart", "header": "['class', 'SalesChart', '(', 'object', ')', ':', '___EOS___']", "index": 96 } ]
[ { "span": "from graphy import formatters", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "models_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "settings_", "._", "APP", "\\u", "ROO", "T", "\\u", "DIR_", "+_", "'/", "lib", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "graphy_", "._", "backends_", "import_", "google", "\\u", "chart", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "graphy_", "import_", "formatters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "graphy_", "import_", "line", "\\u", "chart_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Sal", "es", "Chart_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sal", "es", "Chart_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "unit", "s", "\\u", "chart_", "(_", "self_", ",_", "pid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "over", "all", "\\u", "chart_", "=_", "google", "\\u", "chart", "\\u", "api_", "._", "Line", "Chart_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sales", "\\u", "query_", "=_", "db_", "._", "Query_", "(_", "models_", "._", "data_", "._", "Sal", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sales", "\\u", "query_", "._", "filter_", "(_", "'", "pid", " ", "='_", ",_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sales", "\\u", "query_", "._", "order_", "(_", "'", "report", "\\u", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sales", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sale_", "in_", "sales", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "sales", "_", "._", "append_", "(_", "[_", "sale_", "._", "income", "\\u", "units_", ",_", "sale_", "._", "report", "\\u", "date_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "sales", "_", ")_", "==_", "0_", ":_", "return_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sales", "_", ",_", "dates_", "=_", "zip_", "(_", "*_", "sales", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "dates", " ", "readable_", "\\u\\u\\uNL\\u\\u\\u_", "dates_", "=_", "[_", "date_", "._", "strftime_", "(_", "'%", "d", " ", "%", "b", "'_", ")_", "for_", "date_", "in_", "dates_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "sales", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "Add", "Line_", "(_", "sales", "_", ",_", "width_", "=_", "line", "\\u", "chart_", "._", "Line", "Style_", "._", "THI", "CK_", ",_", "label_", "=_", "'", "Sal", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "an", " ", "upgrade", "s", " ", "line", " ", "need", "s", " ", "to", " ", "be", " ", "draw", "n_", "\\u\\u\\uNL\\u\\u\\u_", "sales", "\\u", "start_", "=_", "sales", "\\u", "query_", "._", "get_", "(_", ")_", "._", "report", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "settings", " ", "file", " ", "as", " ", "the", " ", "definit", "ive", " ", "source", " ", "of", " ", "upgrade", " ", "start", " ", "date", " ", "bec", "aus", "e", " ", "i", "Tune", "s", " ", "Connect", " ", "somet", "imes", " ", "report", "s", " ", "fal", "se", " ", "upgrade", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "versions_", "=_", "settings_", "._", "PRODUCT", "S_", "[_", "pid_", "]_", "[_", "'", "version", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upgrade", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "versions_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", " ", "to", " ", "datetime", " ", "to", " ", "allow", " ", "for", " ", "timedelta", " ", "calculati", "on_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "upgrade", "s", "\\u", "start_", "=_", "datetime_", "._", "datetime_", "._", "combine_", "(_", "versions_", "[_", "1_", "]_", "[_", "'", "date", "'_", "]_", ",_", "datetime_", "._", "time_", "(_", "sales", "\\u", "start_", "._", "hour_", ",_", "sales", "\\u", "start_", "._", "minute_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "difference", "\\u", "in", "\\u", "days_", "=_", "(_", "upgrade", "s", "\\u", "start_", "-_", "sales", "\\u", "start_", ")_", "._", "days_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "upgrade", "s", "\\u", "query_", "=_", "db_", "._", "Query_", "(_", "models_", "._", "data_", "._", "Upgrade", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upgrade", "s", "\\u", "query_", "._", "filter_", "(_", "'", "pid", " ", "='_", ",_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upgrade", "s", "\\u", "query_", "._", "order_", "(_", "'", "report", "\\u", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upgrade", "s", "\\u", "query_", "._", "filter_", "(_", "'", "report", "\\u", "date", " ", ">'_", ",_", "upgrade", "s", "\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pad", " ", "upgrade", "s", " ", "list", " ", "with", " ", "time", " ", "bef", "ore", " ", "upgrade", " ", "comm", "ence", "d_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "difference", "\\u", "in", "\\u", "days_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "upgrade", "s_", "._", "append_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "upgrade_", "in_", "upgrade", "s", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "upgrade", "s_", "._", "append_", "(_", "upgrade_", "._", "income", "\\u", "units_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "upgrade", "s", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "Add", "Line_", "(_", "upgrade", "s_", ",_", "width_", "=_", "line", "\\u", "chart_", "._", "Line", "Style_", "._", "THI", "CK_", ",_", "label_", "=_", "'", "Upgrade", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "horizon", "tal", " ", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "max", "\\u", "num", "\\u", "horizon", "tal", "\\u", "labels_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segment", "\\u", "gap_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "dates_", ")_", ">_", "max", "\\u", "num", "\\u", "horizon", "tal", "\\u", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "segment", "\\u", "gap_", "=_", "len_", "(_", "dates_", ")_", "/_", "max", "\\u", "num", "\\u", "horizon", "tal", "\\u", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "bottom_", "._", "min_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "bottom_", "._", "max_", "=_", "max", "\\u", "num", "\\u", "horizon", "tal", "\\u", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "bottom_", "._", "labels_", "=_", "dates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "bottom_", "._", "labels_", "=_", "dates_", "[_", ":_", ":_", "segment", "\\u", "gap_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "vertical", " ", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "num", "\\u", "vertical", "\\u", "labels_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "sales", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "sales", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "upgrade", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "upgrade", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sales", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "max", "\\u", "sales", "_", "=_", "max_", "(_", "sales", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "sales", "_", "=_", "min_", "(_", "sales", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "upgrade", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "max", "\\u", "upgrade", "s_", "=_", "max_", "(_", "upgrade", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "upgrade", "s_", "=_", "min_", "(_", "upgrade", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "left_", "._", "max_", "=_", "max", "\\u", "upgrade", "s_", "if_", "max", "\\u", "upgrade", "s_", ">_", "max", "\\u", "sales", "_", "else_", "max", "\\u", "sales", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "left_", "._", "min_", "=_", "min", "\\u", "upgrade", "s_", "if_", "min", "\\u", "upgrade", "s_", "<_", "min", "\\u", "sales", "_", "else_", "min", "\\u", "sales", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertical", "\\u", "labels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segment", "\\u", "gap_", "=_", "over", "all", "\\u", "chart_", "._", "left_", "._", "max_", "/_", "max", "\\u", "num", "\\u", "vertical", "\\u", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "max", "\\u", "num", "\\u", "vertical", "\\u", "labels_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vertical", "\\u", "labels_", "._", "append_", "(_", "i_", "*_", "segment", "\\u", "gap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "vertical", "\\u", "labels_", ")_", "==_", "max", "\\u", "num", "\\u", "vertical", "\\u", "labels_", "+_", "1_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "left_", "._", "labels_", "=_", "vertical", "\\u", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "chart_", "._", "bottom_", "._", "label", "\\u", "gridl", "ines_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "conce", "ntra", "ted", " ", "chart", " ", "if", " ", "there", " ", "is", " ", "eno", "ugh", " ", "data", " ", "for", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "=_", "self_", "._", "conce", "ntra", "ted", "\\u", "unit", "s", "\\u", "chart_", "(_", "sales", "_", ",_", "upgrade", "s_", ",_", "dates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "conce", "ntra", "ted", "\\u", "chart_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "conce", "ntra", "ted", "\\u", "chart_", "=_", "conce", "ntra", "ted", "\\u", "chart_", "._", "display_", "._", "Url_", "(_", "1000_", ",_", "300_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "over", "all", "\\u", "chart_", "._", "display_", "._", "Url_", "(_", "1000_", ",_", "300_", ")_", ",_", "conce", "ntra", "ted", "\\u", "chart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sal", "es", "Chart_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "conce", "ntra", "ted", "\\u", "unit", "s", "\\u", "chart_", "(_", "self_", ",_", "sales", "_", ",_", "upgrade", "s_", ",_", "dates_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wan", "t", " ", "results", " ", "for", " ", "the", " ", "last", " ", "2", " ", "weeks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "conce", "ntra", "ted", "\\u", "result", "\\u", "set\\u", "num_", "=_", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "sales", "_", ")_", ">_", "conce", "ntra", "ted", "\\u", "result", "\\u", "set\\u", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "conce", "ntra", "ted", "\\u", "chart_", "=_", "google", "\\u", "chart", "\\u", "api_", "._", "Line", "Chart_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Slice", " ", "to", " ", "create", " ", "the", " ", "line", " ", "for", " ", "the", " ", "conce", "ntra", "ted", " ", "chart_", "\\u\\u\\uNL\\u\\u\\u_", "calc", "\\u", "conce", "ntra", "ted", "\\u", "result", "\\u", "set_", "=_", "lambda_", "x_", ":_", "x_", "[_", "len_", "(_", "sales", "_", ")_", "-_", "conce", "ntra", "ted", "\\u", "result", "\\u", "set\\u", "num_", ":_", "len_", "(_", "sales", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sales", "\\u", "conce", "ntra", "ted_", "=_", "calc", "\\u", "conce", "ntra", "ted", "\\u", "result", "\\u", "set_", "(_", "sales", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dates", "\\u", "conce", "ntra", "ted_", "=_", "calc", "\\u", "conce", "ntra", "ted", "\\u", "result", "\\u", "set_", "(_", "dates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upgrade", "s", "\\u", "conce", "ntra", "ted_", "=_", "calc", "\\u", "conce", "ntra", "ted", "\\u", "result", "\\u", "set_", "(_", "upgrade", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "._", "Add", "Line_", "(_", "sales", "\\u", "conce", "ntra", "ted_", ",_", "width_", "=_", "line", "\\u", "chart_", "._", "Line", "Style_", "._", "THI", "CK_", ",_", "label_", "=_", "'", "Sal", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "upgrade", "s", "\\u", "conce", "ntra", "ted_", ")_", "==_", "conce", "ntra", "ted", "\\u", "result", "\\u", "set\\u", "num_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "conce", "ntra", "ted", "\\u", "chart_", "._", "Add", "Line_", "(_", "upgrade", "s", "\\u", "conce", "ntra", "ted_", ",_", "width_", "=_", "line", "\\u", "chart_", "._", "Line", "Style_", "._", "THI", "CK_", ",_", "label_", "=_", "'", "Upgrade", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "._", "left_", "._", "min_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "upgrade", "s", "\\u", "conce", "ntra", "ted_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "sales", "\\u", "conce", "ntra", "ted_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "upgrade", "s", "\\u", "conce", "ntra", "ted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "max", "\\u", "upgrade", "s", "\\u", "conce", "ntra", "ted_", "=_", "max_", "(_", "upgrade", "s", "\\u", "conce", "ntra", "ted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sales", "\\u", "conce", "ntra", "ted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "max", "\\u", "sales", "\\u", "conce", "ntra", "ted_", "=_", "max_", "(_", "sales", "\\u", "conce", "ntra", "ted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "._", "left_", "._", "max_", "=_", "max", "\\u", "upgrade", "s", "\\u", "conce", "ntra", "ted_", "if_", "max", "\\u", "upgrade", "s", "\\u", "conce", "ntra", "ted_", ">_", "max", "\\u", "sales", "\\u", "conce", "ntra", "ted_", "else_", "max", "\\u", "sales", "\\u", "conce", "ntra", "ted_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segment", "\\u", "gap_", "=_", "conce", "ntra", "ted", "\\u", "chart_", "._", "left_", "._", "max_", "/_", "conce", "ntra", "ted", "\\u", "result", "\\u", "set\\u", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "vertical", "\\u", "labels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "conce", "ntra", "ted", "\\u", "result", "\\u", "set\\u", "num_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "conce", "ntra", "ted", "\\u", "vertical", "\\u", "labels_", "._", "append_", "(_", "i_", "*_", "segment", "\\u", "gap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "conce", "ntra", "ted", "\\u", "vertical", "\\u", "labels_", ")_", "==_", "conce", "ntra", "ted", "\\u", "result", "\\u", "set\\u", "num_", "+_", "1_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "conce", "ntra", "ted", "\\u", "vertical", "\\u", "labels_", "[_", "-_", "1_", "]_", "<_", "conce", "ntra", "ted", "\\u", "chart_", "._", "left_", "._", "max_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "new", "\\u", "max_", "=_", "conce", "ntra", "ted", "\\u", "vertical", "\\u", "labels_", "[_", "-_", "1_", "]_", "+_", "segment", "\\u", "gap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "vertical", "\\u", "labels_", "._", "append_", "(_", "new", "\\u", "max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "._", "left_", "._", "max_", "=_", "new", "\\u", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "._", "left_", "._", "labels_", "=_", "conce", "ntra", "ted", "\\u", "vertical", "\\u", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "._", "bottom_", "._", "labels_", "=_", "dates", "\\u", "conce", "ntra", "ted_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "._", "left_", "._", "label", "\\u", "gridl", "ines_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conce", "ntra", "ted", "\\u", "chart_", "._", "bottom_", "._", "label", "\\u", "gridl", "ines_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "conce", "ntra", "ted", "\\u", "chart_", "\\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\t", "\t\t_", "return_", "None_" ]
[ 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, 0, 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, 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,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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 ]
Variable defined multiple times
neuropoly/spinalcordtoolbox/scripts/sct_dmri_eddy_correct.py
[ { "content": "def eddy_correct(param):\n\n sct.printv('\\n\\n\\n\\n===================================================',param.verbose)\n sct.printv(' Running: eddy_correct', param.verbose)\n sct.printv('===================================================\\n',param.verbose)\n\n fname_data = param.fname_data\n min_norm = param.min_norm\n cost_function = param.cost_function_flirt\n verbose = param.verbose\n \n sct.printv(('Input File:'+ param.fname_data),verbose)\n sct.printv(('Bvecs File:' + param.fname_bvecs),verbose)\n \n #Extract path, file and extension\n path_data, file_data, ext_data = sct.extract_fname(fname_data)\n \n if param.mat_eddy=='': param.mat_eddy= 'mat_eddy/'\n if not os.path.exists(param.mat_eddy): os.makedirs(param.mat_eddy)\n mat_eddy = param.mat_eddy\n \n #Schedule file for FLIRT\n schedule_file = path_sct + '/flirtsch/schedule_TxTy_2mmScale.sch'\n sct.printv(('\\n.. Schedule file: '+ schedule_file),verbose)\n\n #Swap X-Y dimension (to have X as phase-encoding direction)\n if param.swapXY==1:\n sct.printv('\\nSwap X-Y dimension (to have X as phase-encoding direction)',verbose)\n fname_data_new = 'tmp.data_swap'\n cmd = fsloutput + 'fslswapdim ' + fname_data + ' -y -x -z ' + fname_data_new\n status, output = sct.run(cmd,verbose)\n sct.printv(('\\n.. updated data file name: '+fname_data_new),verbose)\n else:\n fname_data_new = fname_data\n\n # Get size of data\n sct.printv('\\nGet dimensions data...',verbose)\n nx, ny, nz, nt, px, py, pz, pt = Image(fname_data).dim\n sct.printv('.. '+str(nx)+' x '+str(ny)+' x '+str(nz)+' x '+str(nt),verbose)\n\n # split along T dimension\n sct.printv('\\nSplit along T dimension...',verbose)\n from sct_image import split_data\n im_to_split = Image(fname_data_new+'.nii')\n im_split_list = split_data(im_to_split, 3)\n for im in im_split_list:\n im.save()\n\n # cmd = fsloutput + 'fslsplit ' + fname_data_new + ' ' + file_data + '_T'\n # status, output = sct.run(cmd,verbose)\n\n #Slice-wise or Volume based method\n if param.slicewise:\n nb_loops = nz\n file_suffix=[]\n for iZ in range(nz):\n file_suffix.append('_Z'+ str(iZ).zfill(4))\n else:\n nb_loops = 1\n file_suffix = ['']\n\n # Identify pairs of opposite gradient directions\n sct.printv('\\nIdentify pairs of opposite gradient directions...',verbose)\n\n # Open bvecs file\n sct.printv('\\nOpen bvecs file...',verbose)\n bvecs = []\n with open(param.fname_bvecs) as f:\n for line in f:\n bvecs_new = map(float, line.split())\n bvecs.append(bvecs_new)\n\n # Check if bvecs file is nx3\n if not len(bvecs[0][:]) == 3:\n sct.printv('.. WARNING: bvecs file is 3xn instead of nx3. Consider using sct_dmri_transpose_bvecs.',verbose)\n sct.printv('Transpose bvecs...',verbose)\n # transpose bvecs\n bvecs = zip(*bvecs)\n bvecs = np.array(bvecs)\n\n opposite_gradients_iT = []\n opposite_gradients_jT = []\n index_identified = []\n index_b0 = []\n for iT in range(nt-1):\n if np.linalg.norm(bvecs[iT,:])!=0:\n if iT not in index_identified:\n jT = iT+1\n if np.linalg.norm((bvecs[iT,:]+bvecs[jT,:]))<min_norm:\n sct.printv(('.. Opposite gradient for #'+str(iT)+' is: #'+str(jT)),verbose)\n opposite_gradients_iT.append(iT)\n opposite_gradients_jT.append(jT)\n index_identified.append(iT)\n else:\n index_b0.append(iT)\n sct.printv(('.. Opposite gradient for #'+str(iT)+' is: NONE (b=0)'),verbose)\n nb_oppositeGradients = len(opposite_gradients_iT)\n sct.printv(('.. Number of gradient directions: ' + str(2*nb_oppositeGradients) + ' (2*' + str(nb_oppositeGradients) + ')'),verbose)\n sct.printv('.. Index b=0: '+ str(index_b0),verbose)\n\n\n # =========================================================================\n #\tFind transformation\n # =========================================================================\n for iN in range(nb_oppositeGradients):\n i_plus = opposite_gradients_iT[iN]\n i_minus = opposite_gradients_jT[iN]\n\n sct.printv(('\\nFinding affine transformation between volumes #'+str(i_plus)+' and #'+str(i_minus)+' (' + str(iN)+'/'+str(nb_oppositeGradients)+')'),verbose)\n sct.printv('------------------------------------------------------------------------------------\\n',verbose)\n \n #Slicewise correction\n if param.slicewise:\n sct.printv('\\nSplit volumes across Z...',verbose)\n fname_plus = file_data + '_T' + str(i_plus).zfill(4)\n fname_plus_Z = file_data + '_T' + str(i_plus).zfill(4) + '_Z'\n im_plus = Image(fname_plus+'.nii')\n im_plus_split_list = split_data(im_plus, 2)\n for im_p in im_plus_split_list:\n im_p.save()\n # cmd = fsloutput + 'fslsplit ' + fname_plus + ' ' + fname_plus_Z + ' -z'\n # status, output = sct.run(cmd,verbose)\n\n fname_minus = file_data + '_T' + str(i_minus).zfill(4)\n fname_minus_Z = file_data + '_T' + str(i_minus).zfill(4) + '_Z'\n im_minus = Image(fname_minus+'.nii')\n im_minus_split_list = split_data(im_minus, 2)\n for im_m in im_minus_split_list:\n im_m.save() # cmd = fsloutput + 'fslsplit ' + fname_minus + ' ' + fname_minus_Z + ' -z'\n # status, output = sct.run(cmd,verbose)\n\n #loop across Z\n for iZ in range(nb_loops):\n fname_plus = file_data + '_T' + str(i_plus).zfill(4) + file_suffix[iZ]\n\n fname_minus = file_data + '_T' + str(i_minus).zfill(4) + file_suffix[iZ]\n #Find transformation on opposite gradient directions\n sct.printv('\\nFind transformation for each pair of opposite gradient directions...',verbose)\n fname_plus_corr = file_data + '_T' + str(i_plus).zfill(4) + file_suffix[iZ] + '_corr_'\n omat = 'mat_' + file_data + '_T' + str(i_plus).zfill(4) + file_suffix[iZ] + '.txt'\n cmd = fsloutput+'flirt -in '+fname_plus+' -ref '+fname_minus+' -paddingsize 3 -schedule '+schedule_file+' -verbose 2 -omat '+omat+' -cost '+cost_function+' -forcescaling'\n status, output = sct.run(cmd,verbose)\n\n file = open(omat)\n Matrix = np.loadtxt(file)\n file.close()\n M = Matrix[0:4,0:4]\n sct.printv(('.. Transformation matrix:\\n'+str(M)),verbose)\n sct.printv(('.. Output matrix file: '+omat),verbose)\n\n # Divide affine transformation by two\n sct.printv('\\nDivide affine transformation by two...',verbose)\n A = (M - np.identity(4))/2\n Mplus = np.identity(4)+A\n omat_plus = mat_eddy + 'mat.T' + str(i_plus) + '_Z' + str(iZ) + '.txt'\n file = open(omat_plus,'w')\n np.savetxt(omat_plus, Mplus, fmt='%.6e', delimiter=' ', newline='\\n', header='', footer='', comments='#')\n file.close()\n sct.printv(('.. Output matrix file (plus): '+omat_plus),verbose)\n\n Mminus = np.identity(4)-A\n omat_minus = mat_eddy + 'mat.T' + str(i_minus) + '_Z' + str(iZ) + '.txt'\n file = open(omat_minus,'w')\n np.savetxt(omat_minus, Mminus, fmt='%.6e', delimiter=' ', newline='\\n', header='', footer='', comments='#')\n file.close()\n sct.printv(('.. Output matrix file (minus): '+omat_minus),verbose)\n\n # =========================================================================\n #\tApply affine transformation\n # =========================================================================\n\n sct.printv('\\nApply affine transformation matrix',verbose)\n sct.printv('------------------------------------------------------------------------------------\\n',verbose)\n\n for iN in range(nb_oppositeGradients):\n for iFile in range(2):\n if iFile==0:\n i_file = opposite_gradients_iT[iN]\n else:\n i_file = opposite_gradients_jT[iN]\n\n for iZ in range(nb_loops):\n fname = file_data + '_T' + str(i_file).zfill(4) + file_suffix[iZ]\n fname_corr = fname + '_corr_' + '__div2'\n omat = mat_eddy + 'mat.T' + str(i_file) + '_Z' + str(iZ) + '.txt'\n cmd = fsloutput + 'flirt -in ' + fname + ' -ref ' + fname + ' -out ' + fname_corr + ' -init ' + omat + ' -applyxfm -paddingsize 3 -interp ' + param.interp\n status, output = sct.run(cmd,verbose)\n\n \n # =========================================================================\n #\tMerge back across Z\n # =========================================================================\n\n sct.printv('\\nMerge across Z',verbose)\n sct.printv('------------------------------------------------------------------------------------\\n',verbose)\n\n for iN in range(nb_oppositeGradients):\n i_plus = opposite_gradients_iT[iN]\n fname_plus_corr = file_data + '_T' + str(i_plus).zfill(4) + '_corr_' + '__div2'\n cmd = fsloutput + 'fslmerge -z ' + fname_plus_corr\n\n for iZ in range(nz):\n fname_plus_Z_corr = file_data + '_T' + str(i_plus).zfill(4) + file_suffix[iZ] + '_corr_' + '__div2'\n cmd = cmd + ' ' + fname_plus_Z_corr\n status, output = sct.run(cmd,verbose)\n\n i_minus = opposite_gradients_jT[iN]\n fname_minus_corr = file_data + '_T' + str(i_minus).zfill(4) + '_corr_' + '__div2'\n cmd = fsloutput + 'fslmerge -z ' + fname_minus_corr\n\n for iZ in range(nz):\n fname_minus_Z_corr = file_data + '_T' + str(i_minus).zfill(4) + file_suffix[iZ] + '_corr_' + '__div2'\n cmd = cmd + ' ' + fname_minus_Z_corr\n status, output = sct.run(cmd,verbose)\n\n # =========================================================================\n #\tMerge files back\n # =========================================================================\n sct.printv('\\nMerge back across T...',verbose)\n sct.printv('------------------------------------------------------------------------------------\\n',verbose)\n \n fname_data_corr = param.output_path + file_data + '_eddy'\n cmd = fsloutput + 'fslmerge -t ' + fname_data_corr\n path_tmp = os.getcwd()\n for iT in range(nt):\n if os.path.isfile((path_tmp + '/' + file_data + '_T' + str(iT).zfill(4) + '_corr_' + '__div2.nii')):\n fname_data_corr_3d = file_data + '_T' + str(iT).zfill(4) + '_corr_' + '__div2'\n elif iT in index_b0:\n fname_data_corr_3d = file_data + '_T' + str(iT).zfill(4)\n \n cmd = cmd + ' ' + fname_data_corr_3d\n status, output = sct.run(cmd,verbose)\n\n #Swap back X-Y dimensions\n if param.swapXY==1:\n fname_data_final = fname_data\n sct.printv('\\nSwap back X-Y dimensions',verbose)\n cmd = fsloutput_temp + 'fslswapdim ' + fname_data_corr + ' -y -x -z ' + fname_data_final\n status, output = sct.run(cmd,verbose)\n else:\n fname_data_final = fname_data_corr\n\n sct.printv(('... File created: '+fname_data_final),verbose)\n \n sct.printv('\\n===================================================',verbose)\n sct.printv(' Completed: eddy_correct',verbose)\n sct.printv('===================================================\\n\\n\\n',verbose)", "metadata": "root.eddy_correct", "header": "['module', '___EOS___']", "index": 118 } ]
[ { "span": "status,", "start_line": 148, "start_column": 8, "end_line": 148, "end_column": 14 }, { "span": "output ", "start_line": 148, "start_column": 16, "end_line": 148, "end_column": 22 }, { "span": "fname_plus_corr ", "start_line": 256, "start_column": 12, "end_line": 256, "end_column": 27 }, { "span": "status,", "start_line": 259, "start_column": 12, "end_line": 259, "end_column": 18 }, { "span": "output ", "start_line": 259, "start_column": 20, "end_line": 259, "end_column": 26 }, { "span": "status,", "start_line": 304, "start_column": 16, "end_line": 304, "end_column": 22 }, { "span": "output ", "start_line": 304, "start_column": 24, "end_line": 304, "end_column": 30 }, { "span": "status,", "start_line": 322, "start_column": 8, "end_line": 322, "end_column": 14 }, { "span": "output ", "start_line": 322, "start_column": 16, "end_line": 322, "end_column": 22 }, { "span": "status,", "start_line": 331, "start_column": 8, "end_line": 331, "end_column": 14 }, { "span": "output ", "start_line": 331, "start_column": 16, "end_line": 331, "end_column": 22 }, { "span": "status,", "start_line": 349, "start_column": 4, "end_line": 349, "end_column": 10 }, { "span": "output ", "start_line": 349, "start_column": 12, "end_line": 349, "end_column": 18 } ]
[ { "span": "fname_plus_corr ", "start_line": 316, "start_column": 8, "end_line": 316, "end_column": 23 }, { "span": "status,", "start_line": 356, "start_column": 8, "end_line": 356, "end_column": 14 }, { "span": "output ", "start_line": 356, "start_column": 16, "end_line": 356, "end_column": 22 } ]
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_", "def_", "edd", "y", "\\u", "correct_", "(_", "param_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "\\\\", "n", "\\\\", "n", "\\\\", "n", "==============", "==============", "==============", "=========", "'_", ",_", "param_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", " ", " ", " ", " ", " ", " ", "Run", "ning", ":", " ", "edd", "y", "\\u", "correct", "'_", ",_", "param_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'===", "==============", "==============", "==============", "=====", "=\\\\", "n", "'_", ",_", "param_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fname", "\\u", "data_", "=_", "param_", "._", "fname", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "norm_", "=_", "param_", "._", "min", "\\u", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost", "\\u", "function_", "=_", "param_", "._", "cost", "\\u", "function", "\\u", "fli", "rt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbose_", "=_", "param_", "._", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'", "Inp", "ut", " ", "File", ":'_", "+_", "param_", "._", "fname", "\\u", "data_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'", "Bv", "ecs", " ", "File", ":'_", "+_", "param_", "._", "fname", "\\u", "bv", "ecs_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Extract", " ", "path", ",", " ", "file", " ", "and", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "path", "\\u", "data_", ",_", "file", "\\u", "data_", ",_", "ext", "\\u", "data_", "=_", "sct", "_", "._", "extract", "\\u", "fname_", "(_", "fname", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "mat", "\\u", "edd", "y_", "==_", "''_", ":_", "param_", "._", "mat", "\\u", "edd", "y_", "=_", "'", "mat", "\\u", "edd", "y", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "param_", "._", "mat", "\\u", "edd", "y_", ")_", ":_", "os_", "._", "makedirs_", "(_", "param_", "._", "mat", "\\u", "edd", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mat", "\\u", "edd", "y_", "=_", "param_", "._", "mat", "\\u", "edd", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Schedule", " ", "file", " ", "for", " ", "FLI", "RT_", "\\u\\u\\uNL\\u\\u\\u_", "schedule", "\\u", "file_", "=_", "path", "\\u", "sct", "_", "+_", "'/", "fli", "rts", "ch", "/", "schedule", "\\u", "Tx", "Ty", "\\u", "2m", "m", "Scale", ".", "sch", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'\\\\", "n", "..", " ", "Schedule", " ", "file", ":", " ", "'_", "+_", "schedule", "\\u", "file_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Swa", "p", " ", "X", "-", "Y", " ", "dimension", " ", "(", "to", " ", "have", " ", "X", " ", "as", " ", "phase", "-", "encoding", " ", "direction", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "swap", "XY_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Swa", "p", " ", "X", "-", "Y", " ", "dimension", " ", "(", "to", " ", "have", " ", "X", " ", "as", " ", "phase", "-", "encoding", " ", "direction", ")'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "data\\u", "new_", "=_", "'", "tmp", ".", "data\\u", "swap", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "ls", "wap", "dim", " ", "'_", "+_", "fname", "\\u", "data_", "+_", "'", " ", "-", "y", " ", "-", "x", " ", "-", "z", " ", "'_", "+_", "fname", "\\u", "data\\u", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'\\\\", "n", "..", " ", "update", "d", " ", "data", " ", "file", " ", "name", ":", " ", "'_", "+_", "fname", "\\u", "data\\u", "new_", ")_", ",_", "verbose_", ")_", "\\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 ", " _", "fname", "\\u", "data\\u", "new_", "=_", "fname", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "size", " ", "of", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Get", " ", "dimension", "s", " ", "data", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx_", ",_", "ny_", ",_", "nz_", ",_", "nt_", ",_", "px_", ",_", "py_", ",_", "pz", "_", ",_", "pt_", "=_", "Image_", "(_", "fname", "\\u", "data_", ")_", "._", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'..", " ", "'_", "+_", "str_", "(_", "nx_", ")_", "+_", "'", " ", "x", " ", "'_", "+_", "str_", "(_", "ny_", ")_", "+_", "'", " ", "x", " ", "'_", "+_", "str_", "(_", "nz_", ")_", "+_", "'", " ", "x", " ", "'_", "+_", "str_", "(_", "nt_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "split", " ", "along", " ", "T", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Split", " ", "along", " ", "T", " ", "dimension", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sct", "\\u", "image_", "import_", "split", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "to", "\\u", "split_", "=_", "Image_", "(_", "fname", "\\u", "data\\u", "new_", "+_", "'.", "ni", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "split", "\\u", "list_", "=_", "split", "\\u", "data_", "(_", "im", "\\u", "to", "\\u", "split_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "im_", "in_", "im", "\\u", "split", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cmd", " ", "=", " ", "fs", "lou", "tpu", "t", " ", "+", " ", "'", "fs", "lsp", "lit", " ", "'", " ", "+", " ", "fname", "\\u", "data\\u", "new", " ", "+", " ", "'", " ", "'", " ", "+", " ", "file", "\\u", "data", " ", "+", " ", "'\\u", "T", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", ",", " ", "output", " ", "=", " ", "sct", ".", "run", "(", "cmd", ",", "verbo", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Slice", "-", "wis", "e", " ", "or", " ", "Volume", " ", "based", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "param_", "._", "slice", "wise_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nb", "\\u", "loops_", "=_", "nz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "suffix_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "suffix_", "._", "append_", "(_", "'\\u", "Z", "'_", "+_", "str_", "(_", "i", "Z_", ")_", "._", "zfill_", "(_", "4_", ")_", ")_", "\\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 ", " _", "nb", "\\u", "loops_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "suffix_", "=_", "[_", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Identif", "y", " ", "pair", "s", " ", "of", " ", "opposite", " ", "gradi", "ent", " ", "directions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Identif", "y", " ", "pair", "s", " ", "of", " ", "opposite", " ", "gradi", "ent", " ", "direction", "s", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "bv", "ecs", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Open", " ", "bv", "ecs", " ", "file", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bv", "ecs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "param_", "._", "fname", "\\u", "bv", "ecs_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bv", "ecs", "\\u", "new_", "=_", "map_", "(_", "float_", ",_", "line_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bv", "ecs_", "._", "append_", "(_", "bv", "ecs", "\\u", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "bv", "ecs", " ", "file", " ", "is", " ", "nx", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "bv", "ecs_", "[_", "0_", "]_", "[_", ":_", "]_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'..", " ", "WARN", "ING", ":", " ", "bv", "ecs", " ", "file", " ", "is", " ", "3x", "n", " ", "inst", "ead", " ", "of", " ", "nx", "3", ".", " ", "Consider", " ", "usi", "ng", " ", "sct", "\\u", "dmr", "i", "\\u", "transpose", "\\u", "bv", "ecs", ".'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", "Transpose", " ", "bv", "ecs", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "transpose", " ", "bv", "ecs_", "\\u\\u\\uNL\\u\\u\\u_", "bv", "ecs_", "=_", "zip_", "(_", "*_", "bv", "ecs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bv", "ecs_", "=_", "np_", "._", "array_", "(_", "bv", "ecs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "identifi", "ed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "b0_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "T_", "in_", "range_", "(_", "nt_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "linalg_", "._", "norm_", "(_", "bv", "ecs_", "[_", "i", "T_", ",_", ":_", "]_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i", "T_", "not_", "in_", "index", "\\u", "identifi", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j", "T_", "=_", "i", "T_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "linalg_", "._", "norm_", "(_", "(_", "bv", "ecs_", "[_", "i", "T_", ",_", ":_", "]_", "+_", "bv", "ecs_", "[_", "j", "T_", ",_", ":_", "]_", ")_", ")_", "<_", "min", "\\u", "norm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Oppo", "site", " ", "gradi", "ent", " ", "for", " ", "#'_", "+_", "str_", "(_", "i", "T_", ")_", "+_", "'", " ", "is", ":", " ", "#'_", "+_", "str_", "(_", "j", "T_", ")_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "._", "append_", "(_", "i", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "._", "append_", "(_", "j", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "identifi", "ed_", "._", "append_", "(_", "i", "T_", ")_", "\\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 ", " _", "index", "\\u", "b0_", "._", "append_", "(_", "i", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Oppo", "site", " ", "gradi", "ent", " ", "for", " ", "#'_", "+_", "str_", "(_", "i", "T_", ")_", "+_", "'", " ", "is", ":", " ", "NON", "E", " ", "(", "b", "=", "0", ")'_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nb", "\\u", "opposite", "Grad", "ients", "_", "=_", "len_", "(_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Number", " ", "of", " ", "gradi", "ent", " ", "direction", "s", ":", " ", "'_", "+_", "str_", "(_", "2_", "*_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", "+_", "'", " ", "(", "2", "*'_", "+_", "str_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", "+_", "')'_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'..", " ", "Index", " ", "b", "=", "0", ":", " ", "'_", "+_", "str_", "(_", "index", "\\u", "b0_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "Fin", "d", " ", "transformation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "N_", "in_", "range_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "plus_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "minus_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'\\\\", "n", "Finding", " ", "affin", "e", " ", "transformation", " ", "bet", "ween", " ", "volume", "s", " ", "#'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "+_", "'", " ", "and", " ", "#'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "+_", "'", " ", "('_", "+_", "str_", "(_", "i", "N_", ")_", "+_", "'/'_", "+_", "str_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", "+_", "')'_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'-------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Slice", "wis", "e", " ", "correction_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "slice", "wise_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Split", " ", "volume", "s", " ", "acro", "ss", " ", "Z", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "plus_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "plus", "\\u", "Z_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "Z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "plus_", "=_", "Image_", "(_", "fname", "\\u", "plus_", "+_", "'.", "ni", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "plus", "\\u", "split", "\\u", "list_", "=_", "split", "\\u", "data_", "(_", "im", "\\u", "plus_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "im", "\\u", "p_", "in_", "im", "\\u", "plus", "\\u", "split", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "p_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cmd", " ", "=", " ", "fs", "lou", "tpu", "t", " ", "+", " ", "'", "fs", "lsp", "lit", " ", "'", " ", "+", " ", "fname", "\\u", "plus", " ", "+", " ", "'", " ", "'", " ", "+", " ", "fname", "\\u", "plus", "\\u", "Z", " ", "+", " ", "'", " ", "-", "z", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", ",", " ", "output", " ", "=", " ", "sct", ".", "run", "(", "cmd", ",", "verbo", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fname", "\\u", "minus_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "minu", "s", "\\u", "Z_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "Z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "minus_", "=_", "Image_", "(_", "fname", "\\u", "minus_", "+_", "'.", "ni", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "\\u", "minu", "s", "\\u", "split", "\\u", "list_", "=_", "split", "\\u", "data_", "(_", "im", "\\u", "minus_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "im", "\\u", "m_", "in_", "im", "\\u", "minu", "s", "\\u", "split", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im", "\\u", "m_", "._", "save_", "(_", ")_", "#", " ", "cmd", " ", "=", " ", "fs", "lou", "tpu", "t", " ", "+", " ", "'", "fs", "lsp", "lit", " ", "'", " ", "+", " ", "fname", "\\u", "minu", "s", " ", "+", " ", "'", " ", "'", " ", "+", " ", "fname", "\\u", "minu", "s", "\\u", "Z", " ", "+", " ", "'", " ", "-", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "status", ",", " ", "output", " ", "=", " ", "sct", ".", "run", "(", "cmd", ",", "verbo", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "loop", " ", "acro", "ss", " ", "Z_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nb", "\\u", "loops_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "plus_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fname", "\\u", "minus_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Fin", "d", " ", "transformation", " ", "on", " ", "opposite", " ", "gradi", "ent", " ", "directions_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Fin", "d", " ", "transformation", " ", "for", " ", "each", " ", "pair", " ", "of", " ", "opposite", " ", "gradi", "ent", " ", "direction", "s", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "plus", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "+_", "'\\u", "corr", "\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "t_", "=_", "'", "mat", "\\u'_", "+_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "+_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fli", "rt", " ", "-", "in", " ", "'_", "+_", "fname", "\\u", "plus_", "+_", "'", " ", "-", "ref", " ", "'_", "+_", "fname", "\\u", "minus_", "+_", "'", " ", "-", "paddings", "ize", " ", "3", " ", "-", "schedule", " ", "'_", "+_", "schedule", "\\u", "file_", "+_", "'", " ", "-", "verbo", "se", " ", "2", " ", "-", "oma", "t", " ", "'_", "+_", "oma", "t_", "+_", "'", " ", "-", "cost", " ", "'_", "+_", "cost", "\\u", "function_", "+_", "'", " ", "-", "force", "scal", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file_", "=_", "open_", "(_", "oma", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Matrix_", "=_", "np_", "._", "loadtxt_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "=_", "Matrix_", "[_", "0_", ":_", "4_", ",_", "0_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Transformation", " ", "matrix", ":\\\\", "n", "'_", "+_", "str_", "(_", "M_", ")_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Output", " ", "matrix", " ", "file", ":", " ", "'_", "+_", "oma", "t_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Divide", " ", "affin", "e", " ", "transformation", " ", "by", " ", "two_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Divide", " ", "affin", "e", " ", "transformation", " ", "by", " ", "two", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "A_", "=_", "(_", "M_", "-_", "np_", "._", "identity_", "(_", "4_", ")_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mp", "lus", "_", "=_", "np_", "._", "identity_", "(_", "4_", ")_", "+_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "t", "\\u", "plus_", "=_", "mat", "\\u", "edd", "y_", "+_", "'", "mat", ".", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "+_", "'\\u", "Z", "'_", "+_", "str_", "(_", "i", "Z_", ")_", "+_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "open_", "(_", "oma", "t", "\\u", "plus_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "savetxt_", "(_", "oma", "t", "\\u", "plus_", ",_", "Mp", "lus", "_", ",_", "fmt_", "=_", "'%", ".6", "e", "'_", ",_", "delimiter_", "=_", "'", " ", " ", "'_", ",_", "newline_", "=_", "'\\\\", "n", "'_", ",_", "header_", "=_", "''_", ",_", "footer_", "=_", "''_", ",_", "comments_", "=_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Output", " ", "matrix", " ", "file", " ", "(", "plus", "):", " ", "'_", "+_", "oma", "t", "\\u", "plus_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mm", "inu", "s_", "=_", "np_", "._", "identity_", "(_", "4_", ")_", "-_", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "t", "\\u", "minus_", "=_", "mat", "\\u", "edd", "y_", "+_", "'", "mat", ".", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "+_", "'\\u", "Z", "'_", "+_", "str_", "(_", "i", "Z_", ")_", "+_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "open_", "(_", "oma", "t", "\\u", "minus_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "savetxt_", "(_", "oma", "t", "\\u", "minus_", ",_", "Mm", "inu", "s_", ",_", "fmt_", "=_", "'%", ".6", "e", "'_", ",_", "delimiter_", "=_", "'", " ", " ", "'_", ",_", "newline_", "=_", "'\\\\", "n", "'_", ",_", "header_", "=_", "''_", ",_", "footer_", "=_", "''_", ",_", "comments_", "=_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'..", " ", "Output", " ", "matrix", " ", "file", " ", "(", "minu", "s", "):", " ", "'_", "+_", "oma", "t", "\\u", "minus_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "Apply", " ", "affin", "e", " ", "transformation_", "\\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_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Apply", " ", "affin", "e", " ", "transformation", " ", "matrix", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'-------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "N_", "in_", "range_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i", "File_", "in_", "range_", "(_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i", "File_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "file_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "[_", "i", "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 ", " _", "i", "\\u", "file_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nb", "\\u", "loops_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "file_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "corr_", "=_", "fname_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "t_", "=_", "mat", "\\u", "edd", "y_", "+_", "'", "mat", ".", "T", "'_", "+_", "str_", "(_", "i", "\\u", "file_", ")_", "+_", "'\\u", "Z", "'_", "+_", "str_", "(_", "i", "Z_", ")_", "+_", "'.", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fli", "rt", " ", "-", "in", " ", "'_", "+_", "fname_", "+_", "'", " ", "-", "ref", " ", "'_", "+_", "fname_", "+_", "'", " ", "-", "out", " ", "'_", "+_", "fname", "\\u", "corr_", "+_", "'", " ", "-", "init", " ", "'_", "+_", "oma", "t_", "+_", "'", " ", "-", "appl", "yx", "fm", " ", "-", "paddings", "ize", " ", "3", " ", "-", "interp", " ", "'_", "+_", "param_", "._", "interp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "Merge", " ", "back", " ", "acro", "ss", " ", "Z_", "\\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_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Merge", " ", "acro", "ss", " ", "Z", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'-------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "N_", "in_", "range_", "(_", "nb", "\\u", "opposite", "Grad", "ients", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "plus_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "i", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "plus", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "lm", "erge", " ", "-", "z", " ", "'_", "+_", "fname", "\\u", "plus", "\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "plus", "\\u", "Z", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "plus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "cmd_", "+_", "'", " ", "'_", "+_", "fname", "\\u", "plus", "\\u", "Z", "\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i", "\\u", "minus_", "=_", "opposite", "\\u", "gradi", "ents", "\\u", "j", "T_", "[_", "i", "N_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "minu", "s", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "lm", "erge", " ", "-", "z", " ", "'_", "+_", "fname", "\\u", "minu", "s", "\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i", "Z_", "in_", "range_", "(_", "nz_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "minu", "s", "\\u", "Z", "\\u", "corr_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "\\u", "minus_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "file", "\\u", "suffix_", "[_", "i", "Z_", "]_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "cmd_", "+_", "'", " ", "'_", "+_", "fname", "\\u", "minu", "s", "\\u", "Z", "\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "Merge", " ", "files", " ", "back_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Merge", " ", "back", " ", "acro", "ss", " ", "T", "...'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'-------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fname", "\\u", "data\\u", "corr_", "=_", "param_", "._", "output", "\\u", "path_", "+_", "file", "\\u", "data_", "+_", "'\\u", "edd", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t_", "+_", "'", "fs", "lm", "erge", " ", "-", "t", " ", "'_", "+_", "fname", "\\u", "data\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "tmp_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i", "T_", "in_", "range_", "(_", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "(_", "path", "\\u", "tmp_", "+_", "'/'_", "+_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "T_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", ".", "ni", "i", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "data\\u", "corr", "\\u", "3d_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "T_", ")_", "._", "zfill_", "(_", "4_", ")_", "+_", "'\\u", "corr", "\\u'_", "+_", "'\\u", "\\u", "div", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i", "T_", "in_", "index", "\\u", "b0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "data\\u", "corr", "\\u", "3d_", "=_", "file", "\\u", "data_", "+_", "'\\u", "T", "'_", "+_", "str_", "(_", "i", "T_", ")_", "._", "zfill_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "cmd_", "+_", "'", " ", "'_", "+_", "fname", "\\u", "data\\u", "corr", "\\u", "3d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Swa", "p", " ", "back", " ", "X", "-", "Y", " ", "dimensions_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "swap", "XY_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname", "\\u", "data\\u", "final_", "=_", "fname", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "Swa", "p", " ", "back", " ", "X", "-", "Y", " ", "dimension", "s", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fs", "lou", "tpu", "t", "\\u", "temp_", "+_", "'", "fs", "ls", "wap", "dim", " ", "'_", "+_", "fname", "\\u", "data\\u", "corr_", "+_", "'", " ", "-", "y", " ", "-", "x", " ", "-", "z", " ", "'_", "+_", "fname", "\\u", "data\\u", "final_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "output_", "=_", "sct", "_", "._", "run_", "(_", "cmd_", ",_", "verbose_", ")_", "\\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 ", " _", "fname", "\\u", "data\\u", "final_", "=_", "fname", "\\u", "data\\u", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "(_", "'...", " ", "File", " ", "created", ":", " ", "'_", "+_", "fname", "\\u", "data\\u", "final_", ")_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'\\\\", "n", "==============", "==============", "==============", "=========", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'", " ", " ", " ", " ", " ", " ", "Complete", "d", ":", " ", "edd", "y", "\\u", "correct", "'_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "print", "v_", "(_", "'===", "==============", "==============", "==============", "=====", "=\\\\", "n", "\\\\", "n", "\\\\", "n", "'_", ",_", "verbose_", ")_", "\\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,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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, 3, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
bitxbay/BitXBay/electrumfirst/__init__.py
[ { "content": "try:\n import locale\nexcept:\n pass\n\nwithMessagingMenu = False\ntry:\n from gi.repository import MessagingMenu\n from gi.repository import Notify\n withMessagingMenu = True\nexcept ImportError:\n MessagingMenu = None\nimport bitcoin\nfrom addresses import *\nimport shared\nfrom electrumfirst import *\nimport sys\nfrom time import strftime, localtime, gmtime\nimport time\nimport os\nimport hashlib\nfrom pyelliptic.openssl import OpenSSL\nimport pickle\nimport platform\nimport debug\nfrom debug import logger\nimport subprocess\nimport datetime\nimport random\nimport shelve\nimport threading\nimport multiprocessing\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class electrumfirst(QtGui.QMainWindow):", "metadata": "root.electrumfirst", "header": "['module', '___EOS___']", "index": 32 }, { "content": " def __init__(self, parent=None):\n QtGui.QWidget.__init__(self, parent)\n self.ui = Ui_MainWindow()\n self.ui.setupUi(self)\n self.parent = parent\n QtCore.QObject.connect(self.ui.startelectrum, QtCore.SIGNAL(\"clicked()\"), self.click_elec);\n QtCore.QObject.connect(self.ui.startbxb, QtCore.SIGNAL(\"clicked()\"), self.click_bxb);\n QtCore.QObject.connect(self.ui.bitcoinqt, QtCore.SIGNAL(\"clicked()\"), self.click_bitcoinqt);", "metadata": "root.electrumfirst.__init__", "header": "['class', 'electrumfirst', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___EOS___']", "index": 33 }, { "content": " def click_elec(self):\n subprocess.Popen([os.getcwd()+'/electrum/bin/electrum.exe'], shell=True)\n settings = shelve.open(\"settings.slv\")\n settings[\"electrumon\"] = True\n settings.close()\n os._exit(0)", "metadata": "root.electrumfirst.click_elec", "header": "['class', 'electrumfirst', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___EOS___']", "index": 41 }, { "content": " def click_bxb(self):\n settings = shelve.open(\"settings.slv\")\n settings[\"electrumon\"] = True\n settings.close()\n restart_program()", "metadata": "root.electrumfirst.click_bxb", "header": "['class', 'electrumfirst', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___EOS___']", "index": 47 }, { "content": " def click_bitcoinqt(self):\n settings = shelve.open(\"settings.slv\")\n settings[\"electrumon\"] = False\n settings.close()\n restart_program()", "metadata": "root.electrumfirst.click_bitcoinqt", "header": "['class', 'electrumfirst', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___EOS___']", "index": 52 }, { "content": "def run():\n app = QtGui.QApplication(sys.argv)\n myapp = electrumfirst()\n myapp.show()\n sys.exit(app.exec_())", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 57 }, { "content": "def restart_program():\n \"\"\"Restarts the current program.\n Note: this function does not return. Any cleanup action (like\n saving data) must be done before calling this function.\"\"\"\n python = sys.executable\n os.execl(python, python, * sys.argv)", "metadata": "root.restart_program", "header": "['module', '___EOS___']", "index": 63 } ]
[ { "span": "import locale", "start_line": 1, "start_column": 4, "end_line": 1, "end_column": 17 }, { "span": "from gi.repository import MessagingMenu", "start_line": 7, "start_column": 4, "end_line": 7, "end_column": 43 }, { "span": "from gi.repository import Notify", "start_line": 8, "start_column": 4, "end_line": 8, "end_column": 36 }, { "span": "import bitcoin", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 14 }, { "span": "import shared", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 13 }, { "span": "from time import strftime, localtime, gmtime", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 44 }, { "span": "import time", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 11 }, { "span": "import hashlib", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 14 }, { "span": "from pyelliptic.openssl import OpenSSL", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 38 }, { "span": "import pickle", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 13 }, { "span": "import platform", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 15 }, { "span": "import debug", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 12 }, { "span": "from debug import logger", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 24 }, { "span": "import datetime", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 15 }, { "span": "import random", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 13 }, { "span": "import threading", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 16 }, { "span": "import multiprocessing", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "locale_", "\\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_", "with", "Messag", "ing", "Menu_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gi_", "._", "repository_", "import_", "Messag", "ing", "Menu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gi_", "._", "repository_", "import_", "Notify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "Messag", "ing", "Menu_", "=_", "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 ", " _", "Messag", "ing", "Menu_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "bitcoin", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "addresses_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shared_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "electr", "um", "first_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "strftime_", ",_", "localtime_", ",_", "gmtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pye", "lli", "pti", "c_", "._", "openss", "l_", "import_", "Open", "SSL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "debug_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shelve", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\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\\uNEWLINE\\u\\u\\u_", "class_", "electr", "um", "first_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "electr", "um", "first_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\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_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Qt", "Gui_", "._", "QW", "idge", "t_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ui_", "=_", "Ui", "\\u", "Main", "Window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ui_", "._", "setup", "Ui_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "self_", "._", "ui_", "._", "start", "electr", "um_", ",_", "Qt", "Core_", "._", "SIGNAL_", "(_", "\"", "click", "ed", "()\"_", ")_", ",_", "self_", "._", "click", "\\u", "elec", "_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "self_", "._", "ui_", "._", "start", "bx", "b_", ",_", "Qt", "Core_", "._", "SIGNAL_", "(_", "\"", "click", "ed", "()\"_", ")_", ",_", "self_", "._", "click", "\\u", "bx", "b_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Qt", "Core_", "._", "QO", "bject_", "._", "connect_", "(_", "self_", "._", "ui_", "._", "bitcoin", "qt_", ",_", "Qt", "Core_", "._", "SIGNAL_", "(_", "\"", "click", "ed", "()\"_", ")_", ",_", "self_", "._", "click", "\\u", "bitcoin", "qt_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "electr", "um", "first_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "click", "\\u", "elec", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "Popen_", "(_", "[_", "os_", "._", "getcwd_", "(_", ")_", "+_", "'/", "electr", "um", "/", "bin", "/", "electr", "um", ".", "exe", "'_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "=_", "shelve", "_", "._", "open_", "(_", "\"", "settings", ".", "sl", "v", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "[_", "\"", "electr", "um", "on", "\"_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "\\u", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "electr", "um", "first_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "click", "\\u", "bx", "b_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "=_", "shelve", "_", "._", "open_", "(_", "\"", "settings", ".", "sl", "v", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "[_", "\"", "electr", "um", "on", "\"_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restart", "\\u", "program_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "electr", "um", "first_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "click", "\\u", "bitcoin", "qt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "=_", "shelve", "_", "._", "open_", "(_", "\"", "settings", ".", "sl", "v", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "[_", "\"", "electr", "um", "on", "\"_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restart", "\\u", "program_", "(_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "Qt", "Gui_", "._", "QA", "ppl", "ication", "_", "(_", "sys_", "._", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myapp", "_", "=_", "electr", "um", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myapp", "_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "app_", "._", "exec\\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_", "def_", "restart", "\\u", "program_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Restart", "s", " ", "the", " ", "current", " ", "program", ".", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "this", " ", "function", " ", "doe", "s", " ", "not", " ", "return", ".", " ", "Any", " ", "clean", "up", " ", "action", " ", "(", "like", "\\", "10", ";", " ", " ", " ", " ", "saving", " ", "data", ")", " ", "must", " ", "be", " ", "don", "e", " ", "bef", "ore", " ", "calling", " ", "this", " ", "function", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python_", "=_", "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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 ]
Unused import
missionpinball/mpf/mpf/media_controller/decorators/blink.py
[ { "content": "\"\"\"Blink Decorator.\"\"\"\n# blink.py\n# Mission Pinball Framework\n# Written by Brian Madden & Gabe Knuth\n# Released under the MIT License. (See license info at the end of this file.)\n\n# Documentation and more info at http://missionpinball.com/mpf\n\nimport pygame\nimport pygame.locals\nimport time\n\nfrom mpf.media_controller.core.display import Decorator\n\n\n\n# The MIT License (MIT)\n\n# Copyright (c) 2013-2015 Brian Madden and Gabe Knuth\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", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Blink(Decorator):\n \"\"\"Blink decorator which causes the element its applied to to blink on and\n off.\n\n Args:\n parent_element: The DisplayElement object this decorator is applied to.\n on_secs: The number of seconds for the \"on\" portion of the blinking.\n Default is 0.2.\n off_secs: The number of seconds for the \"off\" porition of the blinking.\n Default is 0.2.\n repeats: The number of times you'd like this element to blink. A value\n of -1 means it will repeat forever.\n\n Attributes:\n parent_element: The DisplayElement object this decorator is applied to.\n on_secs: The number of seconds for the \"on\" portion of the blinking.\n off_secs: The number of seconds for the \"off\" porition of the blinking.\n repeats: The number of remaining blinks this element will do. A value\n of -1 means it will repeat forever.\n dirty: Boolean which specifies whether this decorator needs to apply\n an update to the parent_elemnet in this frame.\n current_state: 1 means this decorator is in the \"on\" phase of a blink,\n 0 means it's in the \"off\" phase of a blink.\n next_action_time: Real-world time of when the next state change of this\n decorator will be.\n \"\"\"\n\n\n", "metadata": "root.Blink", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def __init__(self, parent_element, on_secs=.2, off_secs=.2, repeats=-1,\n **kwargs):\n self.next_action_time = 0\n self.current_state = 1\n self.on_secs = on_secs\n self.off_secs = off_secs\n self.repeats = repeats\n self.parent_element = parent_element", "metadata": "root.Blink.__init__", "header": "['class', 'Blink', '(', 'Decorator', ')', ':', '___EOS___']", "index": 42 }, { "content": " @property\n def dirty(self):\n if self.next_action_time <= time.time():\n return True\n else:\n return False", "metadata": "root.Blink.dirty", "header": "['class', 'Blink', '(', 'Decorator', ')', ':', '___EOS___']", "index": 51 }, { "content": " def update(self):\n \"\"\"Updates the parent_element if it's time to blink. Can safely be\n called often.\n\n Returns: True if this decorator made a change to the element that has to\n be re-blitted. False if no change.\n \"\"\"\n current_time = time.time()\n if self.next_action_time <= current_time:\n if self.current_state:\n self.parent_element.opacity = 0\n self.current_state = 0\n self.next_action_time = current_time + self.off_secs\n\n if self.repeats == 0:\n self.unload()\n elif self.repeats > 0:\n self.repeats -= 1\n\n else:\n self.current_state = 1\n self.next_action_time = current_time + self.on_secs\n self.parent_element.opacity = 255\n\n return True\n\n return False", "metadata": "root.Blink.update", "header": "['class', 'Blink', '(', 'Decorator', ')', ':', '___EOS___']", "index": 58 } ]
[ { "span": "import pygame", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 13 }, { "span": "import pygame.locals", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Blin", "k", " ", "Decorat", "or", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "blink", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mission", " ", "Pin", "bal", "l", " ", "Framework_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Writ", "ten", " ", "by", " ", "Brian", " ", "Mad", "den", " ", "&", " ", "Gab", "e", " ", "Kn", "uth_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Release", "d", " ", "under", " ", "the", " ", "MIT", " ", "License", ".", " ", "(", "See", " ", "license", " ", "info", " ", "at", " ", "the", " ", "end", " ", "of", " ", "this", " ", "file", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "ation", " ", "and", " ", "more", " ", "info", " ", "at", " ", "http", "://", "missio", "npi", "nba", "ll", ".", "com", "/", "mpf", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pygame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pygame_", "._", "locals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mpf", "_", "._", "media", "\\u", "controller_", "._", "core_", "._", "display_", "import_", "Decorator_", "\\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_", "#", " ", "The", " ", "MIT", " ", "License", " ", "(", "MIT", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", "-", "201", "5", " ", "Brian", " ", "Mad", "den", " ", "and", " ", "Gab", "e", " ", "Kn", "uth_", "\\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\\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_", "Blin", "k_", "(_", "Decorator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Blin", "k", " ", "decorat", "or", " ", "whi", "ch", " ", "caus", "es", " ", "the", " ", "element", " ", "its", " ", "applied", " ", "to", " ", "to", " ", "blink", " ", "on", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "off", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "parent", "\\u", "element", ":", " ", "The", " ", "Display", "Element", " ", "object", " ", "this", " ", "decorat", "or", " ", "is", " ", "applied", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "on", "\\u", "secs", ":", " ", "The", " ", "number", " ", "of", " ", "second", "s", " ", "for", " ", "the", " ", "\"", "on", "\"", " ", "porti", "on", " ", "of", " ", "the", " ", "blink", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "is", " ", "0.", "2", ".", "\\", "10", ";", " ", " ", " ", " ", "off", "\\u", "secs", ":", " ", "The", " ", "number", " ", "of", " ", "second", "s", " ", "for", " ", "the", " ", "\"", "off", "\"", " ", "por", "ition", " ", "of", " ", "the", " ", "blink", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "is", " ", "0.", "2", ".", "\\", "10", ";", " ", " ", " ", " ", "repeat", "s", ":", " ", "The", " ", "number", " ", "of", " ", "times", " ", "you", "'", "d", " ", "like", " ", "this", " ", "element", " ", "to", " ", "blink", ".", " ", "A", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "-1", " ", "means", " ", "it", " ", "will", " ", "repeat", " ", "forever", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "parent", "\\u", "element", ":", " ", "The", " ", "Display", "Element", " ", "object", " ", "this", " ", "decorat", "or", " ", "is", " ", "applied", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "on", "\\u", "secs", ":", " ", "The", " ", "number", " ", "of", " ", "second", "s", " ", "for", " ", "the", " ", "\"", "on", "\"", " ", "porti", "on", " ", "of", " ", "the", " ", "blink", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "off", "\\u", "secs", ":", " ", "The", " ", "number", " ", "of", " ", "second", "s", " ", "for", " ", "the", " ", "\"", "off", "\"", " ", "por", "ition", " ", "of", " ", "the", " ", "blink", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "repeat", "s", ":", " ", "The", " ", "number", " ", "of", " ", "rema", "inin", "g", " ", "blink", "s", " ", "this", " ", "element", " ", "will", " ", "do", ".", " ", "A", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "-1", " ", "means", " ", "it", " ", "will", " ", "repeat", " ", "forever", ".", "\\", "10", ";", " ", " ", " ", " ", "dir", "ty", ":", " ", "Boo", "lean", " ", "whi", "ch", " ", "speci", "fie", "s", " ", "whe", "ther", " ", "this", " ", "decorat", "or", " ", "need", "s", " ", "to", " ", "appl", "y", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "update", " ", "to", " ", "the", " ", "parent", "\\u", "elem", "net", " ", "in", " ", "this", " ", "frame", ".", "\\", "10", ";", " ", " ", " ", " ", "current", "\\u", "state", ":", " ", "1", " ", "means", " ", "this", " ", "decorat", "or", " ", "is", " ", "in", " ", "the", " ", "\"", "on", "\"", " ", "phase", " ", "of", " ", "a", " ", "blink", ",", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "means", " ", "it", "'", "s", " ", "in", " ", "the", " ", "\"", "off", "\"", " ", "phase", " ", "of", " ", "a", " ", "blink", ".", "\\", "10", ";", " ", " ", " ", " ", "next", "\\u", "action", "\\u", "time", ":", " ", "Real", "-", "world", " ", "time", " ", "of", " ", "whe", "n", " ", "the", " ", "next", " ", "state", " ", "change", " ", "of", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "decorat", "or", " ", "will", " ", "be", ".", "\\", "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_", "[SEP]_", "class_", "Blin", "k_", "(_", "Decorator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent", "\\u", "element_", ",_", "on", "\\u", "secs_", "=_", ".2_", ",_", "off", "\\u", "secs_", "=_", ".2_", ",_", "repeats_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "next", "\\u", "action", "\\u", "time_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "current", "\\u", "state_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "on", "\\u", "secs_", "=_", "on", "\\u", "secs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "off", "\\u", "secs_", "=_", "off", "\\u", "secs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "repeats_", "=_", "repeats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent", "\\u", "element_", "=_", "parent", "\\u", "element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blin", "k_", "(_", "Decorator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dirty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "next", "\\u", "action", "\\u", "time_", "<=_", "time_", "._", "time_", "(_", ")_", ":_", "\\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]_", "class_", "Blin", "k_", "(_", "Decorator_", ")_", ":_", "\\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_", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "the", " ", "parent", "\\u", "element", " ", "if", " ", "it", "'", "s", " ", "time", " ", "to", " ", "blink", ".", " ", "Can", " ", "safe", "ly", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", " ", "oft", "en", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", " ", "Tru", "e", " ", "if", " ", "this", " ", "decorat", "or", " ", "made", " ", "a", " ", "change", " ", "to", " ", "the", " ", "element", " ", "tha", "t", " ", "has", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "re", "-", "blit", "ted", ".", " ", "Fal", "se", " ", "if", " ", "no", " ", "change", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "next", "\\u", "action", "\\u", "time_", "<=_", "current", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "current", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent", "\\u", "element_", "._", "opacity_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "current", "\\u", "state_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next", "\\u", "action", "\\u", "time_", "=_", "current", "\\u", "time_", "+_", "self_", "._", "off", "\\u", "secs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "repeats_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "unload", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "repeats_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "repeats_", "-=_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "current", "\\u", "state_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next", "\\u", "action", "\\u", "time_", "=_", "current", "\\u", "time_", "+_", "self_", "._", "on", "\\u", "secs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent", "\\u", "element_", "._", "opacity_", "=_", "255_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\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, 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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 ]
Unused import
inpho/topic-explorer/topicexplorer/__main__.py
[ { "content": "#!/usr/bin/env python\nimport argparse\nfrom argparse import ArgumentParser\nfrom ConfigParser import RawConfigParser as ConfigParser\nimport os.path\n\nfrom topicexplorer import (init, prep, train, server, launch, notebook, demo,\n update, langspace)\nfrom topicexplorer.lib.util import is_valid_filepath\n\n\n\n\nif __name__ == '__main__':\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ArgumentParserError(Exception): pass", "metadata": "root.ArgumentParserError", "header": "['module', '___EOS___']", "index": 10 }, { "content": "class ThrowingArgumentParser(argparse.ArgumentParser):", "metadata": "root.ThrowingArgumentParser", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def error(self, message):\n raise ArgumentParserError(message)", "metadata": "root.ThrowingArgumentParser.error", "header": "['class', 'ThrowingArgumentParser', '(', 'argparse', '.', 'ArgumentParser', ')', ':', '___EOS___']", "index": 13 }, { "content": "def main():\n parser = ThrowingArgumentParser()\n benchmark_group = parser.add_mutually_exclusive_group()\n benchmark_group.add_argument('-t', '--time', help=\"Print execution time\",\n action='store_true')\n benchmark_group.add_argument('-p', '--profile', help=\"\"\"Profile the command.\n Optional filename saves results for use with snakeviz, pstats, or\n cprofilev. Automatically launches snakeviz, if installed.\"\"\",\n nargs='?', metavar='STATS_FILE')\n\n # Using add_subparsers(metavar) until argparse.SUPPRESS support is fixed.\n # See issue http://bugs.python.org/issue22848\n parsers = parser.add_subparsers(help=\"select a command\",\n parser_class=ArgumentParser,\n metavar='{version,demo,update,init,prep,train,launch,notebook}')\n version_parser = parsers.add_parser('version', help=\"Print the version and exit\")\n version_parser.set_defaults(func='version')\n\n # Init Parser\n parser_init = parsers.add_parser('init', help=\"Initialize the topic explorer\")\n init.populate_parser(parser_init)\n parser_init.set_defaults(func=\"init\")\n \n # Prep Parser\n parser_prep = parsers.add_parser('prep', help=\"Prep the corpus\", \n formatter_class=argparse.RawDescriptionHelpFormatter)\n prep.populate_parser(parser_prep)\n parser_prep.set_defaults(func=\"prep\")\n\n # Train Parser\n parser_train = parsers.add_parser('train', help=\"Train the LDA models\")\n train.populate_parser(parser_train)\n parser_train.set_defaults(func=\"train\")\n \n # Launch Parser\n parser_launch = parsers.add_parser('launch', help=\"Serve the trained LDA models\")\n launch.populate_parser(parser_launch)\n parser_launch.set_defaults(func=\"launch\")\n\n # Serve Parser\n parser_serve = parsers.add_parser('serve', \n help=\"Serve a single LDA model, helper for `vsm launch`,\"+\n \"rarely called directly\")\n server.populate_parser(parser_serve)\n parser_serve.set_defaults(func=\"serve\")\n \n # Notebook Parser\n parser_nb = parsers.add_parser('notebook', \n help=\"Create a set of IPython Notebooks\")\n notebook.populate_parser(parser_nb)\n parser_nb.set_defaults(func=\"notebook\")\n\n # Demo Parser\n parser_demo = parsers.add_parser('demo', \n help=\"Download and run the AP demo\")\n parser_demo.set_defaults(func=\"demo\")\n\n # Update Parser \n parser_update = parsers.add_parser('update', \n help=\"Update the Topic Explorer\")\n parser_update.set_defaults(func=\"update\")\n \n # Lang Space Parser \n parser_langspace = parsers.add_parser('langspace', \n help=\"Add spaces before unicode chars\")\n langspace.populate_parser(parser_langspace)\n parser_langspace.set_defaults(func=\"langspace\")\n\n # fancy arg validation for manually injecting tempfile to profile arg \n try:\n try: \n args = parser.parse_args()\n except ArgumentParserError as e:\n import sys\n new_args = sys.argv[1:]\n try:\n # If the error was thrown by the '-p' argument not having a\n # valid file, fix by manually injecting a nargs break\n profile = new_args.index('-p')\n\n if (len(new_args) > (profile + 1) and\n new_args[profile + 1] in parsers.choices.keys()):\n new_args.insert(profile + 1, '-')\n args = parser.parse_args(new_args)\n else:\n raise e\n except ValueError:\n raise e\n except ArgumentParserError as e:\n import sys\n # Check to see if error occurs with a subparser and cause the exception\n # to arise from the subparser instead\n for p in parsers.choices.keys():\n if p in sys.argv[1:]:\n subargs_idx = sys.argv.index(p) + 1\n subargs = sys.argv[subargs_idx:]\n subparser = locals()['parser_' + p]\n # this might cause an error in the subparser, in which case\n # we actually want to show that error first\n args = subparser.parse_args(subargs)\n \n # Use the default error mechanism for the master parser.\n # If the code gets here, it means the error was not in a subparser\n ArgumentParser.error(parser, e.message)\n\n if args.profile:\n if args.profile == '-':\n import tempfile\n temphandle, args.profile = tempfile.mkstemp(suffix='.prof', prefix='vsm.')\n print \"Saving benchmark data to\", args.profile\n\n from profilehooks import profile\n benchmark = lambda fn: profile(fn, immediate=True, filename=args.profile, stdout=None)\n\n elif args.time:\n from profilehooks import timecall\n benchmark = lambda fn: timecall(fn, immediate=False)\n else:\n benchmark = lambda fn: fn\n\n if args.func == 'version':\n from topicexplorer.version import __pretty_version__\n print __pretty_version__,\n\n elif args.func == 'init':\n args.config_file = benchmark(init.main)(args)\n \n print \"\\nTIP: Only initalizing corpus object and config file.\"\n print \" Next prepare the corpus using:\"\n print \" vsm prep\", args.config_file\n print \" Or skip directly to training LDA models using:\"\n print \" vsm train\", args.config_file\n\n elif args.func == 'prep':\n benchmark(prep.main)(args)\n \n print \"\\nTIP: Train the LDA models with:\"\n print \" vsm train\", args.config_file\n\n elif args.func == 'train':\n benchmark(train.main)(args)\n\n if not args.dry_run:\n print \"\\nTIP: launch the topic explorer with:\"\n print \" vsm launch\", args.config_file\n print \" or the notebook server with:\"\n print \" vsm notebook\", args.config_file\n\n elif args.func == 'launch':\n benchmark(launch.main)(args)\n\n elif args.func == 'serve':\n benchmark(server.main)(args)\n\n elif args.func == 'notebook':\n benchmark(notebook.main)(args)\n\n elif args.func == 'demo':\n benchmark(demo.main)(args)\n\n elif args.func == 'update':\n benchmark(update.main)(args)\n\n elif args.func == 'langspace':\n benchmark(langspace.main)(args)\n\n if args.profile:\n try:\n import snakeviz.cli\n print \"\\n\\n\"\n snakeviz.cli.main([args.profile])\n except ImportError:\n print \"\"\"\\nSnakeviz is not installed. Install with `pip install snakeviz`, \n then run `snakeviz {}`.\"\"\".format(args.profile)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 16 } ]
[ { "span": "from ConfigParser import RawConfigParser as ConfigParser", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 56 }, { "span": "import os.path", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 14 }, { "span": "from topicexplorer.lib.util import is_valid_filepath", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 52 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "argparse_", "import_", "Arg", "ument", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Config", "Parser_", "import_", "Ra", "w", "Config", "Parser_", "as_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "topic", "explorer", "_", "import_", "(_", "init_", ",_", "prep_", ",_", "train_", ",_", "server_", ",_", "launch_", ",_", "notebook_", ",_", "demo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update_", ",_", "lang", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "topic", "explorer", "_", "._", "lib_", "._", "util_", "import_", "is", "\\u", "valid", "\\u", "filepath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Arg", "ument", "Parser", "Error_", "(_", "Exception_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Throw", "ing", "Arg", "ument", "Parser_", "(_", "argparse_", "._", "Arg", "ument", "Parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Throw", "ing", "Arg", "ument", "Parser_", "(_", "argparse_", "._", "Arg", "ument", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "error_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Arg", "ument", "Parser", "Error_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "Throw", "ing", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bench", "mark", "\\u", "group_", "=_", "parser_", "._", "add", "\\u", "mutual", "ly", "\\u", "exclu", "sive", "\\u", "group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bench", "mark", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "'-", "t", "'_", ",_", "'--", "time", "'_", ",_", "help_", "=_", "\"", "Print", " ", "executi", "on", " ", "time", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bench", "mark", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "'-", "p", "'_", ",_", "'--", "profile", "'_", ",_", "help_", "=_", "\"\"\"", "Profil", "e", " ", "the", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "Optio", "nal", " ", "filename", " ", "save", "s", " ", "results", " ", "for", " ", "use", " ", "with", " ", "snake", "viz", ",", " ", "pstat", "s", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "cpro", "file", "v", ".", " ", "Automat", "ical", "ly", " ", "launch", "es", " ", "snake", "viz", ",", " ", "if", " ", "install", "ed", ".\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nargs_", "=_", "'?'_", ",_", "metavar_", "=_", "'", "STATS", "\\u", "FILE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ing", " ", "add", "\\u", "subpar", "sers", "(", "meta", "var", ")", " ", "unti", "l", " ", "argp", "arse", ".", "SUPPRESS", " ", "support", " ", "is", " ", "fixed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "issue", " ", "http", "://", "bug", "s", ".", "python", ".", "org", "/", "issue", "228", "48_", "\\u\\u\\uNL\\u\\u\\u_", "parsers_", "=_", "parser_", "._", "add", "\\u", "subparsers_", "(_", "help_", "=_", "\"", "select", " ", "a", " ", "command", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "class_", "=_", "Arg", "ument", "Parser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'{", "version", ",", "demo", ",", "update", ",", "init", ",", "prep", ",", "train", ",", "launch", ",", "notebook", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u", "parser_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "version", "'_", ",_", "help_", "=_", "\"", "Print", " ", "the", " ", "version", " ", "and", " ", "exit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u", "parser_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "'", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ini", "t", " ", "Parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "init_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "init", "'_", ",_", "help_", "=_", "\"", "Initializ", "e", " ", "the", " ", "topic", " ", "explorer", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init_", "._", "populate", "\\u", "parser_", "(_", "parser", "\\u", "init_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "init_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "\"", "init", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prep", " ", "Parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "prep_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "prep", "'_", ",_", "help_", "=_", "\"", "Prep", " ", "the", " ", "corp", "us", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatter", "\\u", "class_", "=_", "argparse_", "._", "Ra", "w", "Descripti", "on", "Help", "Formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prep_", "._", "populate", "\\u", "parser_", "(_", "parser", "\\u", "prep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "prep_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "\"", "prep", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Train", " ", "Parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "train_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "train", "'_", ",_", "help_", "=_", "\"", "Train", " ", "the", " ", "LDA", " ", "model", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train_", "._", "populate", "\\u", "parser_", "(_", "parser", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "train_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "\"", "train", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Launch", " ", "Parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "launch_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "launch", "'_", ",_", "help_", "=_", "\"", "Serv", "e", " ", "the", " ", "trained", " ", "LDA", " ", "model", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "launch_", "._", "populate", "\\u", "parser_", "(_", "parser", "\\u", "launch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "launch_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "\"", "launch", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Serv", "e", " ", "Parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "serve_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "serve", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Serv", "e", " ", "a", " ", "single", " ", "LDA", " ", "model", ",", " ", "help", "er", " ", "for", " ", "`", "vs", "m", " ", "launch", "`", ",\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rare", "ly", " ", "call", "ed", " ", "direct", "ly", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "populate", "\\u", "parser_", "(_", "parser", "\\u", "serve_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "serve_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "\"", "serve", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Notebook", " ", "Parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "nb_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "notebook", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Creat", "e", " ", "a", " ", "set", " ", "of", " ", "IP", "yth", "on", " ", "Notebook", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notebook_", "._", "populate", "\\u", "parser_", "(_", "parser", "\\u", "nb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "nb_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "\"", "notebook", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Demo", " ", "Parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "demo_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "demo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Down", "load", " ", "and", " ", "run", " ", "the", " ", "AP", " ", "demo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "demo_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "\"", "demo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "Parser", " _", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "update_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "update", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Update", " ", "the", " ", "Topic", " ", "Explorer", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "update_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "\"", "update", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lang", " ", "Spac", "e", " ", "Parser", " _", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "lang", "space_", "=_", "parsers_", "._", "add", "\\u", "parser_", "(_", "'", "lang", "space", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Add", " ", "space", "s", " ", "bef", "ore", " ", "unicode", " ", "char", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lang", "space_", "._", "populate", "\\u", "parser_", "(_", "parser", "\\u", "lang", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "lang", "space_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "\"", "lang", "space", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fancy", " ", "arg", " ", "validation", " ", "for", " ", "manu", "ally", " ", "inject", "ing", " ", "tempfile", " ", "to", " ", "profile", " ", "arg", " _", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\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_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Arg", "ument", "Parser", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "args_", "=_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "error", " ", "was", " ", "throw", "n", " ", "by", " ", "the", " ", "'-", "p", "'", " ", "argu", "ment", " ", "not", " ", "hav", "ing", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "valid", " ", "file", ",", " ", "fix", " ", "by", " ", "manu", "ally", " ", "inject", "ing", " ", "a", " ", "narg", "s", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profile_", "=_", "new", "\\u", "args_", "._", "index_", "(_", "'-", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "len_", "(_", "new", "\\u", "args_", ")_", ">_", "(_", "profile_", "+_", "1_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "args_", "[_", "profile_", "+_", "1_", "]_", "in_", "parsers_", "._", "choices_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "args_", "._", "insert_", "(_", "profile_", "+_", "1_", ",_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", "new", "\\u", "args_", ")_", "\\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_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "e_", "\\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_", "Arg", "ument", "Parser", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "see", " ", "if", " ", "error", " ", "occur", "s", " ", "with", " ", "a", " ", "subpar", "ser", " ", "and", " ", "caus", "e", " ", "the", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "aris", "e", " ", "from", " ", "the", " ", "subpar", "ser", " ", "inst", "ead_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "p_", "in_", "parsers_", "._", "choices_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "in_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subar", "gs", "\\u", "idx_", "=_", "sys_", "._", "argv_", "._", "index_", "(_", "p_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subar", "gs_", "=_", "sys_", "._", "argv_", "[_", "subar", "gs", "\\u", "idx_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subparser_", "=_", "locals_", "(_", ")_", "[_", "'", "parser", "\\u'_", "+_", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "mig", "ht", " ", "caus", "e", " ", "an", " ", "error", " ", "in", " ", "the", " ", "subpar", "ser", ",", " ", "in", " ", "whi", "ch", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "actual", "ly", " ", "want", " ", "to", " ", "show", " ", "tha", "t", " ", "error", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "subparser_", "._", "parse", "\\u", "args_", "(_", "subar", "gs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "default", " ", "error", " ", "mechanism", " ", "for", " ", "the", " ", "master", " ", "parser", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "code", " ", "gets", " ", "here", ",", " ", "it", " ", "means", " ", "the", " ", "error", " ", "was", " ", "not", " ", "in", " ", "a", " ", "subparser_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Arg", "ument", "Parser_", "._", "error_", "(_", "parser_", ",_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "profile_", "==_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "handle_", ",_", "args_", "._", "profile_", "=_", "tempfile_", "._", "mkstemp_", "(_", "suffix_", "=_", "'.", "prof", "'_", ",_", "prefix_", "=_", "'", "vs", "m", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Sav", "ing", " ", "bench", "mark", " ", "data", " ", "to", "\"_", ",_", "args_", "._", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "profile", "hooks_", "import_", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "benchmark_", "=_", "lambda_", "fn_", ":_", "profile_", "(_", "fn_", ",_", "immediate", "_", "=_", "True_", ",_", "filename_", "=_", "args_", "._", "profile_", ",_", "stdout_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "profile", "hooks_", "import_", "time", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "benchmark_", "=_", "lambda_", "fn_", ":_", "time", "call_", "(_", "fn_", ",_", "immediate", "_", "=_", "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 ", " _", "benchmark_", "=_", "lambda_", "fn_", ":_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "func_", "==_", "'", "version", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "topic", "explorer", "_", "._", "version_", "import_", "\\u\\u", "pretty", "\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u", "pretty", "\\u", "version\\u\\u_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "func_", "==_", "'", "init", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "config", "\\u", "file_", "=_", "benchmark_", "(_", "init_", "._", "main_", ")_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "TIP", ":", " ", "On", "ly", " ", "init", "ali", "zin", "g", " ", "corp", "us", " ", "object", " ", "and", " ", "config", " ", "file", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "Ne", "xt", " ", "prepar", "e", " ", "the", " ", "corp", "us", " ", "usi", "ng", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", "vs", "m", " ", "prep", "\"_", ",_", "args_", "._", "config", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "Or", " ", "skip", " ", "direct", "ly", " ", "to", " ", "train", "ing", " ", "LDA", " ", "model", "s", " ", "usi", "ng", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", "vs", "m", " ", "train", "\"_", ",_", "args_", "._", "config", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "func_", "==_", "'", "prep", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "benchmark_", "(_", "prep_", "._", "main_", ")_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "TIP", ":", " ", "Train", " ", "the", " ", "LDA", " ", "model", "s", " ", "with", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", "vs", "m", " ", "train", "\"_", ",_", "args_", "._", "config", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "func_", "==_", "'", "train", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "benchmark_", "(_", "train_", "._", "main_", ")_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "args_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "TIP", ":", " ", "launch", " ", "the", " ", "topic", " ", "explorer", " ", "with", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", "vs", "m", " ", "launch", "\"_", ",_", "args_", "._", "config", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "or", " ", "the", " ", "notebook", " ", "server", " ", "with", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", "vs", "m", " ", "notebook", "\"_", ",_", "args_", "._", "config", "\\u", "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_", "elif_", "args_", "._", "func_", "==_", "'", "launch", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "benchmark_", "(_", "launch_", "._", "main_", ")_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "func_", "==_", "'", "serve", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "benchmark_", "(_", "server_", "._", "main_", ")_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "func_", "==_", "'", "notebook", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "benchmark_", "(_", "notebook_", "._", "main_", ")_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "func_", "==_", "'", "demo", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "benchmark_", "(_", "demo_", "._", "main_", ")_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "func_", "==_", "'", "update", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "benchmark_", "(_", "update_", "._", "main_", ")_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "func_", "==_", "'", "lang", "space", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "benchmark_", "(_", "lang", "space_", "._", "main_", ")_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "profile_", ":_", "\\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 ", " _", "import_", "snake", "viz_", "._", "cli_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snake", "viz_", "._", "cli_", "._", "main_", "(_", "[_", "args_", "._", "profile_", "]_", ")_", "\\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 ", " _", "print_", "\"\"\"", "\\\\", "n", "Sna", "ke", "viz", " ", "is", " ", "not", " ", "install", "ed", ".", " ", "Install", " ", "with", " ", "`", "pip", " ", "install", " ", "snake", "viz", "`", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "run", " ", "`", "snake", "viz", " ", "{}", "`.\"\"\"_", "._", "format_", "(_", "args_", "._", "profile_", ")_", "\\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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
RobotWebTools/rosbridge_suite/rosbridge_library/test/internal/publishers/test_publisher_manager.py
[ { "content": "#!/usr/bin/env python\nimport sys\nimport rospy\nimport rostest\nimport unittest\n\nfrom time import sleep\n\nfrom rosbridge_library.internal.publishers import *\nfrom rosbridge_library.internal.topics import *\nfrom rosbridge_library.internal.message_conversion import FieldTypeMismatchException\nfrom std_msgs.msg import String, Int32\n\n\n\n\nPKG = 'rosbridge_library'\nNAME = 'test_publisher_manager'\nif __name__ == '__main__':\n rostest.unitrun(PKG, NAME, TestPublisherManager)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestPublisherManager(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestPublisherManager", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def setUp(self):\n rospy.init_node(\"test_publisher_manager\")", "metadata": "root.TestPublisherManager.setUp", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def is_topic_published(self, topicname):\n return topicname in dict(rospy.get_published_topics()).keys()", "metadata": "root.TestPublisherManager.is_topic_published", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def test_register_publisher(self):\n \"\"\" Register a publisher on a clean topic with a good msg type \"\"\"\n topic = \"/test_register_publisher\"\n msg_type = \"std_msgs/String\"\n client = \"client_test_register_publisher\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n manager.register(client, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n\n manager.unregister(client, topic)\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))", "metadata": "root.TestPublisherManager.test_register_publisher", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_register_publisher_multiclient(self):\n topic = \"/test_register_publisher_multiclient\"\n msg_type = \"std_msgs/String\"\n client1 = \"client_test_register_publisher_1\"\n client2 = \"client_test_register_publisher_2\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n manager.register(client1, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.register(client2, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.unregister(client1, topic)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.unregister(client2, topic)\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))", "metadata": "root.TestPublisherManager.test_register_publisher_multiclient", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def test_register_publisher_conflicting_types(self):\n topic = \"/test_register_publisher_conflicting_types\"\n msg_type = \"std_msgs/String\"\n msg_type_bad = \"std_msgs/Int32\"\n client = \"client_test_register_publisher_conflicting_types\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n manager.register(client, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n\n self.assertRaises(TypeConflictException, manager.register, \"client2\", topic, msg_type_bad)", "metadata": "root.TestPublisherManager.test_register_publisher_conflicting_types", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_register_multiple_publishers(self):\n topic1 = \"/test_register_multiple_publishers1\"\n topic2 = \"/test_register_multiple_publishers2\"\n msg_type = \"std_msgs/String\"\n client = \"client_test_register_multiple_publishers\"\n\n self.assertFalse(topic1 in manager._publishers)\n self.assertFalse(topic2 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic1))\n self.assertFalse(self.is_topic_published(topic2))\n manager.register(client, topic1, msg_type)\n self.assertTrue(topic1 in manager._publishers)\n self.assertTrue(self.is_topic_published(topic1))\n self.assertFalse(topic2 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic2))\n manager.register(client, topic2, msg_type)\n self.assertTrue(topic1 in manager._publishers)\n self.assertTrue(self.is_topic_published(topic1))\n self.assertTrue(topic2 in manager._publishers)\n self.assertTrue(self.is_topic_published(topic2))\n\n manager.unregister(client, topic1)\n self.assertFalse(topic1 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic1))\n self.assertTrue(topic2 in manager._publishers)\n self.assertTrue(self.is_topic_published(topic2))\n\n manager.unregister(client, topic2)\n self.assertFalse(topic1 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic1))\n self.assertFalse(topic2 in manager._publishers)\n self.assertFalse(self.is_topic_published(topic2))", "metadata": "root.TestPublisherManager.test_register_multiple_publishers", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_register_no_msgtype(self):\n topic = \"/test_register_no_msgtype\"\n client = \"client_test_register_no_msgtype\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n self.assertRaises(TopicNotEstablishedException, manager.register, client, topic)", "metadata": "root.TestPublisherManager.test_register_no_msgtype", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test_register_infer_topictype(self):\n topic = \"/test_register_infer_topictype\"\n client = \"client_test_register_infer_topictype\"\n\n self.assertFalse(self.is_topic_published(topic))\n\n rospy.Publisher(topic, String)\n\n self.assertTrue(self.is_topic_published(topic))\n self.assertFalse(topic in manager._publishers)\n manager.register(client, topic)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n\n manager.unregister(client, topic)\n self.assertFalse(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))", "metadata": "root.TestPublisherManager.test_register_infer_topictype", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 114 }, { "content": " def test_register_multiple_notopictype(self):\n topic = \"/test_register_multiple_notopictype\"\n msg_type = \"std_msgs/String\"\n client1 = \"client_test_register_multiple_notopictype_1\"\n client2 = \"client_test_register_multiple_notopictype_2\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n manager.register(client1, topic, msg_type)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.register(client2, topic)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.unregister(client1, topic)\n self.assertTrue(topic in manager._publishers)\n self.assertTrue(self.is_topic_published(topic))\n manager.unregister(client2, topic)\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))", "metadata": "root.TestPublisherManager.test_register_multiple_notopictype", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 132 }, { "content": " def test_publish_not_registered(self):\n topic = \"/test_publish_not_registered\"\n msg = {\"data\": \"test publish not registered\"}\n client = \"client_test_publish_not_registered\"\n\n self.assertFalse(topic in manager._publishers)\n self.assertFalse(self.is_topic_published(topic))\n self.assertRaises(TopicNotEstablishedException, manager.publish, client, topic, msg)", "metadata": "root.TestPublisherManager.test_publish_not_registered", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 153 }, { "content": " def test_publisher_manager_publish(self):\n \"\"\" Make sure that publishing works \"\"\"\n topic = \"/test_publisher_manager_publish\"\n msg = {\"data\": \"test publisher manager publish\"}\n client = \"client_test_publisher_manager_publish\"\n\n received = {\"msg\": None}\n\n def cb(msg):\n received[\"msg\"] = msg\n\n rospy.Subscriber(topic, String, cb)\n manager.publish(client, topic, msg)\n sleep(0.5)\n\n self.assertEqual(received[\"msg\"].data, msg[\"data\"])", "metadata": "root.TestPublisherManager.test_publisher_manager_publish", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 162 }, { "content": " def test_publisher_manager_bad_publish(self):\n \"\"\" Make sure that bad publishing fails \"\"\"\n topic = \"/test_publisher_manager_bad_publish\"\n client = \"client_test_publisher_manager_bad_publish\"\n msg_type = \"std_msgs/String\"\n msg = {\"data\": 3}\n\n manager.register(client, topic, msg_type)\n self.assertRaises(FieldTypeMismatchException, manager.publish, client, topic, msg)", "metadata": "root.TestPublisherManager.test_publisher_manager_bad_publish", "header": "['class', 'TestPublisherManager', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 179 } ]
[ { "span": "import sys", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 }, { "span": "from std_msgs.msg import String, Int32", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rospy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ros", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "time_", "import_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ros", "bridge", "\\u", "library_", "._", "internal_", "._", "publishers", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ros", "bridge", "\\u", "library_", "._", "internal_", "._", "topics_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ros", "bridge", "\\u", "library_", "._", "internal_", "._", "message", "\\u", "conversion_", "import_", "Field", "Type", "Mismatch", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "std", "\\u", "msgs_", "._", "msg_", "import_", "String_", ",_", "Int32_", "\\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_", "PKG", "_", "=_", "'", "ros", "bridge", "\\u", "librar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NAME_", "=_", "'", "test\\u", "publi", "sher", "\\u", "manage", "r", "'_", "\\u\\u\\uNEWLINE\\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 ", " _", "ros", "test_", "._", "unit", "run_", "(_", "PKG", "_", ",_", "NAME_", ",_", "Test", "Publish", "er", "Manager_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Publish", "er", "Manager_", "(_", "unittest_", "._", "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 ", " _", "rospy_", "._", "init", "\\u", "node_", "(_", "\"", "test\\u", "publi", "sher", "\\u", "manage", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "topic", "\\u", "published_", "(_", "self_", ",_", "topic", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "topic", "name_", "in_", "dict_", "(_", "rospy_", "._", "get", "\\u", "publi", "shed", "\\u", "topics_", "(_", ")_", ")_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "publisher_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Register", " ", "a", " ", "publi", "sher", " ", "on", " ", "a", " ", "clean", " ", "topic", " ", "with", " ", "a", " ", "good", " ", "msg", " ", "type", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "publi", "sher", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "publi", "sher", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "publi", "sher", "\\u", "multic", "lient_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "publi", "sher", "\\u", "multic", "lien", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "1_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "publi", "sher", "\\u", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "publi", "sher", "\\u", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client", "1_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client", "2_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client", "1_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client", "2_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "publi", "sher", "\\u", "conflicting", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "publi", "sher", "\\u", "conflicting", "\\u", "types", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type", "\\u", "bad_", "=_", "\"", "std", "\\u", "msgs", "/", "Int", "32", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "publi", "sher", "\\u", "conflicting", "\\u", "types", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Confl", "ict", "Exception_", ",_", "manager_", "._", "register_", ",_", "\"", "client", "2", "\"_", ",_", "topic_", ",_", "msg", "\\u", "type", "\\u", "bad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "multiple", "\\u", "publishers", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic", "1_", "=_", "\"/", "test\\u", "register", "\\u", "multiple", "\\u", "publishers", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic", "2_", "=_", "\"/", "test\\u", "register", "\\u", "multiple", "\\u", "publishers", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "multiple", "\\u", "publishers", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic", "1_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic", "2_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client_", ",_", "topic", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client_", ",_", "topic", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "1_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic", "2_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "no", "\\u", "msgt", "ype_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "no", "\\u", "msgt", "ype", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "no", "\\u", "msgt", "ype", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Topic", "Not", "Esta", "blis", "hed", "Exception_", ",_", "manager_", "._", "register_", ",_", "client_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "infer", "\\u", "topic", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "infer", "\\u", "topic", "type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "infer", "\\u", "topic", "type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rospy_", "._", "Publisher_", "(_", "topic_", ",_", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "register", "\\u", "multiple", "\\u", "not", "opi", "ctype_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "register", "\\u", "multiple", "\\u", "not", "opi", "ctype", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "1_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "multiple", "\\u", "not", "opi", "ctype", "\\u", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "=_", "\"", "client", "\\u", "test\\u", "register", "\\u", "multiple", "\\u", "not", "opi", "ctype", "\\u", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client", "1_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "register_", "(_", "client", "2_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client", "1_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "unregister_", "(_", "client", "2_", ",_", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "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", "sh", "\\u", "not", "\\u", "registered_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topic_", "=_", "\"/", "test\\u", "publi", "sh", "\\u", "not", "\\u", "register", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "{_", "\"", "data", "\"_", ":_", "\"", "test", " ", "publi", "sh", " ", "not", " ", "register", "ed", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "publi", "sh", "\\u", "not", "\\u", "register", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "topic_", "in_", "manager_", "._", "\\u", "publishers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "is", "\\u", "topic", "\\u", "published_", "(_", "topic_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Topic", "Not", "Esta", "blis", "hed", "Exception_", ",_", "manager_", "._", "publish_", ",_", "client_", ",_", "topic_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "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", "manage", "r", "\\u", "publish_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Make", " ", "sure", " ", "tha", "t", " ", "publishing", " ", "works", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "\"/", "test\\u", "publi", "sher", "\\u", "manage", "r", "\\u", "publi", "sh", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "{_", "\"", "data", "\"_", ":_", "\"", "test", " ", "publi", "sher", " ", "manage", "r", " ", "publi", "sh", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "publi", "sher", "\\u", "manage", "r", "\\u", "publi", "sh", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "received_", "=_", "{_", "\"", "msg", "\"_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cb_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "received_", "[_", "\"", "msg", "\"_", "]_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rospy_", "._", "Subscriber_", "(_", "topic_", ",_", "String_", ",_", "cb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "publish_", "(_", "client_", ",_", "topic_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sleep_", "(_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "received_", "[_", "\"", "msg", "\"_", "]_", "._", "data_", ",_", "msg_", "[_", "\"", "data", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Publish", "er", "Manager_", "(_", "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", "manage", "r", "\\u", "bad", "\\u", "publish_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Make", " ", "sure", " ", "tha", "t", " ", "bad", " ", "publishing", " ", "fail", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "\"/", "test\\u", "publi", "sher", "\\u", "manage", "r", "\\u", "bad", "\\u", "publi", "sh", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "\"", "client", "\\u", "test\\u", "publi", "sher", "\\u", "manage", "r", "\\u", "bad", "\\u", "publi", "sh", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "type_", "=_", "\"", "std", "\\u", "msgs", "/", "String", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "{_", "\"", "data", "\"_", ":_", "3_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manager_", "._", "register_", "(_", "client_", ",_", "topic_", ",_", "msg", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Field", "Type", "Mismatch", "Exception_", ",_", "manager_", "._", "publish_", ",_", "client_", ",_", "topic_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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, 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,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/Lib/test/eof_fodder2.py
[ { "content": "def f():\n def g():\n pass", "metadata": "root.f", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "g(", "start_line": 1, "start_column": 8, "end_line": 1, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "def_", "f_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "g_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 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 ]
Unused local variable
anandology/pyjamas/pyjd/sessionhistory.py
[ { "content": " def __init__(self):\n gobject.GObject.__init__(self)\n\n self._wrapped_self = xpcom.server.WrapObject( \\\n self, interfaces.nsISHistoryListener)\n weak_ref = xpcom.client.WeakReference(self._wrapped_self)", "metadata": "root.HistoryListener.__init__", "header": "['class', 'HistoryListener', '(', 'gobject', '.', 'GObject', ')', ':', '___EOS___']", "index": 33 } ]
[ { "span": "weak_ref ", "start_line": 38, "start_column": 8, "end_line": 38, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Hist", "ory", "Listener_", "(_", "gobject_", "._", "GO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gobject_", "._", "GO", "bject_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "wrapp", "ed", "\\u", "self_", "=_", "xp", "com_", "._", "server_", "._", "Wra", "p", "Object_", "(_", "self_", ",_", "interfaces_", "._", "ns", "ISH", "isto", "ry", "Listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weak", "\\u", "ref_", "=_", "xp", "com_", "._", "client_", "._", "Wea", "k", "Reference_", "(_", "self_", "._", "\\u", "wrapp", "ed", "\\u", "self_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
fp7-ofelia/ocf/ofam/src/src/foam/api/legacyexpedientapi.py
[ { "content": " def recordAction (self, action, credentials = [], urn = None):\n cred_ids = []\n self._actionLog.info(\"Sliver: %s LegExpAPI Action: %s\" % (urn, action))\n for cred in credentials:\n self._actionLog.info(\"Credential: %s\" % (cred))", "metadata": "root.AMLegExpAPI.recordAction", "header": "['class', 'AMLegExpAPI', '(', 'foam', '.', 'api', '.', 'xmlrpc', '.', 'Dispatcher', ')', ':', '___EOS___']", "index": 129 }, { "content": " def pub_create_slice(self, slice_id, project_name, project_description,\n slice_name, slice_description, controller_url,\n owner_email, owner_password,\n switch_slivers, **kwargs): \n '''\n Create an OpenFlow slice. \n \n The C{switch_sliver} list contains a dict for each switch to be added to the\n slice's topology. Each such dict has the following items:\n \n - C{datapath_id}: the switch's datapath id\n - C{flowspace}: an array of dicts describing the switch's flowspace\n Each such dict has the following keys:\n - C{id}: integer. Per clearinghouse unique identifier for the rule.\n - C{port_num_start}, C{port_num_end}: string. the port range for this \n flowspace\n - C{dl_src_start}, C{dl_src_end}: string. link layer address range in\n \"xx:xx:xx:xx:xx:xx\" format or '*' for wildcard\n - C{dl_dst_start}, C{dl_dst_end}: string. link layer address range in\n \"xx:xx:xx:xx:xx:xx\" format or '*' for wildcard\n - C{vlan_id_start}, C{vlan_id_end}: string. vlan id range or\n \"*\" for wildcard\n - C{nw_src_start}, C{nw_src_end}: string. network address range in \n \"x.x.x.x\" format or '*' for wildcard\n - C{nw_dst_start}, C{nw_dst_end}: string. network address range in\n \"x.x.x.x\" format or '*' for wildcard\n - C{nw_proto_start}, C{nw_proto_end}: string. network protocol range or\n \"*\" for wildcard\n - C{tp_src_start}, C{tp_src_end}: string. transport port range or \"*\"\n for wildcard\n - C{tp_dst_start}, C{tp_dst_end}: string. transport port range or \"*\"\n for wildcard\n\n The call returns a dict with the following items:\n - C{error_msg}: a summary error message or \"\" if no errors occurred.\n - C{switches}: a list of dicts with the following items:\n - C{datapath_id}: id of the switch that caused the error\n - C{error}: optional error msg for the switch\n - all other fields of the C{switch_sliver} dicts mentioned above\n (port_num, direction, ...). The values for these items are the error\n messages associated with each field.\n\n @param slice_id: a string that uniquely identifies the slice at the \n clearinghouse.\n @type slice_id: int\n \n @param project_name: a name for the project under which this slice \n is created\n @type project_name: string\n \n @param project_description: text describing the project\n @type project_description: string\n \n @param slice_name: Name for the slice\n @type slice_name: string\n \n @param slice_description: text describing the slice/experiment\n @type slice_description: string\n \n @param controller_url: The URL for the slice's OpenFlow controller specified\n as <transport>:<hostname>[:<port>], where:\n - tranport is 'tcp' ('ssl' will be added later)\n - hostname is the controller's hostname\n - port is the port on which the controller listens to openflow\n messages (defaults to 6633).\n @type controller_url: string\n \n @param owner_email: email of the person responsible for the slice\n @type owner_email: string\n \n @param owner_password: initial password the user can use to login to the\n FlowVisor Web interface. Will need to be changed on initial login.\n @type owner_password: string\n \n @param switch_slivers: description of the topology and flowspace for slice\n @type switch_slivers: list of dicts\n \n @param kwargs: will contain additional useful information about the request.\n Of most use are the items in the C{kwargs['request'].META} dict. These\n include 'REMOTE_USER' which is the username of the user connecting or\n if using x509 certs then the domain name. Additionally, kwargs has the\n user using the 'user' key.\n \n @return: switches and links that have caused errors\n @rtype: dict\n '''\n slice_id = slice_id.replace(\":\",\"_\")\n slice_id = slice_id.replace(\"name_\",\"nam__\")\n slice_name = slice_name.replace(\":\",\"_\") \n \n# self._actionLog.info(\"Legacy Expedient API: create_slice got the following:\")\n# self._actionLog.info(\" slice_id: %s\" % slice_id)\n# self._actionLog.info(\" project_name: %s\" % project_name)\n# self._actionLog.info(\" project_desc: %s\" % project_description)\n# self._actionLog.info(\" slice_name: %s\" % slice_name)\n# self._actionLog.info(\" slice_desc: %s\" % slice_description)\n# self._actionLog.info(\" controller: %s\" % controller_url)\n# self._actionLog.info(\" owner_email: %s\" % owner_email)\n# self._actionLog.info(\" owner_pass: %s\" % owner_password)\n #self._actionLog.info(\" switch_slivers\"\n #pprint(switch_slivers, indent=8)\n \n #legacy experiment creation (old database access)\n ''' \n e = Experiment.objects.filter(slice_id=slice_id)\n if (e.count()>0):\n old_e = e[0]\n old_fv_name = old_e.get_fv_slice_name()\n update_exp = True\n old_exp_fs = ExperimentFLowSpace.objects.filtswier(exp=old_e)\n else:\n update_exp = False \n ''' \n \n# e = Experiment()\n# e.slice_id = slice_id\n# e.project_name = project_name\n# e.project_desc = project_description\n# e.slice_name = slice_name\n# e.slice_desc = slice_description\n# e.controller_url = controller_url\n# e.owner_email = owner_email\n# e.owner_password = owner_password\n# e.save()\n #update dict info\n purged_switch_slivers = self.purge_switch_slivers_from_null_fs(switch_slivers)\n self.slice_info_dict[slice_id] = {}\n self.slice_info_dict[slice_id]['project_name'] = project_name\n self.slice_info_dict[slice_id]['project_desc'] = project_description\n self.slice_info_dict[slice_id]['slice_name'] = slice_name\n self.slice_info_dict[slice_id]['slice_desc'] = slice_description\n self.slice_info_dict[slice_id]['controller_url'] = controller_url\n self.slice_info_dict[slice_id]['owner_email'] = owner_email\n self.slice_info_dict[slice_id]['owner_password'] = owner_password\n self.slice_info_dict[slice_id]['switch_slivers'] = purged_switch_slivers\n \n all_efs = self.create_slice_fs(purged_switch_slivers)\n \n #set the necessary parameters so that we can use FOAM internal functions for sliver creation\n #Vasileios: now that the requested flowspaces are identified, create the rspec (to be used in FOAM)\n slice_of_rspec = create_ofv3_rspec(slice_id, project_name, project_description, \\\n slice_name, slice_description, controller_url, \\\n owner_email, owner_password, \\\n purged_switch_slivers, all_efs)\n self._log.info(slice_of_rspec) #print the rspec in the log for debugging\n\n #form the slice URN according to http://groups.geni.net/geni/wiki/GeniApiIdentifiers\n slice_urn = \"urn:publicid:IDN+openflow:foam:\"+ str(THIS_SITE_TAG) +\"+slice+\" + \"id_\" + str(slice_id) + \"name_\" + str(slice_name) \n creds = [] #creds are not needed at least for now: to be fixed\n user_info = {}\n user_info[\"urn\"] = \"urn:publicid:IDN+openflow:foam\"+ str(THIS_SITE_TAG) +\"+ch+\" + \"user+\" + str(owner_email) #temp hack\n user_info[\"email\"] = str(owner_email)\n \n #now we have: slice_urn, creds, rspec and user_info : great!\n update_exp = True \n #if GeniDB.getSliverURN(slice_urn) is None:\n if not GeniDB.sliceExists(slice_urn):\n update_exp = False \n\n #moving on (now use gapi2 calls)\n if (update_exp):\n try:\n #old_exp_fs.delete()\n #old_e.delete()\n old_exp_shutdown_success = self.priv_DeleteSliver(slice_urn, creds, [])\n except Exception, e:\n import traceback\n traceback.print_exc()\n raise Exception(\"Exception while trying to shutdown old slice!\")\n if old_exp_shutdown_success == False:\n raise Exception(\"Old slice could not be shutdown\")\n \n #create new slice\n creation_result = self.priv_CreateSliver(slice_urn, creds, slice_of_rspec, user_info)\n \n #legacy save flowspace\n #for fs in all_efs:\n # fs.save() \n #self._log.info(\"Created slice with %s %s %s %s\" % (\n # e.get_fv_slice_name(), owner_password, controller_url, owner_email))\n #transaction.commit()\n \n #store updated dict as a json file in foam db folder\n filedir = './opt/ofelia/ofam/local/db'\n filename = os.path.join(filedir, 'expedient_slices_info.json')\n tempfilename = os.path.join(filedir, 'expedient_slices_info.json.temp.' + str(time.time()) + str(random.randint(1,10000)))\n f = open(tempfilename, 'w')\n json.dump(self.slice_info_dict, f)\n f.close()\n os.rename(tempfilename, filename)\n \n return {\n 'error_msg': \"\",\n 'switches': [],\n } ", "metadata": "root.AMLegExpAPI.pub_create_slice", "header": "['class', 'AMLegExpAPI', '(', 'foam', '.', 'api', '.', 'xmlrpc', '.', 'Dispatcher', ')', ':', '___EOS___']", "index": 395 }, { "content": " def pub_delete_slice(self, slice_id, **kwargs):\n '''\n Delete the slice with id slice_id.\n \n @param slice_id: an int that uniquely identifies the slice at the \n Clearinghouseclearinghouse.\n @type sliceid: int\n @param kwargs: will contain additional useful information about the request.\n Of most use are the items in the C{kwargs['request'].META} dict. These\n include 'REMOTE_USER' which is the username of the user connecting or\n if using x509 certs then the domain name.\n @return error message if there are any errors or \"\" otherwise.\n '''\n slice_id = slice_id.replace(\":\",\"_\")\n slice_id = slice_id.replace(\"name_\",\"nam__\")\n #legacy deletion (just for compatibility)\n ''' \n try:\n single_exp = Experiment.objects.get(slice_id = sliceid)\n except Experiment.DoesNotExist:\n return \"Experiment Doesnot Exist\"\n ofs = OptsFlowSpace.objects.filter(opt__experiment = single_exp)\n for fs in ofs:\n MatchStruct.objects.filter(optfs = fs).delete()\n # delete all flowspaces opted into this exp : not sure if this is still needed\n ofs.delete()\n UserOpts.objects.filter(experiment = single_exp).delete()\n ExperimentFLowSpace.objects.filter(exp = single_exp).delete()\n single_exp.delete()\n '''\n \n #FOAM deletion\n slice_urn = \"urn:publicid:IDN+openflow:foam:\"+ str(THIS_SITE_TAG) +\"+slice+\" + \"id_\" + str(slice_id) + \"name_\" + str(self.slice_info_dict[slice_id]['slice_name'])\n creds = []\n deleted_slice_info = self.priv_DeleteSliver(slice_urn, creds, [])\n del self.slice_info_dict[slice_id]\n\n #store updated dict as a json file in foam db folder\n filedir = './opt/ofelia/ofam/local/db'\n filename = os.path.join(filedir, 'expedient_slices_info.json')\n tempfilename = os.path.join(filedir, 'expedient_slices_info.json.temp.' + str(time.time()) + str(random.randint(1,10000)))\n f = open(tempfilename, 'w')\n json.dump(self.slice_info_dict, f)\n f.close()\n os.rename(tempfilename, filename)\n \n return \"\"", "metadata": "root.AMLegExpAPI.pub_delete_slice", "header": "['class', 'AMLegExpAPI', '(', 'foam', '.', 'api', '.', 'xmlrpc', '.', 'Dispatcher', ')', ':', '___EOS___']", "index": 595 }, { "content": " def pub_change_slice_controller(self, slice_id, controller_url, **kwargs):\n slice_id = slice_id.replace(\":\",\"_\")\n slice_id = slice_id.replace(\"name_\",\"nam__\")\n '''\n Changes the slice controller url.\n '''\n if slice_id not in self.slice_info_dict:\n self._log.info(\"Slice is probably not started yet, doing nothing...\")\n return \"\"\n #raise Exception(\"Something went wrong with the fs recovery\")\n #retrieve updated dict as a json file from foam db folder\n filedir = './opt/ofelia/ofam/local/db'\n filename = os.path.join(filedir, 'expedient_slices_info.json')\n if os.path.isfile(filename):\n f = open(filename, 'r')\n self.slice_info_dict = json.load(f)\n f.close()\n else:\n self._log.info(\"Slice is probably not started yet, doing nothing...\")\n return \"\"\n slice_of_rspec = create_ofv3_rspec(slice_id, self.slice_info_dict[slice_id]['project_name'], \n self.slice_info_dict[slice_id]['project_desc'],\n self.slice_info_dict[slice_id]['slice_name'],\n self.slice_info_dict[slice_id]['slice_desc'], controller_url,\n self.slice_info_dict[slice_id]['owner_email'],\n self.slice_info_dict[slice_id]['owner_password'],\n self.slice_info_dict[slice_id]['switch_slivers'],\n self.create_slice_fs(self.slice_info_dict[slice_id]['switch_slivers']))\n self.slice_info_dict[slice_id]['controller_url'] = controller_url\n slice_urn = \"urn:publicid:IDN+openflow:foam:\"+ str(THIS_SITE_TAG) +\"+slice+\" + \"id_\" + str(slice_id) + \"name_\" + str(self.slice_info_dict[slice_id]['slice_name'])\n creds = [] #creds are not needed at least for now: to be fixed\n user_info = {}\n user_info[\"urn\"] = \"urn:publicid:IDN+openflow:foam\"+ str(THIS_SITE_TAG) +\"+ch+\" + \"user+\" + str(self.slice_info_dict[slice_id]['owner_email']) #temp hack\n user_info[\"email\"] = str(self.slice_info_dict[slice_id]['owner_email'])\n if GeniDB.sliceExists(slice_urn):\n sliv_urn = GeniDB.getSliverURN(slice_urn)\n else:\n raise Exception(\"Something went wrong with the fs recovery, slice does not exist!\")\n sliver = GeniDB.getSliverObj(sliv_urn) \n is_allocated_by_FV = GeniDB.getEnabled(sliv_urn)\n was_allocated_by_FV = is_allocated_by_FV\n try:\n #old_exp_shutdown_success = legexpgapi2_apih.pub_Shutdown(slice_urn, creds, [])\n old_exp_shutdown_success = self.priv_DeleteSliver(slice_urn, creds, [])\n except Exception, e:\n import traceback\n traceback.print_exc()\n raise Exception(\"Exception while trying to shutdown old slice!\")\n if old_exp_shutdown_success == False:\n raise Exception(\"Old slice could not be shutdown\")\n if was_allocated_by_FV == True:\n #create new slice and automatically approve since already approved (only controller changes)\n creation_result = self.priv_CreateSliver(slice_urn, creds, slice_of_rspec, user_info, True, None)\n else:\n creation_result = self.priv_CreateSliver(slice_urn, creds, slice_of_rspec, user_info, False, None)\n\n #store updated dict as a json file in foam db folder\n filedir = './opt/ofelia/ofam/local/db'\n filename = os.path.join(filedir, 'expedient_slices_info.json')\n tempfilename = os.path.join(filedir, 'expedient_slices_info.json.temp.' + str(time.time()) + str(random.randint(1,10000)))\n f = open(tempfilename, 'w')\n json.dump(self.slice_info_dict, f)\n f.close()\n os.rename(tempfilename, filename)\n \n return \"\"", "metadata": "root.AMLegExpAPI.pub_change_slice_controller", "header": "['class', 'AMLegExpAPI', '(', 'foam', '.', 'api', '.', 'xmlrpc', '.', 'Dispatcher', ')', ':', '___EOS___']", "index": 645 }, { "content": " def pub_get_granted_flowspace(self, slice_id, **kwargs):\n '''\n Return FlowVisor Rules for the slice.\n '''\n slice_id = slice_id.replace(\":\",\"_\")\n slice_id = slice_id.replace(\"name_\",\"nam__\")\n def parse_granted_flowspaces(gfs):\n gfs_list=[] \n for fs in gfs:\n fs_dict = dict(\n flowspace=dict(),\n openflow=dict()\n )\n fs_dict['openflow']=[]\n fs_dict['flowspace']=dict(\n mac_src_s=int_to_mac(fs.mac_src_s),\n mac_src_e=int_to_mac(fs.mac_src_e),\n mac_dst_s=int_to_mac(fs.mac_dst_s),\n mac_dst_e=int_to_mac(fs.mac_dst_e),\n eth_type_s=fs.eth_type_s,\n eth_type_e=fs.eth_type_e,\n vlan_id_s=fs.vlan_id_s,\n vlan_id_e=fs.vlan_id_e,\n ip_src_s=int_to_dotted_ip(fs.ip_src_s),\n ip_dst_s=int_to_dotted_ip(fs.ip_dst_s),\n ip_src_e=int_to_dotted_ip(fs.ip_src_e),\n ip_dst_e=int_to_dotted_ip(fs.ip_dst_e),\n ip_proto_s=fs.ip_proto_s,\n ip_proto_e=fs.ip_proto_e,\n tp_src_s=fs.tp_src_s,\n tp_dst_s=fs.tp_dst_s,\n tp_src_e=fs.tp_src_e,\n tp_dst_e=fs.tp_dst_e,\n )\n openflow_dict=dict(\n dpid=fs.dpid, \n direction=fs.direction, \n port_number_s=fs.port_number_s, \n port_number_e=fs.port_number_e, \n )\n existing_fs = False\n for prev_dict_list in gfs_list:\n prev_dict = prev_dict_list[0]\n if fs_dict['flowspace'] == prev_dict['flowspace']:\n if openflow_dict not in prev_dict['openflow']:\n prev_dict['openflow'].append(openflow_dict)\n existing_fs = True\n break\n if not existing_fs:\n fs_dict['openflow'].append(openflow_dict) \n fs_list = [fs_dict]\n gfs_list.append(fs_list)\n \n return gfs_list\n\n if slice_id in self.slice_info_dict:\n slice_urn = \"urn:publicid:IDN+openflow:foam:\"+ str(THIS_SITE_TAG) +\"+slice+\" + \"id_\" + str(slice_id) + \"name_\" + str(self.slice_info_dict[slice_id]['slice_name'])\n else:\n return [] \n if GeniDB.sliceExists(slice_urn):\n sliv_urn = GeniDB.getSliverURN(slice_urn)\n else:\n return []\n #raise Exception(parseFVexception(e))\n sliver = GeniDB.getSliverObj(sliv_urn) \n is_allocated_by_FV = GeniDB.getEnabled(sliv_urn)\n if is_allocated_by_FV == True:\n #that means that the flow space as requested was allocated\n #so retrieve the fs in the form Expedient understands\n #TODO: check that ecery time this corresponds to the actual flowspec that FOAM has\n #retrieve updated dict as a json file from foam db folder\n filedir = './opt/ofelia/ofam/local/db'\n filename = os.path.join(filedir, 'expedient_slices_info.json')\n if os.path.isfile(filename):\n f = open(filename, 'r')\n self.slice_info_dict = json.load(f)\n f.close()\n else:\n self._log.info(\"Slice is probably not started yet, doing nothing...\")\n return []\n if slice_id not in self.slice_info_dict:\n raise Exception(\"Something went wrong with the fs recovery\")\n all_efs = self.create_slice_fs(self.slice_info_dict[slice_id]['switch_slivers']) \n gfs = [] \n try: \n gfs = parse_granted_flowspaces(all_efs)\n except Exception,e:\n import traceback\n traceback.print_exc()\n self._log.exception(\"FlowSpace for the allocated slice is not returned\")\n raise Exception(parseFVexception(e))\n #self._log.info(\"FlowSpace for the allocated slice is returned\")\n #for fs_list in gfs:\n # fs = fs_list[0]\n # self._log.info(fs['flowspace'])\n # self._log.info(fs['openflow'])\n if gfs == []:\n self._log.info(\"Empty FlowSpace for the allocated slice returned! Need to debug...\")\n return gfs\n else:\n return [] ", "metadata": "root.AMLegExpAPI.pub_get_granted_flowspace", "header": "['class', 'AMLegExpAPI', '(', 'foam', '.', 'api', '.', 'xmlrpc', '.', 'Dispatcher', ')', ':', '___EOS___']", "index": 874 } ]
[ { "span": "cred_ids ", "start_line": 130, "start_column": 4, "end_line": 130, "end_column": 12 }, { "span": "creation_result ", "start_line": 568, "start_column": 4, "end_line": 568, "end_column": 19 }, { "span": "deleted_slice_info ", "start_line": 629, "start_column": 4, "end_line": 629, "end_column": 22 }, { "span": "sliver ", "start_line": 683, "start_column": 4, "end_line": 683, "end_column": 10 }, { "span": "creation_result ", "start_line": 697, "start_column": 6, "end_line": 697, "end_column": 21 }, { "span": "creation_result ", "start_line": 699, "start_column": 6, "end_line": 699, "end_column": 21 }, { "span": "sliver ", "start_line": 938, "start_column": 4, "end_line": 938, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "AM", "Leg", "Exp", "API_", "(_", "foa", "m_", "._", "api_", "._", "xmlrpc", "_", "._", "Dispatcher_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "record", "Action_", "(_", "self_", ",_", "action_", ",_", "credentials_", "=_", "[_", "]_", ",_", "urn_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cred", "\\u", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "action", "Log_", "._", "info_", "(_", "\"", "Sli", "ver", ":", " ", "%", "s", " ", " ", "Leg", "Exp", "API", " ", "Action", ":", " ", "%", "s", "\"_", "%_", "(_", "urn_", ",_", "action_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cred_", "in_", "credentials_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "action", "Log_", "._", "info_", "(_", "\"", "Cred", "ential", ":", " ", "%", "s", "\"_", "%_", "(_", "cred_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AM", "Leg", "Exp", "API_", "(_", "foa", "m_", "._", "api_", "._", "xmlrpc", "_", "._", "Dispatcher_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pub", "\\u", "create", "\\u", "slice_", "(_", "self_", ",_", "slice", "\\u", "id_", ",_", "project", "\\u", "name_", ",_", "project", "\\u", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "name_", ",_", "slice", "\\u", "description_", ",_", "controlle", "r", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "owner", "\\u", "email_", ",_", "owner", "\\u", "password_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "switch", "\\u", "sli", "vers_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "an", " ", "Open", "Flow", " ", "slice", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "C", "{", "switch", "\\u", "sli", "ver", "}", " ", "list", " ", "contain", "s", " ", "a", " ", "dict", " ", "for", " ", "each", " ", "switch", " ", "to", " ", "be", " ", "adde", "d", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "slice", "'", "s", " ", "topo", "log", "y", ".", " ", "Ea", "ch", " ", "suc", "h", " ", "dict", " ", "has", " ", "the", " ", "follow", "ing", " ", "items", ":", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "datapath", "\\u", "id", "}:", " ", "the", " ", "switch", "'", "s", " ", "datapath", " ", "id", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "flow", "space", "}:", " ", "an", " ", "array", " ", "of", " ", "dict", "s", " ", "descri", "bing", " ", "the", " ", "switch", "'", "s", " ", "flow", "space", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "suc", "h", " ", "dict", " ", "has", " ", "the", " ", "follow", "ing", " ", "keys", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "id", "}:", " ", "integ", "er", ".", " ", "Per", " ", "clear", "ing", "house", " ", "unique", " ", "identifi", "er", " ", "for", " ", "the", " ", "rule", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "port", "\\u", "num", "\\u", "start", "},", " ", "C", "{", "port", "\\u", "num", "\\u", "end", "}:", " ", "string", ".", " ", "the", " ", "port", " ", "range", " ", "for", " ", "this", " ", "\\", "10", ";", " ", " ", " ", " ", "flow", "space", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "dl", "\\u", "src", "\\u", "start", "},", " ", "C", "{", "dl", "\\u", "src", "\\u", "end", "}:", " ", "string", ".", " ", "link", " ", "layer", " ", "address", " ", "range", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "\"", "xx", ":", "xx", ":", "xx", ":", "xx", ":", "xx", ":", "xx", "\"", " ", "format", " ", "or", " ", "'*", "'", " ", "for", " ", "wild", "card", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "dl", "\\u", "dst", "\\u", "start", "},", " ", "C", "{", "dl", "\\u", "dst", "\\u", "end", "}:", " ", "string", ".", " ", "link", " ", "layer", " ", "address", " ", "range", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "\"", "xx", ":", "xx", ":", "xx", ":", "xx", ":", "xx", ":", "xx", "\"", " ", "format", " ", "or", " ", "'*", "'", " ", "for", " ", "wild", "card", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "vlan", "\\u", "id", "\\u", "start", "},", " ", "C", "{", "vlan", "\\u", "id", "\\u", "end", "}:", " ", "string", ".", " ", "vlan", " ", "id", " ", "range", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "\"*", "\"", " ", "for", " ", "wild", "card", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "nw", "\\u", "src", "\\u", "start", "},", " ", "C", "{", "nw", "\\u", "src", "\\u", "end", "}:", " ", "string", ".", " ", "network", " ", "address", " ", "range", " ", "in", " ", "\\", "10", ";", " ", " ", " ", " ", "\"", "x", ".", "x", ".", "x", ".", "x", "\"", " ", "format", " ", "or", " ", "'*", "'", " ", "for", " ", "wild", "card", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "nw", "\\u", "dst", "\\u", "start", "},", " ", "C", "{", "nw", "\\u", "dst", "\\u", "end", "}:", " ", "string", ".", " ", "network", " ", "address", " ", "range", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "\"", "x", ".", "x", ".", "x", ".", "x", "\"", " ", "format", " ", "or", " ", "'*", "'", " ", "for", " ", "wild", "card", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "nw", "\\u", "proto", "\\u", "start", "},", " ", "C", "{", "nw", "\\u", "proto", "\\u", "end", "}:", " ", "string", ".", " ", "network", " ", "protoc", "ol", " ", "range", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "\"*", "\"", " ", "for", " ", "wild", "card", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "tp", "\\u", "src", "\\u", "start", "},", " ", "C", "{", "tp", "\\u", "src", "\\u", "end", "}:", " ", "string", ".", " ", "transport", " ", "port", " ", "range", " ", "or", " ", "\"*", "\"", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "wild", "card", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "tp", "\\u", "dst", "\\u", "start", "},", " ", "C", "{", "tp", "\\u", "dst", "\\u", "end", "}:", " ", "string", ".", " ", "transport", " ", "port", " ", "range", " ", "or", " ", "\"*", "\"", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "wild", "card", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "call", " ", "return", "s", " ", "a", " ", "dict", " ", "with", " ", "the", " ", "follow", "ing", " ", "items", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "error", "\\u", "msg", "}:", " ", "a", " ", "summar", "y", " ", "error", " ", "message", " ", "or", " ", "\"\"", " ", "if", " ", "no", " ", "error", "s", " ", "occur", "red", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "switche", "s", "}:", " ", "a", " ", "list", " ", "of", " ", "dict", "s", " ", "with", " ", "the", " ", "follow", "ing", " ", "items", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "datapath", "\\u", "id", "}:", " ", "id", " ", "of", " ", "the", " ", "switch", " ", "tha", "t", " ", "caus", "ed", " ", "the", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "C", "{", "error", "}:", " ", "option", "al", " ", "error", " ", "msg", " ", "for", " ", "the", " ", "switch", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "all", " ", "other", " ", "fields", " ", "of", " ", "the", " ", "C", "{", "switch", "\\u", "sli", "ver", "}", " ", "dict", "s", " ", "mentioned", " ", "above", "\\", "10", ";", " ", " ", " ", " ", "(", "port", "\\u", "num", ",", " ", "direction", ",", " ", "...)", ".", " ", "The", " ", "values", " ", "for", " ", "these", " ", "items", " ", "are", " ", "the", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "message", "s", " ", "associate", "d", " ", "with", " ", "each", " ", "field", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "slice", "\\u", "id", ":", " ", "a", " ", "string", " ", "tha", "t", " ", "unique", "ly", " ", "identifi", "es", " ", "the", " ", "slice", " ", "at", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "clear", "ing", "house", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "slice", "\\u", "id", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "project", "\\u", "name", ":", " ", "a", " ", "name", " ", "for", " ", "the", " ", "project", " ", "under", " ", "whi", "ch", " ", "this", " ", "slice", " ", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "created", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "project", "\\u", "name", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "project", "\\u", "description", ":", " ", "text", " ", "descri", "bing", " ", "the", " ", "project", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "project", "\\u", "description", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "slice", "\\u", "name", ":", " ", "Name", " ", "for", " ", "the", " ", "slice", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "slice", "\\u", "name", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "slice", "\\u", "description", ":", " ", "text", " ", "descri", "bing", " ", "the", " ", "slice", "/", "experiment", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "slice", "\\u", "description", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "controlle", "r", "\\u", "url", ":", " ", "The", " ", "URL", " ", "for", " ", "the", " ", "slice", "'", "s", " ", "Open", "Flow", " ", "controlle", "r", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "<", "transport", ">:", "<", "host", "name", ">[", ":", "<", "port", ">]", ",", " ", "where", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "tran", "port", " ", "is", " ", "'", "tcp", "'", " ", "('", "ssl", "'", " ", "will", " ", "be", " ", "adde", "d", " ", "late", "r", ")", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "host", "name", " ", "is", " ", "the", " ", "controlle", "r", "'", "s", " ", "host", "name", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "port", " ", "is", " ", "the", " ", "port", " ", "on", " ", "whi", "ch", " ", "the", " ", "controlle", "r", " ", "listen", "s", " ", "to", " ", "openf", "low", "\\", "10", ";", " ", " ", " ", " ", "message", "s", " ", "(", "default", "s", " ", "to", " ", "663", "3", ").", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "controlle", "r", "\\u", "url", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "owner", "\\u", "email", ":", " ", "email", " ", "of", " ", "the", " ", "person", " ", "responsib", "le", " ", "for", " ", "the", " ", "slice", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "owner", "\\u", "email", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "owner", "\\u", "password", ":", " ", "initial", " ", "password", " ", "the", " ", "user", " ", "can", " ", "use", " ", "to", " ", "login", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Flow", "Vis", "or", " ", "Web", " ", "interface", ".", " ", "Wil", "l", " ", "need", " ", "to", " ", "be", " ", "change", "d", " ", "on", " ", "initial", " ", "login", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "owner", "\\u", "password", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "switch", "\\u", "sli", "vers", ":", " ", "description", " ", "of", " ", "the", " ", "topo", "log", "y", " ", "and", " ", "flow", "space", " ", "for", " ", "slice", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "switch", "\\u", "sli", "vers", ":", " ", "list", " ", "of", " ", "dict", "s", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "kwarg", "s", ":", " ", "will", " ", "contain", " ", "addition", "al", " ", "usef", "ul", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "Of", " ", "most", " ", "use", " ", "are", " ", "the", " ", "items", " ", "in", " ", "the", " ", "C", "{", "kwarg", "s", "['", "request", "']", ".", "MET", "A", "}", " ", "dict", ".", " ", "The", "se", "\\", "10", ";", " ", " ", " ", " ", "include", " ", "'", "REMO", "TE", "\\u", "USER", "'", " ", "whi", "ch", " ", "is", " ", "the", " ", "user", "name", " ", "of", " ", "the", " ", "user", " ", "connecti", "ng", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "usi", "ng", " ", "x5", "09", " ", "cert", "s", " ", "then", " ", "the", " ", "domain", " ", "name", ".", " ", "Addition", "ally", ",", " ", "kwarg", "s", " ", "has", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "user", " ", "usi", "ng", " ", "the", " ", "'", "user", "'", " ", "key", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "switche", "s", " ", "and", " ", "link", "s", " ", "tha", "t", " ", "have", " ", "caus", "ed", " ", "error", "s", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "=_", "slice", "\\u", "id_", "._", "replace_", "(_", "\":\"_", ",_", "\"\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "=_", "slice", "\\u", "id_", "._", "replace_", "(_", "\"", "name", "\\u\"_", ",_", "\"", "nam", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "name_", "=_", "slice", "\\u", "name_", "._", "replace_", "(_", "\":\"_", ",_", "\"\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "action", "Log", ".", "info", "(\"", "Leg", "ac", "y", " ", "Expe", "die", "nt", " ", "API", ":", " ", "create", "\\u", "slice", " ", "got", " ", "the", " ", "follow", "ing", ":\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "action", "Log", ".", "info", "(\"", " ", " ", " ", " ", "slice", "\\u", "id", ":", " ", "%", "s", "\"", " ", "%", " ", "slice", "\\u", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "action", "Log", ".", "info", "(\"", " ", " ", " ", " ", "project", "\\u", "name", ":", " ", "%", "s", "\"", " ", "%", " ", "project", "\\u", "name", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "action", "Log", ".", "info", "(\"", " ", " ", " ", " ", "project", "\\u", "desc", ":", " ", "%", "s", "\"", " ", "%", " ", "project", "\\u", "description", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "action", "Log", ".", "info", "(\"", " ", " ", " ", " ", "slice", "\\u", "name", ":", " ", "%", "s", "\"", " ", "%", " ", "slice", "\\u", "name", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "action", "Log", ".", "info", "(\"", " ", " ", " ", " ", "slice", "\\u", "desc", ":", " ", "%", "s", "\"", " ", "%", " ", "slice", "\\u", "description", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "action", "Log", ".", "info", "(\"", " ", " ", " ", " ", "controlle", "r", ":", " ", "%", "s", "\"", " ", "%", " ", "controlle", "r", "\\u", "url", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "action", "Log", ".", "info", "(\"", " ", " ", " ", " ", "owner", "\\u", "email", ":", " ", "%", "s", "\"", " ", "%", " ", "owner", "\\u", "email", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "action", "Log", ".", "info", "(\"", " ", " ", " ", " ", "owner", "\\u", "pass", ":", " ", "%", "s", "\"", " ", "%", " ", "owner", "\\u", "password", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".\\u", "action", "Log", ".", "info", "(\"", " ", " ", " ", " ", "switch", "\\u", "sli", "vers", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ppr", "int", "(", "switch", "\\u", "sli", "vers", ",", " ", "indent", "=", "8", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "lega", "cy", " ", "experiment", " ", "creati", "on", " ", "(", "old", " ", "databa", "se", " ", "access", ")_", "\\u\\u\\uNL\\u\\u\\u_", "'''", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "e", " ", "=", " ", "Experiment", ".", "object", "s", ".", "filter", "(", "slice", "\\u", "id", "=", "slice", "\\u", "id", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "e", ".", "count", "()", ">", "0", "):", "\\", "10", ";", " ", " ", "old", "\\u", "e", " ", "=", " ", "e", "[", "0", "]", "\\", "10", ";", " ", " ", "old", "\\u", "fv", "\\u", "name", " ", "=", " ", "old", "\\u", "e", ".", "get", "\\u", "fv", "\\u", "slice", "\\u", "name", "()", "\\", "10", ";", " ", " ", "update", "\\u", "exp", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", "old", "\\u", "exp", "\\u", "fs", " ", "=", " ", "Experiment", "FL", "ow", "Spac", "e", ".", "object", "s", ".", "filt", "swi", "er", "(", "exp", "=", "old", "\\u", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", "update", "\\u", "exp", " ", "=", " ", "Fal", "se", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", " ", "=", " ", "Experiment", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", ".", "slice", "\\u", "id", " ", "=", " ", "slice", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", ".", "project", "\\u", "name", " ", "=", " ", "project", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", ".", "project", "\\u", "desc", " ", "=", " ", "project", "\\u", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", ".", "slice", "\\u", "name", " ", "=", " ", "slice", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", ".", "slice", "\\u", "desc", " ", "=", " ", "slice", "\\u", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", ".", "controlle", "r", "\\u", "url", " ", "=", " ", "controlle", "r", "\\u", "url_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", ".", "owner", "\\u", "email", " ", "=", " ", "owner", "\\u", "email_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", ".", "owner", "\\u", "password", " ", "=", " ", "owner", "\\u", "password_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "e", ".", "save", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", " ", "dict", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "pur", "ged", "\\u", "switch", "\\u", "sli", "vers_", "=_", "self_", "._", "pur", "ge", "\\u", "switch", "\\u", "sli", "vers", "\\u", "from", "\\u", "null", "\\u", "fs_", "(_", "switch", "\\u", "sli", "vers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "project", "\\u", "name", "'_", "]_", "=_", "project", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "project", "\\u", "desc", "'_", "]_", "=_", "project", "\\u", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "slice", "\\u", "name", "'_", "]_", "=_", "slice", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "slice", "\\u", "desc", "'_", "]_", "=_", "slice", "\\u", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "controlle", "r", "\\u", "url", "'_", "]_", "=_", "controlle", "r", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "owner", "\\u", "email", "'_", "]_", "=_", "owner", "\\u", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "owner", "\\u", "password", "'_", "]_", "=_", "owner", "\\u", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "switch", "\\u", "sli", "vers", "'_", "]_", "=_", "pur", "ged", "\\u", "switch", "\\u", "sli", "vers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "efs_", "=_", "self_", "._", "create", "\\u", "slice", "\\u", "fs_", "(_", "pur", "ged", "\\u", "switch", "\\u", "sli", "vers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "the", " ", "necessar", "y", " ", "parameter", "s", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "use", " ", "FO", "AM", " ", "internal", " ", "function", "s", " ", "for", " ", "sli", "ver", " ", "creation_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Va", "sile", "ios", ":", " ", "now", " ", "tha", "t", " ", "the", " ", "request", "ed", " ", "flow", "space", "s", " ", "are", " ", "identifi", "ed", ",", " ", "create", " ", "the", " ", "rsp", "ec", " ", "(", "to", " ", "be", " ", "used", " ", "in", " ", "FO", "AM", ")_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "of", "\\u", "rsp", "ec_", "=_", "create", "\\u", "of", "v", "3", "\\u", "rsp", "ec_", "(_", "slice", "\\u", "id_", ",_", "project", "\\u", "name_", ",_", "project", "\\u", "description_", ",_", "slice", "\\u", "name_", ",_", "slice", "\\u", "description_", ",_", "controlle", "r", "\\u", "url_", ",_", "owner", "\\u", "email_", ",_", "owner", "\\u", "password_", ",_", "pur", "ged", "\\u", "switch", "\\u", "sli", "vers_", ",_", "all", "\\u", "efs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "._", "info_", "(_", "slice", "\\u", "of", "\\u", "rsp", "ec_", ")_", "#", "print", " ", "the", " ", "rsp", "ec", " ", "in", " ", "the", " ", "log", " ", "for", " ", "debugg", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "form", " ", "the", " ", "slice", " ", "URN", " ", "according", " ", "to", " ", "http", "://", "group", "s", ".", "geni", ".", "net", "/", "geni", "/", "wiki", "/", "Gen", "i", "Ap", "i", "Identifiers_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "urn_", "=_", "\"", "urn", ":", "public", "id", ":", "ID", "N", "+", "openf", "low", ":", "foa", "m", ":\"_", "+_", "str_", "(_", "THIS", "\\u", "SITE", "\\u", "TAG_", ")_", "+_", "\"+", "slice", "+\"_", "+_", "\"", "id", "\\u\"_", "+_", "str_", "(_", "slice", "\\u", "id_", ")_", "+_", "\"", "name", "\\u\"_", "+_", "str_", "(_", "slice", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "=_", "[_", "]_", "#", "creds", " ", "are", " ", "not", " ", "need", "ed", " ", "at", " ", "leas", "t", " ", "for", " ", "now", ":", " ", "to", " ", "be", " ", "fixed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "[_", "\"", "urn", "\"_", "]_", "=_", "\"", "urn", ":", "public", "id", ":", "ID", "N", "+", "openf", "low", ":", "foa", "m", "\"_", "+_", "str_", "(_", "THIS", "\\u", "SITE", "\\u", "TAG_", ")_", "+_", "\"+", "ch", "+\"_", "+_", "\"", "user", "+\"_", "+_", "str_", "(_", "owner", "\\u", "email_", ")_", "#", "temp", " ", "hack", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "[_", "\"", "email", "\"_", "]_", "=_", "str_", "(_", "owner", "\\u", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "now", " ", "we", " ", "have", ":", " ", "slice", "\\u", "urn", ",", " ", "creds", ",", " ", "rsp", "ec", " ", "and", " ", "user", "\\u", "info", " ", ":", " ", "great", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "exp_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "Gen", "i", "DB", ".", "get", "Sli", "ver", "URN", "(", "slice", "\\u", "urn", ")", " ", "is", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "Gen", "i", "DB_", "._", "slice", "Exists_", "(_", "slice", "\\u", "urn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "exp_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "movin", "g", " ", "on", " ", "(", "now", " ", "use", " ", "gap", "i2", " ", "calls", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "update", "\\u", "exp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "old", "\\u", "exp", "\\u", "fs", ".", "delete", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "old", "\\u", "e", ".", "delete", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "exp", "\\u", "shut", "down", "\\u", "success_", "=_", "self_", "._", "priv", "\\u", "Delete", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "creds_", ",_", "[_", "]_", ")_", "\\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 ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "Except", "ion", " ", "whi", "le", " ", "try", "ing", " ", "to", " ", "shut", "down", " ", "old", " ", "slice", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "old", "\\u", "exp", "\\u", "shut", "down", "\\u", "success_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Old", " ", "slice", " ", "coul", "d", " ", "not", " ", "be", " ", "shut", "down", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "create", " ", "new", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "creati", "on", "\\u", "result_", "=_", "self_", "._", "priv", "\\u", "Creat", "e", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "creds_", ",_", "slice", "\\u", "of", "\\u", "rsp", "ec_", ",_", "user", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "lega", "cy", " ", "save", " ", "flow", "space_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "fs", " ", "in", " ", "all", "\\u", "ef", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "fs", ".", "save", "()", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".\\u", "log", ".", "info", "(\"", "Creat", "ed", " ", "slice", " ", "with", " ", "%", "s", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "e", ".", "get", "\\u", "fv", "\\u", "slice", "\\u", "name", "()", ",", " ", "owner", "\\u", "password", ",", " ", "controlle", "r", "\\u", "url", ",", " ", "owner", "\\u", "email", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "transaction", ".", "commit", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "store", " ", "update", "d", " ", "dict", " ", "as", " ", "a", " ", "json", " ", "file", " ", "in", " ", "foa", "m", " ", "db", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "filedi", "r_", "=_", "'./", "opt", "/", "of", "eli", "a", "/", "ofa", "m", "/", "local", "/", "db", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filedi", "r_", ",_", "'", "expe", "die", "nt", "\\u", "slice", "s", "\\u", "info", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tempfile", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filedi", "r_", ",_", "'", "expe", "die", "nt", "\\u", "slice", "s", "\\u", "info", ".", "json", ".", "temp", ".'_", "+_", "str_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "+_", "str_", "(_", "random_", "._", "randint_", "(_", "1_", ",_", "10000_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "tempfile", "name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rename_", "(_", "tempfile", "name_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "\\u", "msg", "'_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "switche", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AM", "Leg", "Exp", "API_", "(_", "foa", "m_", "._", "api_", "._", "xmlrpc", "_", "._", "Dispatcher_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pub", "\\u", "delete", "\\u", "slice_", "(_", "self_", ",_", "slice", "\\u", "id_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "the", " ", "slice", " ", "with", " ", "id", " ", "slice", "\\u", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "slice", "\\u", "id", ":", " ", "an", " ", "int", " ", "tha", "t", " ", "unique", "ly", " ", "identifi", "es", " ", "the", " ", "slice", " ", "at", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "Clear", "ing", "house", "clear", "ing", "house", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "slice", "id", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "kwarg", "s", ":", " ", "will", " ", "contain", " ", "addition", "al", " ", "usef", "ul", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", "Of", " ", "most", " ", "use", " ", "are", " ", "the", " ", "items", " ", "in", " ", "the", " ", "C", "{", "kwarg", "s", "['", "request", "']", ".", "MET", "A", "}", " ", "dict", ".", " ", "The", "se", "\\", "10", ";", " ", " ", " ", " ", "include", " ", "'", "REMO", "TE", "\\u", "USER", "'", " ", "whi", "ch", " ", "is", " ", "the", " ", "user", "name", " ", "of", " ", "the", " ", "user", " ", "connecti", "ng", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "usi", "ng", " ", "x5", "09", " ", "cert", "s", " ", "then", " ", "the", " ", "domain", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "return", " ", "error", " ", "message", " ", "if", " ", "there", " ", "are", " ", "any", " ", "error", "s", " ", "or", " ", "\"\"", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "=_", "slice", "\\u", "id_", "._", "replace_", "(_", "\":\"_", ",_", "\"\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "=_", "slice", "\\u", "id_", "._", "replace_", "(_", "\"", "name", "\\u\"_", ",_", "\"", "nam", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "lega", "cy", " ", "deletion", " ", "(", "just", " ", "for", " ", "compatibility", ")_", "\\u\\u\\uNL\\u\\u\\u_", "'''", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "try", ":", "\\", "10", ";", " ", " ", "single", "\\u", "exp", " ", "=", " ", "Experiment", ".", "object", "s", ".", "get", "(", "slice", "\\u", "id", " ", "=", " ", "slice", "id", ")", "\\", "10", ";", " ", " ", " ", " ", "except", " ", "Experiment", ".", "Do", "es", "Not", "Exist", ":", "\\", "10", ";", " ", " ", "return", " ", "\"", "Experiment", " ", "Do", "esn", "ot", " ", "Exist", "\"", "\\", "10", ";", " ", " ", " ", " ", "ofs", " ", "=", " ", "Opt", "s", "Flow", "Spac", "e", ".", "object", "s", ".", "filter", "(", "opt", "\\u\\u", "experiment", " ", "=", " ", "single", "\\u", "exp", ")", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "fs", " ", "in", " ", "ofs", ":", "\\", "10", ";", " ", " ", "Match", "Stru", "ct", ".", "object", "s", ".", "filter", "(", "opt", "fs", " ", "=", " ", "fs", ").", "delete", "()", "\\", "10", ";", " ", " ", "#", " ", "delete", " ", "all", " ", "flow", "space", "s", " ", "opt", "ed", " ", "int", "o", " ", "this", " ", "exp", " ", ":", " ", "not", " ", "sure", " ", "if", " ", "this", " ", "is", " ", "still", " ", "need", "ed", "\\", "10", ";", " ", " ", "ofs", ".", "delete", "()", "\\", "10", ";", " ", " ", "User", "Opt", "s", ".", "object", "s", ".", "filter", "(", "experiment", " ", "=", " ", "single", "\\u", "exp", ").", "delete", "()", "\\", "10", ";", " ", " ", "Experiment", "FL", "ow", "Spac", "e", ".", "object", "s", ".", "filter", "(", "exp", " ", "=", " ", "single", "\\u", "exp", ").", "delete", "()", "\\", "10", ";", " ", " ", "single", "\\u", "exp", ".", "delete", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "FO", "AM", " ", "deletion_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "\\u", "urn_", "=_", "\"", "urn", ":", "public", "id", ":", "ID", "N", "+", "openf", "low", ":", "foa", "m", ":\"_", "+_", "str_", "(_", "THIS", "\\u", "SITE", "\\u", "TAG_", ")_", "+_", "\"+", "slice", "+\"_", "+_", "\"", "id", "\\u\"_", "+_", "str_", "(_", "slice", "\\u", "id_", ")_", "+_", "\"", "name", "\\u\"_", "+_", "str_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "slice", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "d\\u", "slice", "\\u", "info_", "=_", "self_", "._", "priv", "\\u", "Delete", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "creds_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "store", " ", "update", "d", " ", "dict", " ", "as", " ", "a", " ", "json", " ", "file", " ", "in", " ", "foa", "m", " ", "db", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "filedi", "r_", "=_", "'./", "opt", "/", "of", "eli", "a", "/", "ofa", "m", "/", "local", "/", "db", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filedi", "r_", ",_", "'", "expe", "die", "nt", "\\u", "slice", "s", "\\u", "info", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tempfile", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filedi", "r_", ",_", "'", "expe", "die", "nt", "\\u", "slice", "s", "\\u", "info", ".", "json", ".", "temp", ".'_", "+_", "str_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "+_", "str_", "(_", "random_", "._", "randint_", "(_", "1_", ",_", "10000_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "tempfile", "name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rename_", "(_", "tempfile", "name_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AM", "Leg", "Exp", "API_", "(_", "foa", "m_", "._", "api_", "._", "xmlrpc", "_", "._", "Dispatcher_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pub", "\\u", "change", "\\u", "slice", "\\u", "controller_", "(_", "self_", ",_", "slice", "\\u", "id_", ",_", "controlle", "r", "\\u", "url_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "\\u", "id_", "=_", "slice", "\\u", "id_", "._", "replace_", "(_", "\":\"_", ",_", "\"\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "=_", "slice", "\\u", "id_", "._", "replace_", "(_", "\"", "name", "\\u\"_", ",_", "\"", "nam", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "Change", "s", " ", "the", " ", "slice", " ", "controlle", "r", " ", "url", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "slice", "\\u", "id_", "not_", "in_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "info_", "(_", "\"", "Slice", " ", "is", " ", "probab", "ly", " ", "not", " ", "start", "ed", " ", "ye", "t", ",", " ", "doi", "ng", " ", "not", "hing", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Except", "ion", "(\"", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "with", " ", "the", " ", "fs", " ", "recover", "y", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "retrieve", " ", "update", "d", " ", "dict", " ", "as", " ", "a", " ", "json", " ", "file", " ", "from", " ", "foa", "m", " ", "db", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filedi", "r_", "=_", "'./", "opt", "/", "of", "eli", "a", "/", "ofa", "m", "/", "local", "/", "db", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filedi", "r_", ",_", "'", "expe", "die", "nt", "\\u", "slice", "s", "\\u", "info", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "filename_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "=_", "json_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "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 ", " _", "self_", "._", "\\u", "log_", "._", "info_", "(_", "\"", "Slice", " ", "is", " ", "probab", "ly", " ", "not", " ", "start", "ed", " ", "ye", "t", ",", " ", "doi", "ng", " ", "not", "hing", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "slice", "\\u", "of", "\\u", "rsp", "ec_", "=_", "create", "\\u", "of", "v", "3", "\\u", "rsp", "ec_", "(_", "slice", "\\u", "id_", ",_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "project", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "project", "\\u", "desc", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "slice", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "slice", "\\u", "desc", "'_", "]_", ",_", "controlle", "r", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "owner", "\\u", "email", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "owner", "\\u", "password", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "switch", "\\u", "sli", "vers", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "create", "\\u", "slice", "\\u", "fs_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "switch", "\\u", "sli", "vers", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "controlle", "r", "\\u", "url", "'_", "]_", "=_", "controlle", "r", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "urn_", "=_", "\"", "urn", ":", "public", "id", ":", "ID", "N", "+", "openf", "low", ":", "foa", "m", ":\"_", "+_", "str_", "(_", "THIS", "\\u", "SITE", "\\u", "TAG_", ")_", "+_", "\"+", "slice", "+\"_", "+_", "\"", "id", "\\u\"_", "+_", "str_", "(_", "slice", "\\u", "id_", ")_", "+_", "\"", "name", "\\u\"_", "+_", "str_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "slice", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "=_", "[_", "]_", "#", "creds", " ", "are", " ", "not", " ", "need", "ed", " ", "at", " ", "leas", "t", " ", "for", " ", "now", ":", " ", "to", " ", "be", " ", "fixed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "[_", "\"", "urn", "\"_", "]_", "=_", "\"", "urn", ":", "public", "id", ":", "ID", "N", "+", "openf", "low", ":", "foa", "m", "\"_", "+_", "str_", "(_", "THIS", "\\u", "SITE", "\\u", "TAG_", ")_", "+_", "\"+", "ch", "+\"_", "+_", "\"", "user", "+\"_", "+_", "str_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "owner", "\\u", "email", "'_", "]_", ")_", "#", "temp", " ", "hack", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "[_", "\"", "email", "\"_", "]_", "=_", "str_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "owner", "\\u", "email", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Gen", "i", "DB_", "._", "slice", "Exists_", "(_", "slice", "\\u", "urn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sli", "v", "\\u", "urn_", "=_", "Gen", "i", "DB_", "._", "get", "Sli", "ver", "URN", "_", "(_", "slice", "\\u", "urn_", ")_", "\\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_", "(_", "\"", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "with", " ", "the", " ", "fs", " ", "recover", "y", ",", " ", "slice", " ", "doe", "s", " ", "not", " ", "exist", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sli", "ver_", "=_", "Gen", "i", "DB_", "._", "get", "Sli", "ver", "Obj_", "(_", "sli", "v", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "allocated", "\\u", "by", "\\u", "FV", "_", "=_", "Gen", "i", "DB_", "._", "get", "Enabled_", "(_", "sli", "v", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "was", "\\u", "allocated", "\\u", "by", "\\u", "FV", "_", "=_", "is", "\\u", "allocated", "\\u", "by", "\\u", "FV", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "old", "\\u", "exp", "\\u", "shut", "down", "\\u", "success", " ", "=", " ", "leg", "exp", "gap", "i2", "\\u", "api", "h", ".", "pub", "\\u", "Shut", "down", "(", "slice", "\\u", "urn", ",", " ", "creds", ",", " ", "[]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "exp", "\\u", "shut", "down", "\\u", "success_", "=_", "self_", "._", "priv", "\\u", "Delete", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "creds_", ",_", "[_", "]_", ")_", "\\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 ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "Except", "ion", " ", "whi", "le", " ", "try", "ing", " ", "to", " ", "shut", "down", " ", "old", " ", "slice", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "old", "\\u", "exp", "\\u", "shut", "down", "\\u", "success_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Old", " ", "slice", " ", "coul", "d", " ", "not", " ", "be", " ", "shut", "down", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "was", "\\u", "allocated", "\\u", "by", "\\u", "FV", "_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "new", " ", "slice", " ", "and", " ", "automati", "call", "y", " ", "approve", " ", "sinc", "e", " ", "alr", "ead", "y", " ", "approved", " ", "(", "only", " ", "controlle", "r", " ", "change", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creati", "on", "\\u", "result_", "=_", "self_", "._", "priv", "\\u", "Creat", "e", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "creds_", ",_", "slice", "\\u", "of", "\\u", "rsp", "ec_", ",_", "user", "\\u", "info_", ",_", "True_", ",_", "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 ", " _", "creati", "on", "\\u", "result_", "=_", "self_", "._", "priv", "\\u", "Creat", "e", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "creds_", ",_", "slice", "\\u", "of", "\\u", "rsp", "ec_", ",_", "user", "\\u", "info_", ",_", "False_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "store", " ", "update", "d", " ", "dict", " ", "as", " ", "a", " ", "json", " ", "file", " ", "in", " ", "foa", "m", " ", "db", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filedi", "r_", "=_", "'./", "opt", "/", "of", "eli", "a", "/", "ofa", "m", "/", "local", "/", "db", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filedi", "r_", ",_", "'", "expe", "die", "nt", "\\u", "slice", "s", "\\u", "info", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tempfile", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filedi", "r_", ",_", "'", "expe", "die", "nt", "\\u", "slice", "s", "\\u", "info", ".", "json", ".", "temp", ".'_", "+_", "str_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "+_", "str_", "(_", "random_", "._", "randint_", "(_", "1_", ",_", "10000_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "tempfile", "name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rename_", "(_", "tempfile", "name_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AM", "Leg", "Exp", "API_", "(_", "foa", "m_", "._", "api_", "._", "xmlrpc", "_", "._", "Dispatcher_", ")_", ":_", "\\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_", "pub", "\\u", "get", "\\u", "grant", "ed", "\\u", "flow", "space_", "(_", "self_", ",_", "slice", "\\u", "id_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Flow", "Vis", "or", " ", "Rule", "s", " ", "for", " ", "the", " ", "slice", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "=_", "slice", "\\u", "id_", "._", "replace_", "(_", "\":\"_", ",_", "\"\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "=_", "slice", "\\u", "id_", "._", "replace_", "(_", "\"", "name", "\\u\"_", ",_", "\"", "nam", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "parse", "\\u", "grant", "ed", "\\u", "flow", "spaces_", "(_", "gf", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gf", "s", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fs_", "in_", "gf", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fs", "\\u", "dict_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "flow", "space_", "=_", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "openf", "low_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fs", "\\u", "dict_", "[_", "'", "openf", "low", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fs", "\\u", "dict_", "[_", "'", "flow", "space", "'_", "]_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mac", "\\u", "src", "\\u", "s_", "=_", "int\\u", "to", "\\u", "mac_", "(_", "fs_", "._", "mac", "\\u", "src", "\\u", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mac", "\\u", "src", "\\u", "e_", "=_", "int\\u", "to", "\\u", "mac_", "(_", "fs_", "._", "mac", "\\u", "src", "\\u", "e_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mac", "\\u", "dst", "\\u", "s_", "=_", "int\\u", "to", "\\u", "mac_", "(_", "fs_", "._", "mac", "\\u", "dst", "\\u", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mac", "\\u", "dst", "\\u", "e_", "=_", "int\\u", "to", "\\u", "mac_", "(_", "fs_", "._", "mac", "\\u", "dst", "\\u", "e_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eth", "\\u", "type", "\\u", "s_", "=_", "fs_", "._", "eth", "\\u", "type", "\\u", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eth", "\\u", "type", "\\u", "e_", "=_", "fs_", "._", "eth", "\\u", "type", "\\u", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vlan", "\\u", "id", "\\u", "s_", "=_", "fs_", "._", "vlan", "\\u", "id", "\\u", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vlan", "\\u", "id", "\\u", "e_", "=_", "fs_", "._", "vlan", "\\u", "id", "\\u", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "src", "\\u", "s_", "=_", "int\\u", "to", "\\u", "dot", "ted", "\\u", "ip_", "(_", "fs_", "._", "ip", "\\u", "src", "\\u", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "dst", "\\u", "s_", "=_", "int\\u", "to", "\\u", "dot", "ted", "\\u", "ip_", "(_", "fs_", "._", "ip", "\\u", "dst", "\\u", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "src", "\\u", "e_", "=_", "int\\u", "to", "\\u", "dot", "ted", "\\u", "ip_", "(_", "fs_", "._", "ip", "\\u", "src", "\\u", "e_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "dst", "\\u", "e_", "=_", "int\\u", "to", "\\u", "dot", "ted", "\\u", "ip_", "(_", "fs_", "._", "ip", "\\u", "dst", "\\u", "e_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "proto", "\\u", "s_", "=_", "fs_", "._", "ip", "\\u", "proto", "\\u", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ip", "\\u", "proto", "\\u", "e_", "=_", "fs_", "._", "ip", "\\u", "proto", "\\u", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tp", "\\u", "src", "\\u", "s_", "=_", "fs_", "._", "tp", "\\u", "src", "\\u", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tp", "\\u", "dst", "\\u", "s_", "=_", "fs_", "._", "tp", "\\u", "dst", "\\u", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tp", "\\u", "src", "\\u", "e_", "=_", "fs_", "._", "tp", "\\u", "src", "\\u", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tp", "\\u", "dst", "\\u", "e_", "=_", "fs_", "._", "tp", "\\u", "dst", "\\u", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "openf", "low", "\\u", "dict_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dpid_", "=_", "fs_", "._", "dpid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "direction_", "=_", "fs_", "._", "direction_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "number", "\\u", "s_", "=_", "fs_", "._", "port", "\\u", "number", "\\u", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "number", "\\u", "e_", "=_", "fs_", "._", "port", "\\u", "number", "\\u", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "fs_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prev", "\\u", "dict", "\\u", "list_", "in_", "gf", "s", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "\\u", "dict_", "=_", "prev", "\\u", "dict", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fs", "\\u", "dict_", "[_", "'", "flow", "space", "'_", "]_", "==_", "prev", "\\u", "dict_", "[_", "'", "flow", "space", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "openf", "low", "\\u", "dict_", "not_", "in_", "prev", "\\u", "dict_", "[_", "'", "openf", "low", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "\\u", "dict_", "[_", "'", "openf", "low", "'_", "]_", "._", "append_", "(_", "openf", "low", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exist", "ing", "\\u", "fs_", "=_", "True_", "\\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_", "if_", "not_", "exist", "ing", "\\u", "fs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fs", "\\u", "dict_", "[_", "'", "openf", "low", "'_", "]_", "._", "append_", "(_", "openf", "low", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fs", "\\u", "list_", "=_", "[_", "fs", "\\u", "dict_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf", "s", "\\u", "list_", "._", "append_", "(_", "fs", "\\u", "list_", ")_", "\\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_", "gf", "s", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "slice", "\\u", "id_", "in_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "\\u", "urn_", "=_", "\"", "urn", ":", "public", "id", ":", "ID", "N", "+", "openf", "low", ":", "foa", "m", ":\"_", "+_", "str_", "(_", "THIS", "\\u", "SITE", "\\u", "TAG_", ")_", "+_", "\"+", "slice", "+\"_", "+_", "\"", "id", "\\u\"_", "+_", "str_", "(_", "slice", "\\u", "id_", ")_", "+_", "\"", "name", "\\u\"_", "+_", "str_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "slice", "\\u", "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_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Gen", "i", "DB_", "._", "slice", "Exists_", "(_", "slice", "\\u", "urn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sli", "v", "\\u", "urn_", "=_", "Gen", "i", "DB_", "._", "get", "Sli", "ver", "URN", "_", "(_", "slice", "\\u", "urn_", ")_", "\\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_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Except", "ion", "(", "parse", "FV", "exception", "(", "e", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sli", "ver_", "=_", "Gen", "i", "DB_", "._", "get", "Sli", "ver", "Obj_", "(_", "sli", "v", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "allocated", "\\u", "by", "\\u", "FV", "_", "=_", "Gen", "i", "DB_", "._", "get", "Enabled_", "(_", "sli", "v", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "allocated", "\\u", "by", "\\u", "FV", "_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "tha", "t", " ", "means", " ", "tha", "t", " ", "the", " ", "flow", " ", "space", " ", "as", " ", "request", "ed", " ", "was", " ", "allocated", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "so", " ", "retrieve", " ", "the", " ", "fs", " ", "in", " ", "the", " ", "form", " ", "Expe", "die", "nt", " ", "underst", "ands", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "check", " ", "tha", "t", " ", "ece", "ry", " ", "time", " ", "this", " ", "correspond", "s", " ", "to", " ", "the", " ", "actual", " ", "flow", "spec", " ", "tha", "t", " ", "FO", "AM", " ", "has_", "\\u\\u\\uNL\\u\\u\\u_", "#", "retrieve", " ", "update", "d", " ", "dict", " ", "as", " ", "a", " ", "json", " ", "file", " ", "from", " ", "foa", "m", " ", "db", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filedi", "r_", "=_", "'./", "opt", "/", "of", "eli", "a", "/", "ofa", "m", "/", "local", "/", "db", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filedi", "r_", ",_", "'", "expe", "die", "nt", "\\u", "slice", "s", "\\u", "info", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "filename_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "=_", "json_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "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 ", " _", "self_", "._", "\\u", "log_", "._", "info_", "(_", "\"", "Slice", " ", "is", " ", "probab", "ly", " ", "not", " ", "start", "ed", " ", "ye", "t", ",", " ", "doi", "ng", " ", "not", "hing", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "slice", "\\u", "id_", "not_", "in_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "with", " ", "the", " ", "fs", " ", "recover", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "efs_", "=_", "self_", "._", "create", "\\u", "slice", "\\u", "fs_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "switch", "\\u", "sli", "vers", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gf", "s_", "=_", "parse", "\\u", "grant", "ed", "\\u", "flow", "spaces_", "(_", "all", "\\u", "efs_", ")_", "\\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 ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "._", "exception_", "(_", "\"", "Flow", "Spac", "e", " ", "for", " ", "the", " ", "allocated", " ", "slice", " ", "is", " ", "not", " ", "return", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "parse", "FV", "exception_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".\\u", "log", ".", "info", "(\"", "Flow", "Spac", "e", " ", "for", " ", "the", " ", "allocated", " ", "slice", " ", "is", " ", "return", "ed", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "fs", "\\u", "list", " ", "in", " ", "gf", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "fs", " ", "=", " ", "fs", "\\u", "list", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "self", ".\\u", "log", ".", "info", "(", "fs", "['", "flow", "space", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "self", ".\\u", "log", ".", "info", "(", "fs", "['", "openf", "low", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gf", "s_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "info_", "(_", "\"", "Emp", "ty", " ", "Flow", "Spac", "e", " ", "for", " ", "the", " ", "allocated", " ", "slice", " ", "return", "ed", "!", " ", "Ne", "ed", " ", "to", " ", "debug", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "gf", "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_", "[_", "]_", "\\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, 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, 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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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 ]
Except block handles 'BaseException'
nlloyd/SubliminalCollaborator/libs/twisted/protocols/tls.py
[ { "content": " def _pull(self):\n \"\"\"\n A generator that calls C{resumeProducing} on the underlying producer\n forever.\n\n If C{resumeProducing} throws an exception, the producer is\n unregistered, which should result in streaming stopping.\n \"\"\"\n while True:\n try:\n self._producer.resumeProducing()\n except:\n log.err(None, \"%s failed, producing will be stopped:\" %\n (safe_str(self._producer),))\n try:\n self._consumer.unregisterProducer()\n # The consumer should now call stopStreaming() on us,\n # thus stopping the streaming.\n except:\n # Since the consumer blew up, we may not have had\n # stopStreaming() called, so we just stop on our own:\n log.err(None, \"%s failed to unregister producer:\" %\n (safe_str(self._consumer),))\n self._finished = True\n return\n yield None", "metadata": "root._PullToPush._pull", "header": "['class', '_PullToPush', '(', 'object', ')', ':', '___EOS___']", "index": 95 } ]
[ { "span": "except:", "start_line": 106, "start_column": 12, "end_line": 106, "end_column": 19 }, { "span": "except:", "start_line": 113, "start_column": 16, "end_line": 113, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "\\u", "Pul", "l", "To", "Push", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "pull_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "generat", "or", " ", "tha", "t", " ", "calls", " ", "C", "{", "resum", "e", "Produ", "cing", "}", " ", "on", " ", "the", " ", "underl", "ying", " ", "producer", "\\", "10", ";", " ", " ", " ", " ", "forever", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "C", "{", "resum", "e", "Produ", "cing", "}", " ", "throw", "s", " ", "an", " ", "exception", ",", " ", "the", " ", "producer", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "unregister", "ed", ",", " ", "whi", "ch", " ", "shou", "ld", " ", "result", " ", "in", " ", "stream", "ing", " ", "stopping", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\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_", "._", "\\u", "producer_", "._", "resum", "e", "Produ", "cing", "_", "(_", ")_", "\\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 ", " _", "log_", "._", "err_", "(_", "None_", ",_", "\"%", "s", " ", "fail", "ed", ",", " ", "produc", "ing", " ", "will", " ", "be", " ", "stopp", "ed", ":\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "safe", "\\u", "str_", "(_", "self_", "._", "\\u", "producer_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "consumer_", "._", "unregister", "Producer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "consume", "r", " ", "shou", "ld", " ", "now", " ", "call", " ", "stop", "Stream", "ing", "()", " ", "on", " ", "us", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thu", "s", " ", "stopping", " ", "the", " ", "stream", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "the", " ", "consume", "r", " ", "ble", "w", " ", "up", ",", " ", "we", " ", "may", " ", "not", " ", "have", " ", "had", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stop", "Stream", "ing", "()", " ", "call", "ed", ",", " ", "so", " ", "we", " ", "just", " ", "stop", " ", "on", " ", "our", " ", "own", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "err_", "(_", "None_", ",_", "\"%", "s", " ", "fail", "ed", " ", "to", " ", "unregister", " ", "producer", ":\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "safe", "\\u", "str_", "(_", "self_", "._", "\\u", "consumer_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "finished_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "None_", "\\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,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2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Use of the return value of a procedure
nineties/py-videocore/videocore/assembler.py
[ { "content": "def alias(f):\n setattr(Assembler, f.__name__, f)", "metadata": "root.alias", "header": "['module', '___EOS___']", "index": 901 }, { "content": "@alias\ndef rotate(asm, dst, src, shift, **kwargs):\n return asm.v8min(dst, src, src, rotate=shift, **kwargs)", "metadata": "root.rotate", "header": "['module', '___EOS___']", "index": 917 }, { "content": "@alias\ndef mov(asm, dst, src, **kwargs):\n set_flags = kwargs.pop('set_flags', False)\n return asm.bor(dst, src, src, set_flags=set_flags, **kwargs)", "metadata": "root.mov", "header": "['module', '___EOS___']", "index": 926 }, { "content": "@alias\ndef mutex_acquire(asm):\n return asm.mov(REGISTERS['null'], REGISTERS['mutex'])", "metadata": "root.mutex_acquire", "header": "['module', '___EOS___']", "index": 936 }, { "content": "@alias\ndef mutex_release(asm):\n return asm.mov(REGISTERS['mutex'], REGISTERS['null'])", "metadata": "root.mutex_release", "header": "['module', '___EOS___']", "index": 940 }, { "content": "@alias\ndef setup_vpm_read(asm, nrows, mode='32bit horizontal', Y=0, stride=1,\n **kwargs):\n modes = mode.split()\n size = {'8bit': 0, '16bit': 1, '32bit': 2}[modes.pop(0)]\n laned = {'packed': 0, 'laned': 1}[modes.pop(0)] if size != 2 else 0\n horizontal = {'vertical': 0, 'horizontal': 1}[modes.pop(0)]\n if horizontal:\n addr = (\n Y << 2 | kwargs.get('B', 0) if size == 0 else\n Y << 1 | kwargs.get('H', 0) if size == 1 else\n Y\n )\n else:\n X = kwargs['X']\n addr = (\n (Y & 0x30) << 2 | X << 2 | kwargs.get('B', 0) if size == 0 else\n (Y & 0x30) << 1 | X << 1 | kwargs.get('H', 0) if size == 1 else\n (Y & 0x30) | X\n )\n\n asm.ldi(REGISTERS['vpmvcd_rd_setup'],\n (nrows&0xf)<<20|stride<<12|horizontal<<11|laned<<10|size<<8|addr)", "metadata": "root.setup_vpm_read", "header": "['module', '___EOS___']", "index": 944 }, { "content": "@alias\ndef setup_vpm_write(asm, mode='32bit horizontal', stride=1, Y=0, **kwargs):\n modes = mode.split()\n size = {'8bit': 0, '16bit': 1, '32bit': 2}[modes.pop(0)]\n laned = {'packed': 0, 'laned': 1}[modes.pop(0)] if size != 2 else 0\n horizontal = {'vertical': 0, 'horizontal': 1}[modes.pop(0)]\n if horizontal:\n addr = (\n Y << 2 | kwargs.get('B', 0) if size == 0 else\n Y << 1 | kwargs.get('H', 0) if size == 1 else\n Y\n )\n else:\n X = kwargs.get('X', 0)\n addr = (\n (Y & 0x30) << 2 | X << 2 | kwargs.get('B', 0) if size == 0 else\n (Y & 0x30) << 1 | X << 1 | kwargs.get('H', 0) if size == 1 else\n (Y & 0x30) | X\n )\n\n asm.ldi(REGISTERS['vpmvcd_wr_setup'],\n stride<<12|horizontal<<11|laned<<10|size<<8|addr)", "metadata": "root.setup_vpm_write", "header": "['module', '___EOS___']", "index": 968 }, { "content": "@alias\ndef setup_dma_load_stride(asm, val, tmp_reg=REGISTERS['r0']):\n if not isinstance(val, int) and val.name == tmp_reg.name:\n raise AssembleError('setup_dma_store_stride uses \\'{}\\' internally'\n .format(tmp_reg.name))\n if isinstance(val, int):\n return asm.ldi(REGISTERS['vpmvcd_rd_setup'], (9<<28)|val)\n else:\n asm.ldi(tmp_reg, 9<<28)\n return asm.bor(REGISTERS['vpmvcd_rd_setup'], tmp_reg, val)", "metadata": "root.setup_dma_load_stride", "header": "['module', '___EOS___']", "index": 991 }, { "content": "@alias\ndef setup_dma_load(asm, nrows=1, ncols=16, mode='32bit horizontal', Y=0, X=0,\n offset=0, vpitch=1, mpitch=3):\n modes = mode.split()\n modew = (\n 0x4 | offset if modes[0] == '8bit' else\n 0x2 | offset if modes[0] == '16bit' else\n 0\n )\n vertical = { 'horizontal': 0, 'vertical': 1 }[modes[1]]\n asm.ldi(REGISTERS['vpmvcd_rd_setup'],\n 0x80000000|modew<<28|mpitch<<24|(ncols&0xf)<<20|(nrows&0xf)<<16|\n vpitch<<12|vertical<<11|Y<<4|X)", "metadata": "root.setup_dma_load", "header": "['module', '___EOS___']", "index": 1002 }, { "content": "@alias\ndef start_dma_load(asm, reg, rot=0):\n if rot == 0:\n return asm.mov(REGISTERS['vpm_ld_addr'], reg)\n else:\n return asm.rotate(REGISTERS['vpm_ld_addr'], reg, rot)", "metadata": "root.start_dma_load", "header": "['module', '___EOS___']", "index": 1016 }, { "content": "@alias\ndef wait_dma_load(asm):\n return asm.mov(REGISTERS['null'], REGISTERS['vpm_ld_wait'])", "metadata": "root.wait_dma_load", "header": "['module', '___EOS___']", "index": 1023 }, { "content": "@alias\ndef setup_dma_store(asm, nrows=1, ncols=16, mode='32bit horizontal', Y=0, X=0,\n offset=0):\n modes = mode.split()\n modew = (\n 0x4 | offset if modes[0] == '8bit' else\n 0x2 | offset if modes[0] == '16bit' else\n 0\n )\n horizontal = { 'horizontal': 1, 'vertical': 0 }[modes[1]]\n asm.ldi(REGISTERS['vpmvcd_wr_setup'],\n 0x80000000|(nrows&0x7f)<<23|(ncols&0x7f)<<16|horizontal<<14|Y<<7|\n X<<3|modew)", "metadata": "root.setup_dma_store", "header": "['module', '___EOS___']", "index": 1027 }, { "content": "@alias\ndef setup_dma_store_stride(asm, val, blockmode=False, tmp_reg=REGISTERS['r0']):\n if not isinstance(val, int) and val.name == tmp_reg.name:\n raise AssembleError('setup_dma_store_stride uses \\'{}\\' internally'\n .format(tmp_reg.name))\n if isinstance(val, int):\n asm.ldi(REGISTERS['vpmvcd_wr_setup'], (3<<30)|(blockmode<<16)|val)\n else:\n asm.ldi(tmp_reg, (3<<30)|(blockmode<<16))\n asm.bor(REGISTERS['vpmvcd_wr_setup'], tmp_reg, val)", "metadata": "root.setup_dma_store_stride", "header": "['module', '___EOS___']", "index": 1041 }, { "content": "@alias\ndef start_dma_store(asm, reg, rot=0):\n if rot == 0:\n return asm.mov(REGISTERS['vpm_st_addr'], reg)\n else:\n return asm.rotate(REGISTERS['vpm_st_addr'], reg, rot)", "metadata": "root.start_dma_store", "header": "['module', '___EOS___']", "index": 1052 }, { "content": "@alias\ndef wait_dma_store(asm):\n return asm.mov(REGISTERS['null'], REGISTERS['vpm_st_wait'])", "metadata": "root.wait_dma_store", "header": "['module', '___EOS___']", "index": 1059 }, { "content": "@alias\ndef interrupt(asm):\n return asm.mov(REGISTERS['host_interrupt'], 1)", "metadata": "root.interrupt", "header": "['module', '___EOS___']", "index": 1063 }, { "content": "@alias\ndef exit(asm, interrupt=True):\n if interrupt:\n asm.interrupt()\n\n # The instruction signaling program end must not attempt to write to either\n # of the physical A or B register files. (Reference guide Page 22)\n asm.mov(\n REGISTERS['r0'], REGISTERS['r0'], sig='thread end'\n ).mov(\n REGISTERS['r0'], REGISTERS['r0']\n )\n\n asm.nop()\n asm.nop()", "metadata": "root.exit", "header": "['module', '___EOS___']", "index": 1067 }, { "content": "@alias\ndef sema_up(asm, sema_id):\n asm._emit_sema(0, sema_id)", "metadata": "root.sema_up", "header": "['module', '___EOS___']", "index": 1083 }, { "content": "@alias\ndef sema_down(asm, sema_id):\n asm._emit_sema(1, sema_id)", "metadata": "root.sema_down", "header": "['module', '___EOS___']", "index": 1087 } ]
[ { "span": "alias", "start_line": 917, "start_column": 1, "end_line": 917, "end_column": 6 }, { "span": "alias", "start_line": 926, "start_column": 1, "end_line": 926, "end_column": 6 }, { "span": "alias", "start_line": 936, "start_column": 1, "end_line": 936, "end_column": 6 }, { "span": "alias", "start_line": 940, "start_column": 1, "end_line": 940, "end_column": 6 }, { "span": "alias", "start_line": 944, "start_column": 1, "end_line": 944, "end_column": 6 }, { "span": "alias", "start_line": 968, "start_column": 1, "end_line": 968, "end_column": 6 }, { "span": "alias", "start_line": 991, "start_column": 1, "end_line": 991, "end_column": 6 }, { "span": "alias", "start_line": 1002, "start_column": 1, "end_line": 1002, "end_column": 6 }, { "span": "alias", "start_line": 1016, "start_column": 1, "end_line": 1016, "end_column": 6 }, { "span": "alias", "start_line": 1023, "start_column": 1, "end_line": 1023, "end_column": 6 }, { "span": "alias", "start_line": 1027, "start_column": 1, "end_line": 1027, "end_column": 6 }, { "span": "alias", "start_line": 1041, "start_column": 1, "end_line": 1041, "end_column": 6 }, { "span": "alias", "start_line": 1052, "start_column": 1, "end_line": 1052, "end_column": 6 }, { "span": "alias", "start_line": 1059, "start_column": 1, "end_line": 1059, "end_column": 6 }, { "span": "alias", "start_line": 1063, "start_column": 1, "end_line": 1063, "end_column": 6 }, { "span": "alias", "start_line": 1067, "start_column": 1, "end_line": 1067, "end_column": 6 }, { "span": "alias", "start_line": 1083, "start_column": 1, "end_line": 1083, "end_column": 6 }, { "span": "alias", "start_line": 1087, "start_column": 1, "end_line": 1087, "end_column": 6 } ]
[ { "span": "def alias(f):", "start_line": 901, "start_column": 0, "end_line": 901, "end_column": 13 } ]
1
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[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_", "alias_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "Assemble", "r_", ",_", "f_", "._", "\\u\\u", "name\\u\\u_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rotate_", "(_", "asm_", ",_", "dst_", ",_", "src_", ",_", "shift_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asm_", "._", "v", "8", "min_", "(_", "dst_", ",_", "src_", ",_", "src_", ",_", "rotate_", "=_", "shift_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "mov", "_", "(_", "asm_", ",_", "dst_", ",_", "src_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "flags_", "=_", "kwargs_", "._", "pop_", "(_", "'", "set\\u", "flags", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "asm_", "._", "bor", "_", "(_", "dst_", ",_", "src_", ",_", "src_", ",_", "set\\u", "flags_", "=_", "set\\u", "flags_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "mute", "x", "\\u", "acquire_", "(_", "asm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asm_", "._", "mov", "_", "(_", "REGISTER", "S_", "[_", "'", "null", "'_", "]_", ",_", "REGISTER", "S_", "[_", "'", "mute", "x", "'_", "]_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "mute", "x", "\\u", "release_", "(_", "asm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asm_", "._", "mov", "_", "(_", "REGISTER", "S_", "[_", "'", "mute", "x", "'_", "]_", ",_", "REGISTER", "S_", "[_", "'", "null", "'_", "]_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "vp", "m", "\\u", "read_", "(_", "asm_", ",_", "nrows_", ",_", "mode_", "=_", "'", "32", "bit", " ", "horizon", "tal", "'_", ",_", "Y_", "=_", "0_", ",_", "stride_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modes_", "=_", "mode_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "{_", "'", "8b", "it", "'_", ":_", "0_", ",_", "'", "16", "bit", "'_", ":_", "1_", ",_", "'", "32", "bit", "'_", ":_", "2_", "}_", "[_", "modes_", "._", "pop_", "(_", "0_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lan", "ed_", "=_", "{_", "'", "pack", "ed", "'_", ":_", "0_", ",_", "'", "lan", "ed", "'_", ":_", "1_", "}_", "[_", "modes_", "._", "pop_", "(_", "0_", ")_", "]_", "if_", "size_", "!=_", "2_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "horizontal_", "=_", "{_", "'", "vertical", "'_", ":_", "0_", ",_", "'", "horizon", "tal", "'_", ":_", "1_", "}_", "[_", "modes_", "._", "pop_", "(_", "0_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "horizontal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Y_", "<<_", "2_", "|_", "kwargs_", "._", "get_", "(_", "'", "B", "'_", ",_", "0_", ")_", "if_", "size_", "==_", "0_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "Y_", "<<_", "1_", "|_", "kwargs_", "._", "get_", "(_", "'", "H", "'_", ",_", "0_", ")_", "if_", "size_", "==_", "1_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "Y_", "\\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 ", " _", "X_", "=_", "kwargs_", "[_", "'", "X", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Y_", "&_", "0x30_", ")_", "<<_", "2_", "|_", "X_", "<<_", "2_", "|_", "kwargs_", "._", "get_", "(_", "'", "B", "'_", ",_", "0_", ")_", "if_", "size_", "==_", "0_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Y_", "&_", "0x30_", ")_", "<<_", "1_", "|_", "X_", "<<_", "1_", "|_", "kwargs_", "._", "get_", "(_", "'", "H", "'_", ",_", "0_", ")_", "if_", "size_", "==_", "1_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Y_", "&_", "0x30_", ")_", "|_", "X_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "asm_", "._", "ldi", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "mv", "cd", "\\u", "rd", "\\u", "setup", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "nrows_", "&_", "0xf", "_", ")_", "<<_", "20_", "|_", "stride_", "<<_", "12_", "|_", "horizontal_", "<<_", "11_", "|_", "lan", "ed_", "<<_", "10_", "|_", "size_", "<<_", "8_", "|_", "addr_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "vp", "m", "\\u", "write_", "(_", "asm_", ",_", "mode_", "=_", "'", "32", "bit", " ", "horizon", "tal", "'_", ",_", "stride_", "=_", "1_", ",_", "Y_", "=_", "0_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modes_", "=_", "mode_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "{_", "'", "8b", "it", "'_", ":_", "0_", ",_", "'", "16", "bit", "'_", ":_", "1_", ",_", "'", "32", "bit", "'_", ":_", "2_", "}_", "[_", "modes_", "._", "pop_", "(_", "0_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lan", "ed_", "=_", "{_", "'", "pack", "ed", "'_", ":_", "0_", ",_", "'", "lan", "ed", "'_", ":_", "1_", "}_", "[_", "modes_", "._", "pop_", "(_", "0_", ")_", "]_", "if_", "size_", "!=_", "2_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "horizontal_", "=_", "{_", "'", "vertical", "'_", ":_", "0_", ",_", "'", "horizon", "tal", "'_", ":_", "1_", "}_", "[_", "modes_", "._", "pop_", "(_", "0_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "horizontal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Y_", "<<_", "2_", "|_", "kwargs_", "._", "get_", "(_", "'", "B", "'_", ",_", "0_", ")_", "if_", "size_", "==_", "0_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "Y_", "<<_", "1_", "|_", "kwargs_", "._", "get_", "(_", "'", "H", "'_", ",_", "0_", ")_", "if_", "size_", "==_", "1_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "Y_", "\\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 ", " _", "X_", "=_", "kwargs_", "._", "get_", "(_", "'", "X", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Y_", "&_", "0x30_", ")_", "<<_", "2_", "|_", "X_", "<<_", "2_", "|_", "kwargs_", "._", "get_", "(_", "'", "B", "'_", ",_", "0_", ")_", "if_", "size_", "==_", "0_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Y_", "&_", "0x30_", ")_", "<<_", "1_", "|_", "X_", "<<_", "1_", "|_", "kwargs_", "._", "get_", "(_", "'", "H", "'_", ",_", "0_", ")_", "if_", "size_", "==_", "1_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Y_", "&_", "0x30_", ")_", "|_", "X_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "asm_", "._", "ldi", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "mv", "cd", "\\u", "wr", "\\u", "setup", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stride_", "<<_", "12_", "|_", "horizontal_", "<<_", "11_", "|_", "lan", "ed_", "<<_", "10_", "|_", "size_", "<<_", "8_", "|_", "addr_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "dma", "\\u", "load", "\\u", "stride_", "(_", "asm_", ",_", "val_", ",_", "tmp", "\\u", "reg_", "=_", "REGISTER", "S_", "[_", "'", "r", "0", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "val_", ",_", "int_", ")_", "and_", "val_", "._", "name_", "==_", "tmp", "\\u", "reg_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assemble", "Error_", "(_", "'", "setup", "\\u", "dma", "\\u", "store", "\\u", "stride", " ", "use", "s", " ", "\\\\'{", "}\\\\'", " ", "internal", "ly", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "tmp", "\\u", "reg_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "val_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asm_", "._", "ldi", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "mv", "cd", "\\u", "rd", "\\u", "setup", "'_", "]_", ",_", "(_", "9_", "<<_", "28_", ")_", "|_", "val_", ")_", "\\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 ", " _", "asm_", "._", "ldi", "_", "(_", "tmp", "\\u", "reg_", ",_", "9_", "<<_", "28_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "asm_", "._", "bor", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "mv", "cd", "\\u", "rd", "\\u", "setup", "'_", "]_", ",_", "tmp", "\\u", "reg_", ",_", "val_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "dma", "\\u", "load_", "(_", "asm_", ",_", "nrows_", "=_", "1_", ",_", "ncols_", "=_", "16_", ",_", "mode_", "=_", "'", "32", "bit", " ", "horizon", "tal", "'_", ",_", "Y_", "=_", "0_", ",_", "X_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "0_", ",_", "vp", "itch", "_", "=_", "1_", ",_", "mpi", "tch_", "=_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modes_", "=_", "mode_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode", "w_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0x4_", "|_", "offset_", "if_", "modes_", "[_", "0_", "]_", "==_", "'", "8b", "it", "'_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "0x2_", "|_", "offset_", "if_", "modes_", "[_", "0_", "]_", "==_", "'", "16", "bit", "'_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertical_", "=_", "{_", "'", "horizon", "tal", "'_", ":_", "0_", ",_", "'", "vertical", "'_", ":_", "1_", "}_", "[_", "modes_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "asm_", "._", "ldi", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "mv", "cd", "\\u", "rd", "\\u", "setup", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0x80000", "000_", "|_", "mode", "w_", "<<_", "28_", "|_", "mpi", "tch_", "<<_", "24_", "|_", "(_", "ncols_", "&_", "0xf", "_", ")_", "<<_", "20_", "|_", "(_", "nrows_", "&_", "0xf", "_", ")_", "<<_", "16_", "|_", "\\u\\u\\uNL\\u\\u\\u_", "vp", "itch", "_", "<<_", "12_", "|_", "vertical_", "<<_", "11_", "|_", "Y_", "<<_", "4_", "|_", "X_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "start", "\\u", "dma", "\\u", "load_", "(_", "asm_", ",_", "reg_", ",_", "rot_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rot_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asm_", "._", "mov", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "m", "\\u", "ld", "\\u", "addr", "'_", "]_", ",_", "reg_", ")_", "\\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_", "asm_", "._", "rotate_", "(_", "REGISTER", "S_", "[_", "'", "vp", "m", "\\u", "ld", "\\u", "addr", "'_", "]_", ",_", "reg_", ",_", "rot_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wait", "\\u", "dma", "\\u", "load_", "(_", "asm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asm_", "._", "mov", "_", "(_", "REGISTER", "S_", "[_", "'", "null", "'_", "]_", ",_", "REGISTER", "S_", "[_", "'", "vp", "m", "\\u", "ld", "\\u", "wait", "'_", "]_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "dma", "\\u", "store_", "(_", "asm_", ",_", "nrows_", "=_", "1_", ",_", "ncols_", "=_", "16_", ",_", "mode_", "=_", "'", "32", "bit", " ", "horizon", "tal", "'_", ",_", "Y_", "=_", "0_", ",_", "X_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modes_", "=_", "mode_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode", "w_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "0x4_", "|_", "offset_", "if_", "modes_", "[_", "0_", "]_", "==_", "'", "8b", "it", "'_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "0x2_", "|_", "offset_", "if_", "modes_", "[_", "0_", "]_", "==_", "'", "16", "bit", "'_", "else_", "\\u\\u\\uNL\\u\\u\\u_", "0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "horizontal_", "=_", "{_", "'", "horizon", "tal", "'_", ":_", "1_", ",_", "'", "vertical", "'_", ":_", "0_", "}_", "[_", "modes_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "asm_", "._", "ldi", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "mv", "cd", "\\u", "wr", "\\u", "setup", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0x80000", "000_", "|_", "(_", "nrows_", "&_", "0x7f", "_", ")_", "<<_", "23_", "|_", "(_", "ncols_", "&_", "0x7f", "_", ")_", "<<_", "16_", "|_", "horizontal_", "<<_", "14_", "|_", "Y_", "<<_", "7_", "|_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "<<_", "3_", "|_", "mode", "w_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "dma", "\\u", "store", "\\u", "stride_", "(_", "asm_", ",_", "val_", ",_", "block", "mode_", "=_", "False_", ",_", "tmp", "\\u", "reg_", "=_", "REGISTER", "S_", "[_", "'", "r", "0", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "val_", ",_", "int_", ")_", "and_", "val_", "._", "name_", "==_", "tmp", "\\u", "reg_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assemble", "Error_", "(_", "'", "setup", "\\u", "dma", "\\u", "store", "\\u", "stride", " ", "use", "s", " ", "\\\\'{", "}\\\\'", " ", "internal", "ly", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "tmp", "\\u", "reg_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "val_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asm_", "._", "ldi", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "mv", "cd", "\\u", "wr", "\\u", "setup", "'_", "]_", ",_", "(_", "3_", "<<_", "30_", ")_", "|_", "(_", "block", "mode_", "<<_", "16_", ")_", "|_", "val_", ")_", "\\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 ", " _", "asm_", "._", "ldi", "_", "(_", "tmp", "\\u", "reg_", ",_", "(_", "3_", "<<_", "30_", ")_", "|_", "(_", "block", "mode_", "<<_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "asm_", "._", "bor", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "mv", "cd", "\\u", "wr", "\\u", "setup", "'_", "]_", ",_", "tmp", "\\u", "reg_", ",_", "val_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "start", "\\u", "dma", "\\u", "store_", "(_", "asm_", ",_", "reg_", ",_", "rot_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rot_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asm_", "._", "mov", "_", "(_", "REGISTER", "S_", "[_", "'", "vp", "m", "\\u", "st", "\\u", "addr", "'_", "]_", ",_", "reg_", ")_", "\\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_", "asm_", "._", "rotate_", "(_", "REGISTER", "S_", "[_", "'", "vp", "m", "\\u", "st", "\\u", "addr", "'_", "]_", ",_", "reg_", ",_", "rot_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wait", "\\u", "dma", "\\u", "store_", "(_", "asm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asm_", "._", "mov", "_", "(_", "REGISTER", "S_", "[_", "'", "null", "'_", "]_", ",_", "REGISTER", "S_", "[_", "'", "vp", "m", "\\u", "st", "\\u", "wait", "'_", "]_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "interrupt", "_", "(_", "asm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "asm_", "._", "mov", "_", "(_", "REGISTER", "S_", "[_", "'", "host", "\\u", "interrupt", "'_", "]_", ",_", "1_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "exit_", "(_", "asm_", ",_", "interrupt", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "interrupt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asm_", "._", "interrupt", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "instruct", "ion", " ", "signal", "ing", " ", "program", " ", "end", " ", "must", " ", "not", " ", "atte", "mpt", " ", "to", " ", "write", " ", "to", " ", "eit", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "physical", " ", "A", " ", "or", " ", "B", " ", "register", " ", "files", ".", " ", "(", "Reference", " ", "guide", " ", "Page", " ", "2", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "asm_", "._", "mov", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "REGISTER", "S_", "[_", "'", "r", "0", "'_", "]_", ",_", "REGISTER", "S_", "[_", "'", "r", "0", "'_", "]_", ",_", "sig_", "=_", "'", "thread", " ", "end", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "mov", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "REGISTER", "S_", "[_", "'", "r", "0", "'_", "]_", ",_", "REGISTER", "S_", "[_", "'", "r", "0", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "asm_", "._", "nop", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "asm_", "._", "nop", "_", "(_", ")_", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sema", "\\u", "up_", "(_", "asm_", ",_", "sema", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asm_", "._", "\\u", "emit", "\\u", "sema", "_", "(_", "0_", ",_", "sema", "\\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_", "@_", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sema", "\\u", "down_", "(_", "asm_", ",_", "sema", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asm_", "._", "\\u", "emit", "\\u", "sema", "_", "(_", "1_", ",_", "sema", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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, 4, 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, 4, 2, 2, 2, 2, 0, 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, 4, 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 ]
Variable defined multiple times
taoliu/taolib/CoreLib/BasicStat/Prob.py
[ { "content": "def normal_cdf_inv(p, mu = None, sigma2 = None, lower=True):\n\n upper = not lower\n if p < 0 or p > 1:\n raise Exception(\"Illegal argument %f for qnorm(p).\" % p)\n \n split = 0.42\n a0 = 2.50662823884\n a1 = -18.61500062529\n a2 = 41.39119773534\n a3 = -25.44106049637\n b1 = -8.47351093090\n b2 = 23.08336743743\n b3 = -21.06224101826\n b4 = 3.13082909833\n c0 = -2.78718931138\n c1 = -2.29796479134\n c2 = 4.85014127135\n c3 = 2.32121276858\n d1 = 3.54388924762\n d2 = 1.63706781897\n q = p - 0.5\n \n r = 0.0\n ppnd = 0.0\n \n if abs(q) <= split:\n r = q * q\n ppnd = q * (((a3 * r + a2) * r + a1) * r + a0) / ((((b4 * r + b3) * r + b2) * r + b1) * r + 1)\n else:\n r = p\n if q > 0:\n r = 1 - p\n \n if r > 0:\n r = sqrt(- log(r))\n ppnd = (((c3 * r + c2) * r + c1) * r + c0) / ((d2 * r + d1) * r + 1)\n \n if q < 0:\n ppnd = - ppnd\n else:\n ppnd = 0\n \n if upper:\n ppnd = - ppnd\n \n if mu != None and sigma2 != None:\n return ppnd * sqrt(sigma2) + mu\n else:\n return ppnd", "metadata": "root.normal_cdf_inv", "header": "['module', '___EOS___']", "index": 78 }, { "content": "def normal_cdf (z, mu = 0.0, sigma2 = 1.0, lower=True):\n \n upper = not lower\n\n z = (z - mu) / sqrt(sigma2)\n \n ltone = 7.0\n utzero = 18.66\n con = 1.28\n a1 = 0.398942280444\n a2 = 0.399903438504\n a3 = 5.75885480458\n a4 = 29.8213557808\n a5 = 2.62433121679\n a6 = 48.6959930692\n a7 = 5.92885724438\n b1 = 0.398942280385\n b2 = 3.8052e-8\n b3 = 1.00000615302\n b4 = 3.98064794e-4\n b5 = 1.986153813664\n b6 = 0.151679116635\n b7 = 5.29330324926\n b8 = 4.8385912808\n b9 = 15.1508972451\n b10 = 0.742380924027\n b11 = 30.789933034\n b12 = 3.99019417011\n\n y = 0.0\n alnorm = 0.0\n \n if z < 0:\n upper = not upper\n z = - z\n \n if z <= ltone or upper and z <= utzero:\n y = 0.5 * z * z\n if z > con:\n alnorm = b1 * exp(- y) / (z - b2 + b3 / (z + b4 + b5 / (z - b6 + b7 / (z + b8 - b9 / (z + b10 + b11 / (z + b12))))))\n else:\n alnorm = 0.5 - z * (a1 - a2 * y / (y + a3 - a4 / (y + a5 + a6 / (y + a7))))\n else:\n alnorm = 0.0\n if not upper:\n alnorm = 1.0 - alnorm\n return alnorm", "metadata": "root.normal_cdf", "header": "['module', '___EOS___']", "index": 129 } ]
[ { "span": "r ", "start_line": 101, "start_column": 4, "end_line": 101, "end_column": 5 }, { "span": "ppnd ", "start_line": 102, "start_column": 4, "end_line": 102, "end_column": 8 }, { "span": "y ", "start_line": 158, "start_column": 4, "end_line": 158, "end_column": 5 }, { "span": "alnorm ", "start_line": 159, "start_column": 4, "end_line": 159, "end_column": 10 } ]
[ { "span": "ppnd ", "start_line": 106, "start_column": 8, "end_line": 106, "end_column": 12 }, { "span": "ppnd ", "start_line": 114, "start_column": 12, "end_line": 114, "end_column": 16 }, { "span": "ppnd ", "start_line": 119, "start_column": 12, "end_line": 119, "end_column": 16 }, { "span": "alnorm ", "start_line": 168, "start_column": 12, "end_line": 168, "end_column": 18 }, { "span": "alnorm ", "start_line": 170, "start_column": 12, "end_line": 170, "end_column": 18 }, { "span": "alnorm ", "start_line": 172, "start_column": 8, "end_line": 172, "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_", "def_", "normal", "\\u", "cdf", "\\u", "inv_", "(_", "p_", ",_", "mu_", "=_", "None_", ",_", "sigma", "2_", "=_", "None_", ",_", "lower_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upper_", "=_", "not_", "lower_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "<_", "0_", "or_", "p_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Il", "lega", "l", " ", "argu", "ment", " ", "%", "f", " ", "for", " ", "qn", "orm", "(", "p", ").\"_", "%_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "split_", "=_", "0.42", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a0_", "=_", "2.5", "066", "282", "388", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a1_", "=_", "-_", "18.", "615", "0006", "252", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a2_", "=_", "41.", "391", "197", "735", "34_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a3_", "=_", "-_", "25.", "4410", "604", "963", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1_", "=_", "-_", "8.4", "735", "109", "309", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "=_", "23.", "083", "367", "437", "43_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b3_", "=_", "-_", "21.", "062", "241", "018", "26_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b4", "_", "=_", "3.1", "308", "290", "983", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c0_", "=_", "-_", "2.7", "871", "893", "113", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1_", "=_", "-_", "2.2", "979", "647", "913", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "4.8", "501", "412", "713", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "2.3", "212", "127", "685", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1_", "=_", "3.5", "438", "892", "476", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "=_", "1.6", "370", "678", "189", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "p_", "-_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp", "nd_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "abs_", "(_", "q_", ")_", "<=_", "split_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "q_", "*_", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp", "nd_", "=_", "q_", "*_", "(_", "(_", "(_", "a3_", "*_", "r_", "+_", "a2_", ")_", "*_", "r_", "+_", "a1_", ")_", "*_", "r_", "+_", "a0_", ")_", "/_", "(_", "(_", "(_", "(_", "b4", "_", "*_", "r_", "+_", "b3_", ")_", "*_", "r_", "+_", "b2_", ")_", "*_", "r_", "+_", "b1_", ")_", "*_", "r_", "+_", "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 ", " _", "r_", "=_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "1_", "-_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "r_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "sqrt_", "(_", "-_", "log_", "(_", "r_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp", "nd_", "=_", "(_", "(_", "(_", "c3_", "*_", "r_", "+_", "c2_", ")_", "*_", "r_", "+_", "c1_", ")_", "*_", "r_", "+_", "c0_", ")_", "/_", "(_", "(_", "d2_", "*_", "r_", "+_", "d1_", ")_", "*_", "r_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "q_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pp", "nd_", "=_", "-_", "pp", "nd_", "\\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 ", " _", "pp", "nd_", "=_", "0_", "\\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_", "upper_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pp", "nd_", "=_", "-_", "pp", "nd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mu_", "!=_", "None_", "and_", "sigma", "2_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pp", "nd_", "*_", "sqrt_", "(_", "sigma", "2_", ")_", "+_", "mu_", "\\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_", "pp", "nd_", "\\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_", "normal", "\\u", "cdf_", "(_", "z_", ",_", "mu_", "=_", "0.0_", ",_", "sigma", "2_", "=_", "1.0_", ",_", "lower_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upper_", "=_", "not_", "lower_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "=_", "(_", "z_", "-_", "mu_", ")_", "/_", "sqrt_", "(_", "sigma", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lto", "ne_", "=_", "7.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ut", "zero_", "=_", "18.", "66_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "con_", "=_", "1.2", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a1_", "=_", "0.39", "894", "228", "044", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a2_", "=_", "0.39", "990", "343", "850", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a3_", "=_", "5.7", "588", "548", "045", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a4_", "=_", "29.", "821", "355", "780", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a5", "_", "=_", "2.6", "243", "312", "167", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a6", "_", "=_", "48.", "695", "993", "069", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a7", "_", "=_", "5.9", "288", "572", "443", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1_", "=_", "0.39", "894", "228", "038", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "=_", "3.8", "052", "e-", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b3_", "=_", "1.0000", "061", "530", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b4", "_", "=_", "3.9", "806", "479", "4e", "-", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b5", "_", "=_", "1.9", "86153", "813", "664", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b6", "_", "=_", "0.15", "167", "911", "663", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b7", "_", "=_", "5.2", "933", "032", "492", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b8", "_", "=_", "4.8", "385", "912", "808", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b9", "_", "=_", "15.", "150", "897", "245", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1", "0_", "=_", "0.74", "238", "092", "402", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1", "1_", "=_", "30.", "789", "933", "034", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1", "2_", "=_", "3.9", "901", "941", "701", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aln", "orm_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "z_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upper_", "=_", "not_", "upper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "-_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "z_", "<=_", "lto", "ne_", "or_", "upper_", "and_", "z_", "<=_", "ut", "zero_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "0.5_", "*_", "z_", "*_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "z_", ">_", "con_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aln", "orm_", "=_", "b1_", "*_", "exp_", "(_", "-_", "y_", ")_", "/_", "(_", "z_", "-_", "b2_", "+_", "b3_", "/_", "(_", "z_", "+_", "b4", "_", "+_", "b5", "_", "/_", "(_", "z_", "-_", "b6", "_", "+_", "b7", "_", "/_", "(_", "z_", "+_", "b8", "_", "-_", "b9", "_", "/_", "(_", "z_", "+_", "b1", "0_", "+_", "b1", "1_", "/_", "(_", "z_", "+_", "b1", "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 ", " _", "aln", "orm_", "=_", "0.5_", "-_", "z_", "*_", "(_", "a1_", "-_", "a2_", "*_", "y_", "/_", "(_", "y_", "+_", "a3_", "-_", "a4_", "/_", "(_", "y_", "+_", "a5", "_", "+_", "a6", "_", "/_", "(_", "y_", "+_", "a7", "_", ")_", ")_", ")_", ")_", "\\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 ", " _", "aln", "orm_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "upper_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aln", "orm_", "=_", "1.0_", "-_", "aln", "orm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "aln", "orm_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
open-cloud/xos/xos/synchronizers/model_policy.py
[ { "content": "from django.db.models.signals import post_save\nfrom django.dispatch import receiver\nimport pdb\nfrom generate.dependency_walker import *\nfrom synchronizers.openstack import model_policies\nfrom xos.logger import logger\nfrom datetime import datetime\nimport time\nfrom core.models import *\nfrom django.db import reset_queries\nfrom django.db.transaction import atomic\nfrom django.db.models import F, Q\n\nmodelPolicyEnabled = True\nbad_instances=[]\n\n\n\n\n\n\n#@atomic\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def EnableModelPolicy(x):\n global modelPolicyEnabled\n modelPolicyEnabled = x", "metadata": "root.EnableModelPolicy", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def update_wp(d, o):\n try:\n save_fields = []\n if (d.write_protect != o.write_protect):\n d.write_protect = o.write_protect\n save_fields.append('write_protect')\n if (save_fields):\n d.save(update_fields=save_fields)\n except AttributeError,e:\n raise e", "metadata": "root.update_wp", "header": "['module', '___EOS___']", "index": 20 }, { "content": "def update_dep(d, o):\n try:\n print 'Trying to update %s'%d\n save_fields = []\n if (d.updated < o.updated):\n save_fields = ['updated']\n\n if (save_fields):\n d.save(update_fields=save_fields)\n except AttributeError,e:\n raise e\n except Exception,e:\n logger.info('Could not save %r. Exception: %r'%(d,e), extra=d.tologdict())", "metadata": "root.update_dep", "header": "['module', '___EOS___']", "index": 31 }, { "content": "def delete_if_inactive(d, o):\n try:\n d.delete()\n print \"Deleted %s (%s)\"%(d,d.__class__.__name__)\n except:\n pass\n return", "metadata": "root.delete_if_inactive", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def execute_model_policy(instance, deleted):\n # Automatic dirtying\n if (instance in bad_instances):\n return\n\n # These are the models whose children get deleted when they are\n delete_policy_models = ['Slice','Instance','Network']\n sender_name = instance.__class__.__name__\n policy_name = 'model_policy_%s'%sender_name\n noargs = False\n\n if (not deleted):\n walk_inv_deps(update_dep, instance)\n walk_deps(update_wp, instance)\n elif (sender_name in delete_policy_models):\n walk_inv_deps(delete_if_inactive, instance)\n\n\n\n try:\n policy_handler = getattr(model_policies, policy_name, None)\n logger.error(\"POLICY HANDLER: %s %s\" % (policy_name, policy_handler))\n if policy_handler is not None:\n if (deleted):\n try:\n policy_handler.handle_delete(instance)\n except AttributeError:\n pass\n else:\n policy_handler.handle(instance)\n except:\n logger.log_exc(\"Model Policy Error:\")\n\n try:\n instance.policed=datetime.now()\n instance.save(update_fields=['policed'])\n except:\n logging.error('Object %r is defective'%instance)\n bad_instances.append(instance)", "metadata": "root.execute_model_policy", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def noop(o,p):\n pass", "metadata": "root.noop", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def run_policy():\n while (True):\n start = time.time()\n run_policy_once()\n if (time.time()-start<1):\n time.sleep(1)", "metadata": "root.run_policy", "header": "['module', '___EOS___']", "index": 98 }, { "content": "def run_policy_once():\n from core.models import Instance,Slice,Controller,Network,User,SlicePrivilege,Site,SitePrivilege,Image,ControllerSlice,ControllerUser,ControllerSite\n models = [Controller, Site, SitePrivilege, Image, ControllerSlice, ControllerSite, ControllerUser, User, Slice, Network, Instance, SlicePrivilege]\n objects = []\n deleted_objects = []\n\n for m in models:\n res = m.objects.filter((Q(policed__lt=F('updated')) | Q(policed=None)) & Q(no_policy=False))\n objects.extend(res)\n res = m.deleted_objects.filter(Q(policed__lt=F('updated')) | Q(policed=None))\n deleted_objects.extend(res)\n\n for o in objects:\n execute_model_policy(o, o.deleted)\n\n for o in deleted_objects:\n execute_model_policy(o, True)\n\n # Reap non-sync'd models here\n reaped = [Slice]\n\n for m in reaped:\n dobjs = m.deleted_objects.all()\n for d in dobjs:\n deps = walk_inv_deps(noop, d)\n if (not deps):\n print 'Purging object %r'%d\n d.delete(purge=True)\n\n try:\n reset_queries()\n except:\n # this shouldn't happen, but in case it does, catch it...\n logger.log_exc(\"exception in reset_queries\")", "metadata": "root.run_policy_once", "header": "['module', '___EOS___']", "index": 105 } ]
[ { "span": "from django.db.models.signals import post_save", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 46 }, { "span": "from django.dispatch import receiver", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 36 }, { "span": "import pdb", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 10 }, { "span": "from django.db.transaction import atomic", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "signals_", "import_", "post", "\\u", "save_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "dispatch_", "import_", "receiver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "generate_", "._", "dependen", "cy", "\\u", "walker_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "synchronize", "rs_", "._", "openstack_", "import_", "model", "\\u", "policies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xo", "s_", "._", "logger_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "reset", "\\u", "queries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "transaction_", "import_", "atomic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "F_", ",_", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Polic", "y", "Enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "\\u", "instances_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#@", "atomic_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "def_", "Enable", "Model", "Policy_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "model", "Polic", "y", "Enabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Polic", "y", "Enabled_", "=_", "x_", "\\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_", "update", "\\u", "wp_", "(_", "d_", ",_", "o_", ")_", ":_", "\\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 ", " _", "save", "\\u", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "d_", "._", "write", "\\u", "protect", "_", "!=_", "o_", "._", "write", "\\u", "protect", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "write", "\\u", "protect", "_", "=_", "o_", "._", "write", "\\u", "protect", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "fields_", "._", "append_", "(_", "'", "write", "\\u", "protect", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "save", "\\u", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "save_", "(_", "update", "\\u", "fields_", "=_", "save", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "e_", "\\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_", "update", "\\u", "dep_", "(_", "d_", ",_", "o_", ")_", ":_", "\\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 ", " _", "print_", "'", "Tr", "ying", " ", "to", " ", "update", " ", "%", "s", "'_", "%_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "d_", "._", "updated_", "<_", "o_", "._", "updated_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "\\u", "fields_", "=_", "[_", "'", "update", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "save", "\\u", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "save_", "(_", "update", "\\u", "fields_", "=_", "save", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "e_", "\\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_", "._", "info_", "(_", "'", "Cou", "ld", " ", "not", " ", "save", " ", "%", "r", ".", " ", "Except", "ion", ":", " ", "%", "r", "'_", "%_", "(_", "d_", ",_", "e_", ")_", ",_", "extra_", "=_", "d_", "._", "tol", "og", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "if", "\\u", "inactive_", "(_", "d_", ",_", "o_", ")_", ":_", "\\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_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Delete", "d", " ", "%", "s", " ", "(%", "s", ")\"_", "%_", "(_", "d_", ",_", "d_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\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_", "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_", "execute", "\\u", "model", "\\u", "policy_", "(_", "instance_", ",_", "deleted_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Automat", "ic", " ", "dir", "ty", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "instance_", "in_", "bad", "\\u", "instances_", ")_", ":_", "\\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_", "#", " ", "The", "se", " ", "are", " ", "the", " ", "model", "s", " ", "who", "se", " ", "child", "ren", " ", "get", " ", "delete", "d", " ", "whe", "n", " ", "the", "y", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delete", "\\u", "policy", "\\u", "models_", "=_", "[_", "'", "Slice", "'_", ",_", "'", "Insta", "nce", "'_", ",_", "'", "Network", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sender", "\\u", "name_", "=_", "instance_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy", "\\u", "name_", "=_", "'", "model", "\\u", "policy", "\\u", "%", "s", "'_", "%_", "sender", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "noar", "gs_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "deleted_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "walk", "\\u", "inv", "\\u", "deps_", "(_", "update", "\\u", "dep_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "walk", "\\u", "deps_", "(_", "update", "\\u", "wp_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "sender", "\\u", "name_", "in_", "delete", "\\u", "policy", "\\u", "models_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "walk", "\\u", "inv", "\\u", "deps_", "(_", "delete", "\\u", "if", "\\u", "inactive_", ",_", "instance_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "policy", "\\u", "handler_", "=_", "getattr_", "(_", "model", "\\u", "policies_", ",_", "policy", "\\u", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "error_", "(_", "\"", "POLICY", " ", "HANDLER", ":", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "policy", "\\u", "name_", ",_", "policy", "\\u", "handler_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "policy", "\\u", "handler_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "deleted_", ")_", ":_", "\\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 ", " ", "_", "policy", "\\u", "handler_", "._", "handle", "\\u", "delete_", "(_", "instance_", ")_", "\\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 ", " ", "_", "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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "policy", "\\u", "handler_", "._", "handle_", "(_", "instance_", ")_", "\\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_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "log", "\\u", "exc_", "(_", "\"", "Model", " ", "Polic", "y", " ", "Error", ":\"_", ")_", "\\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 ", " _", "instance_", "._", "police", "d_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "save_", "(_", "update", "\\u", "fields_", "=_", "[_", "'", "police", "d", "'_", "]_", ")_", "\\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 ", " _", "logging_", "._", "error_", "(_", "'", "Object", " ", "%", "r", " ", "is", " ", "defect", "ive", "'_", "%_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "\\u", "instances_", "._", "append_", "(_", "instance_", ")_", "\\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_", "noop_", "(_", "o_", ",_", "p_", ")_", ":_", "\\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_", "run", "\\u", "policy_", "(_", ")_", ":_", "\\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 ", " _", "start_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "policy", "\\u", "once_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "start_", "<_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "1_", ")_", "\\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_", "run", "\\u", "policy", "\\u", "once_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "core_", "._", "models_", "import_", "Instance_", ",_", "Slice_", ",_", "Controller_", ",_", "Network_", ",_", "User_", ",_", "Slice", "Privilege", "_", ",_", "Site_", ",_", "Site", "Privilege", "_", ",_", "Image_", ",_", "Controlle", "r", "Slice_", ",_", "Controlle", "r", "User_", ",_", "Controlle", "r", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "models_", "=_", "[_", "Controller_", ",_", "Site_", ",_", "Site", "Privilege", "_", ",_", "Image_", ",_", "Controlle", "r", "Slice_", ",_", "Controlle", "r", "Site_", ",_", "Controlle", "r", "User_", ",_", "User_", ",_", "Slice_", ",_", "Network_", ",_", "Instance_", ",_", "Slice", "Privilege", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "d\\u", "objects_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "m_", "in_", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "m_", "._", "objects_", "._", "filter_", "(_", "(_", "Q_", "(_", "police", "d\\u", "\\u", "lt_", "=_", "F_", "(_", "'", "update", "d", "'_", ")_", ")_", "|_", "Q_", "(_", "police", "d_", "=_", "None_", ")_", ")_", "&_", "Q_", "(_", "no", "\\u", "policy_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "extend_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "m_", "._", "delete", "d\\u", "objects_", "._", "filter_", "(_", "Q_", "(_", "police", "d\\u", "\\u", "lt_", "=_", "F_", "(_", "'", "update", "d", "'_", ")_", ")_", "|_", "Q_", "(_", "police", "d_", "=_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "d\\u", "objects_", "._", "extend_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "o_", "in_", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "execute", "\\u", "model", "\\u", "policy_", "(_", "o_", ",_", "o_", "._", "deleted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "o_", "in_", "delete", "d\\u", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "execute", "\\u", "model", "\\u", "policy_", "(_", "o_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rea", "p", " ", "non", "-", "sync", "'", "d", " ", "model", "s", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rea", "ped_", "=_", "[_", "Slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "m_", "in_", "rea", "ped_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dob", "js_", "=_", "m_", "._", "delete", "d\\u", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "dob", "js_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deps_", "=_", "walk", "\\u", "inv", "\\u", "deps_", "(_", "noop_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "deps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "Purg", "ing", " ", "object", " ", "%", "r", "'_", "%_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "delete_", "(_", "purge_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reset", "\\u", "queries_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", "n", "'", "t", " ", "happ", "en", ",", " ", "but", " ", "in", " ", "case", " ", "it", " ", "doe", "s", ",", " ", "catch", " ", "it", "..._", "\\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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 ]
Imprecise assert
boto/boto3/tests/unit/dynamodb/test_conditions.py
[ { "content": " def test_equal_operator(self):\n cond1 = Equals(self.value, self.value2)\n cond2 = Equals(self.value, self.value2)\n self.assertTrue(cond1 == cond2)", "metadata": "root.TestConditions.test_equal_operator", "header": "['class', 'TestConditions', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 122 }, { "content": " def test_equal_operator_type(self):\n cond1 = Equals(self.value, self.value2)\n cond2 = NotEquals(self.value, self.value2)\n self.assertFalse(cond1 == cond2)", "metadata": "root.TestConditions.test_equal_operator_type", "header": "['class', 'TestConditions', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 127 }, { "content": " def test_equal_operator_value(self):\n cond1 = Equals(self.value, self.value2)\n cond2 = Equals(self.value, self.value)\n self.assertFalse(cond1 == cond2)", "metadata": "root.TestConditions.test_equal_operator_value", "header": "['class', 'TestConditions', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 132 }, { "content": " def test_not_equal_operator(self):\n cond1 = Equals(self.value, self.value2)\n cond2 = NotEquals(self.value, self.value)\n self.assertTrue(cond1 != cond2)", "metadata": "root.TestConditions.test_not_equal_operator", "header": "['class', 'TestConditions', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 137 } ]
[ { "span": "self.assertTrue(cond1 == cond2)", "start_line": 125, "start_column": 8, "end_line": 125, "end_column": 39 }, { "span": "self.assertFalse(cond1 == cond2)", "start_line": 130, "start_column": 8, "end_line": 130, "end_column": 40 }, { "span": "self.assertFalse(cond1 == cond2)", "start_line": 135, "start_column": 8, "end_line": 135, "end_column": 40 }, { "span": "self.assertTrue(cond1 != cond2)", "start_line": 140, "start_column": 8, "end_line": 140, "end_column": 39 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Conditions", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "equal", "\\u", "operator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond", "1_", "=_", "Equals_", "(_", "self_", "._", "value_", ",_", "self_", "._", "value2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cond", "2_", "=_", "Equals_", "(_", "self_", "._", "value_", ",_", "self_", "._", "value2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cond", "1_", "==_", "cond", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Conditions", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "equal", "\\u", "opera", "tor", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond", "1_", "=_", "Equals_", "(_", "self_", "._", "value_", ",_", "self_", "._", "value2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cond", "2_", "=_", "Not", "Equals_", "(_", "self_", "._", "value_", ",_", "self_", "._", "value2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "cond", "1_", "==_", "cond", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Conditions", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "equal", "\\u", "opera", "tor", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond", "1_", "=_", "Equals_", "(_", "self_", "._", "value_", ",_", "self_", "._", "value2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cond", "2_", "=_", "Equals_", "(_", "self_", "._", "value_", ",_", "self_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "cond", "1_", "==_", "cond", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Conditions", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "not", "\\u", "equal", "\\u", "operator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond", "1_", "=_", "Equals_", "(_", "self_", "._", "value_", ",_", "self_", "._", "value2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cond", "2_", "=_", "Not", "Equals_", "(_", "self_", "._", "value_", ",_", "self_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cond", "1_", "!=_", "cond", "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, 0, 1, 1, 1, 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, 2, 2, 2, 2, 2, 0, 1, 1, 1, 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, 2, 2, 2, 2, 0, 1, 1, 1, 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, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
kamyu104/LeetCode/Python/unique-word-abbreviation.py
[ { "content": " def isUnique(self, word):\n \"\"\"\n check if a word is unique.\n :type word: str\n :rtype: bool\n \"\"\"\n l = len(word)\n abbr = self.abbreviation(word)\n return self.lookup_[abbr] <= {word}", "metadata": "root.ValidWordAbbr.isUnique", "header": "['class', 'ValidWordAbbr', '(', 'object', ')', ':', '___EOS___']", "index": 16 } ]
[ { "span": "l ", "start_line": 22, "start_column": 8, "end_line": 22, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Valid", "Word", "Abbr", "_", "(_", "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_", "is", "Unique", "_", "(_", "self_", ",_", "word_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "check", " ", "if", " ", "a", " ", "word", " ", "is", " ", "unique", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "word", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "len_", "(_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abbr_", "=_", "self_", "._", "abbreviation", "_", "(_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "look", "up", "\\u_", "[_", "abbr_", "]_", "<=_", "{_", "word_", "}_", "\\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, 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 ]
Unused local variable
fbzhong/sublime-jslint/jslint.py
[ { "content": " def append_data(self, proc, bData, end=False):\n if self.debug:\n print(\"DEBUG: append_data start\")\n data = bData.decode('utf-8')\n if self.debug:\n print(\"DEBUG: data= \"+data)\n self.buffered_data = self.buffered_data + data\n data = self.buffered_data.replace(self.file_path, self.file_name).replace('\\r\\n', '\\n').replace('\\r', '\\n')\n\n if end is False:\n rsep_pos = data.rfind('\\n')\n if rsep_pos == -1:\n # not found full line.\n return\n self.buffered_data = data[rsep_pos+1:]\n data = data[:rsep_pos+1]\n\n # ignore error.\n text = data\n if (len(self.ignore_errors) > 0) and (not self.use_node_jslint):\n text = ''\n for line in data.split('\\n'):\n if len(line) == 0:\n continue\n ignored = False\n for rule in self.ignore_errors:\n if re.search(rule, line):\n ignored = True\n self.ignored_error_count += 1\n if self.debug:\n print(\"text match line \")\n print(\"rule = \" + rule)\n print(\"line = \" + line)\n print(\"---------\")\n break\n if ignored is False:\n text += line + '\\n'\n\n self.show_tests_panel()\n selection_was_at_end = (len(self.output_view.sel()) == 1 and self.output_view.sel()[0] == sublime.Region(self.output_view.size()))\n with Edit(self.output_view, True) as edit:\n edit.insert(self.output_view.size(), text)\n\n if end and not self.use_node_jslint:\n text = '\\njslint: ignored ' + str(self.ignored_error_count) + ' errors.\\n\\n'\n with Edit(self.output_view, True) as edit:\n edit.insert(0, text)", "metadata": "root.JslintCommand.append_data", "header": "['class', 'JslintCommand', '(', 'sublime_plugin', '.', 'WindowCommand', ')', ':', '___EOS___']", "index": 73 }, { "content": " def on_selection_modified(self, view):\n if JsLintEventListener.disabled:\n return\n if view.name() != RESULT_VIEW_NAME:\n return\n region = view.line(view.sel()[0])\n s = sublime.load_settings(SETTINGS_FILE)\n\n # make sure call once.\n if self.previous_resion == region:\n return\n self.previous_resion = region\n\n # extract line from jslint result.\n if (s.get('use_node_jslint', False)):\n pattern_position = \"\\\\/\\\\/ Line (\\d+), Pos (\\d+)$\"\n text = view.substr(region)\n text = re.findall(pattern_position, text)\n if len(text) > 0:\n line = int(text[0][0])\n col = int(text[0][1])\n else:\n text = view.substr(region).split(':')\n if len(text) < 4 or text[0] != 'jslint' or re.match('\\d+', text[2]) is None or re.match('\\d+', text[3]) is None:\n return\n line = int(text[2])\n col = int(text[3])\n\n # hightligh view line.\n view.add_regions(RESULT_VIEW_NAME, [region], \"comment\")\n\n # find the file view.\n file_path = view.settings().get('file_path')\n window = sublime.active_window()\n file_view = None\n for v in window.views():\n if v.file_name() == file_path:\n file_view = v\n break\n if file_view is None:\n return\n\n self.file_view = file_view\n window.focus_view(file_view)\n file_view.run_command(\"goto_line\", {\"line\": line})\n file_region = file_view.line(file_view.sel()[0])\n\n # highlight file_view line\n file_view.add_regions(RESULT_VIEW_NAME, [file_region], \"string\")", "metadata": "root.JsLintEventListener.on_selection_modified", "header": "['class', 'JsLintEventListener', '(', 'sublime_plugin', '.', 'EventListener', ')', ':', '___EOS___']", "index": 161 } ]
[ { "span": "selection_was_at_end ", "start_line": 112, "start_column": 8, "end_line": 112, "end_column": 28 }, { "span": "col ", "start_line": 181, "start_column": 16, "end_line": 181, "end_column": 19 }, { "span": "col ", "start_line": 187, "start_column": 12, "end_line": 187, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Js", "lint", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Window", "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_", "def_", "append", "\\u", "data_", "(_", "self_", ",_", "proc_", ",_", "b", "Data_", ",_", "end_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "DEBU", "G", ":", " ", "append", "\\u", "data", " ", "start", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "b", "Data_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "DEBU", "G", ":", " ", "data", "=", " ", "\"_", "+_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "buffered", "\\u", "data_", "=_", "self_", "._", "buffered", "\\u", "data_", "+_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "buffered", "\\u", "data_", "._", "replace_", "(_", "self_", "._", "file", "\\u", "path_", ",_", "self_", "._", "file", "\\u", "name_", ")_", "._", "replace_", "(_", "'\\\\", "r", "\\\\", "n", "'_", ",_", "'\\\\", "n", "'_", ")_", "._", "replace_", "(_", "'\\\\", "r", "'_", ",_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "end_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rse", "p", "\\u", "pos_", "=_", "data_", "._", "rfind_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rse", "p", "\\u", "pos_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "found", " ", "full", " ", "line", "._", "\\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_", "self_", "._", "buffered", "\\u", "data_", "=_", "data_", "[_", "rse", "p", "\\u", "pos_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "[_", ":_", "rse", "p", "\\u", "pos_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ignore", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "self_", "._", "ignore", "\\u", "errors_", ")_", ">_", "0_", ")_", "and_", "(_", "not_", "self_", "._", "use", "\\u", "node", "\\u", "js", "lint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "data_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "line_", ")_", "==_", "0_", ":_", "\\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_", "ignored_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rule_", "in_", "self_", "._", "ignore", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "re_", "._", "search_", "(_", "rule_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ignored_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ignore", "d\\u", "error", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "\"", "text", " ", "match", " ", "line", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "rule", " ", "=", " ", "\"_", "+_", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "line", " ", "=", " ", "\"_", "+_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"-------", "--\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ignored_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "text_", "+=_", "line_", "+_", "'\\\\", "n", "'_", "\\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_", "self_", "._", "show", "\\u", "tests", "\\u", "panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selection", "\\u", "was", "\\u", "at", "\\u", "end_", "=_", "(_", "len_", "(_", "self_", "._", "output", "\\u", "view_", "._", "sel_", "(_", ")_", ")_", "==_", "1_", "and_", "self_", "._", "output", "\\u", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", "==_", "sublime_", "._", "Region_", "(_", "self_", "._", "output", "\\u", "view_", "._", "size_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Edit_", "(_", "self_", "._", "output", "\\u", "view_", ",_", "True_", ")_", "as_", "edit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edit_", "._", "insert_", "(_", "self_", "._", "output", "\\u", "view_", "._", "size_", "(_", ")_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "end_", "and_", "not_", "self_", "._", "use", "\\u", "node", "\\u", "js", "lint_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "'\\\\", "nj", "sli", "nt", ":", " ", "ignore", "d", " ", "'_", "+_", "str_", "(_", "self_", "._", "ignore", "d\\u", "error", "\\u", "count_", ")_", "+_", "'", " ", "error", "s", ".\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Edit_", "(_", "self_", "._", "output", "\\u", "view_", ",_", "True_", ")_", "as_", "edit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edit_", "._", "insert_", "(_", "0_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "Lin", "t", "Event", "Listener_", "(_", "sublim", "e\\u", "plugin_", "._", "Event", "Listener_", ")_", ":_", "\\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_", "on", "\\u", "selection", "\\u", "modified_", "(_", "self_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Js", "Lin", "t", "Event", "Listener_", "._", "disabled_", ":_", "\\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_", "view_", "._", "name_", "(_", ")_", "!=_", "RESU", "LT", "\\u", "VIEW", "\\u", "NAME_", ":_", "\\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_", "region_", "=_", "view_", "._", "line_", "(_", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "sublime_", "._", "load", "\\u", "settings_", "(_", "SETTING", "S", "\\u", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "call", " ", "onc", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "previ", "ous", "\\u", "resi", "on_", "==_", "region_", ":_", "\\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_", "self_", "._", "previ", "ous", "\\u", "resi", "on_", "=_", "region_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "line", " ", "from", " ", "js", "lint", " ", "result", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "s_", "._", "get_", "(_", "'", "use", "\\u", "node", "\\u", "js", "lint", "'_", ",_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern", "\\u", "position_", "=_", "\"\\\\\\\\", "/\\\\\\\\", "/", " ", "Line", " ", "(\\\\", "d", "+)", ",", " ", "Pos", " ", "(\\\\", "d", "+)", "$\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "view_", "._", "substr_", "(_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "re_", "._", "findall_", "(_", "pattern", "\\u", "position_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "text_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "int_", "(_", "text_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "int_", "(_", "text_", "[_", "0_", "]_", "[_", "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 ", " _", "text_", "=_", "view_", "._", "substr_", "(_", "region_", ")_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "text_", ")_", "<_", "4_", "or_", "text_", "[_", "0_", "]_", "!=_", "'", "js", "lint", "'_", "or_", "re_", "._", "match_", "(_", "'\\\\", "d", "+'_", ",_", "text_", "[_", "2_", "]_", ")_", "is_", "None_", "or_", "re_", "._", "match_", "(_", "'\\\\", "d", "+'_", ",_", "text_", "[_", "3_", "]_", ")_", "is_", "None_", ":_", "\\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_", "line_", "=_", "int_", "(_", "text_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "int_", "(_", "text_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "high", "tli", "gh", " ", "view", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view_", "._", "add", "\\u", "regions_", "(_", "RESU", "LT", "\\u", "VIEW", "\\u", "NAME_", ",_", "[_", "region_", "]_", ",_", "\"", "comment", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "file", " ", "view", "._", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "path_", "=_", "view_", "._", "settings_", "(_", ")_", "._", "get_", "(_", "'", "file", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window_", "=_", "sublime_", "._", "active", "\\u", "window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "view_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "window_", "._", "views_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "._", "file", "\\u", "name_", "(_", ")_", "==_", "file", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "view_", "=_", "v_", "\\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_", "if_", "file", "\\u", "view_", "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_", "self_", "._", "file", "\\u", "view_", "=_", "file", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window_", "._", "foc", "us", "\\u", "view_", "(_", "file", "\\u", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "view_", "._", "run", "\\u", "command_", "(_", "\"", "got", "o", "\\u", "line", "\"_", ",_", "{_", "\"", "line", "\"_", ":_", "line_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "region_", "=_", "file", "\\u", "view_", "._", "line_", "(_", "file", "\\u", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "highlight", " ", "file", "\\u", "view", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "view_", "._", "add", "\\u", "regions_", "(_", "RESU", "LT", "\\u", "VIEW", "\\u", "NAME_", ",_", "[_", "file", "\\u", "region_", "]_", ",_", "\"", "string", "\"_", ")_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
zmap/ztag/ztag/encoders/__init__.py
[ { "content": "from encoders import JSONEncoder, LocalJSONEncoder\nfrom encoders import HexEncoder\nfrom encoders import IdentityEncoder\nfrom protobuf import ProtobufObjectEncoder\nfrom protobuf import RecordEncoder\nfrom protobuf import HexRecordEncoder\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from encoders import JSONEncoder, LocalJSONEncoder", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 50 }, { "span": "from encoders import HexEncoder", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 31 }, { "span": "from encoders import IdentityEncoder", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 36 }, { "span": "from protobuf import ProtobufObjectEncoder", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 42 }, { "span": "from protobuf import RecordEncoder", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 34 }, { "span": "from protobuf import HexRecordEncoder", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "encoders", "_", "import_", "JSO", "NE", "ncode", "r_", ",_", "Local", "JSO", "NE", "ncode", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "encoders", "_", "import_", "Hex", "Encoder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "encoders", "_", "import_", "Ident", "it", "y", "Encoder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "protobuf_", "import_", "Proto", "buf", "Object", "Encoder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "protobuf_", "import_", "Record", "Encoder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "protobuf_", "import_", "Hex", "Record", "Encoder_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 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, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1 ]
Unused import
ImageEngine/gaffer/python/GafferAppleseedTest/__init__.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2014, Esteban Tovagliari. 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 AppleseedLightTest import AppleseedLightTest\nfrom AppleseedRenderTest import AppleseedRenderTest\nfrom AppleseedOptionsTest import AppleseedOptionsTest\nfrom AppleseedAttributesTest import AppleseedAttributesTest\n\nif __name__ == \"__main__\":\n\timport unittest\n\tunittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from AppleseedLightTest import AppleseedLightTest", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 49 }, { "span": "from AppleseedRenderTest import AppleseedRenderTest", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 51 }, { "span": "from AppleseedOptionsTest import AppleseedOptionsTest", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 53 }, { "span": "from AppleseedAttributesTest import AppleseedAttributesTest", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 59 } ]
[]
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", ")", " ", "2014", ",", " ", "Est", "eba", "n", " ", "To", "vag", "lia", "ri", ".", " ", "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_", "Apple", "seed", "Light", "Test_", "import_", "Apple", "seed", "Light", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Apple", "seed", "Render", "Test_", "import_", "Apple", "seed", "Render", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Apple", "seed", "Optio", "ns", "Test_", "import_", "Apple", "seed", "Optio", "ns", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Apple", "seed", "Attribute", "s", "Test_", "import_", "Apple", "seed", "Attribute", "s", "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, 2, 2, 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, 0, 1, 1, 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, 1, 1, 1, 1, 1, 1, 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 ]
Imprecise assert
pinax/django-waitinglist/waitinglist/tests.py
[ { "content": " def test_survey_form_save(self):\n form = SurveyForm(\n data={\n self.ice_cream_question.name: \"Strawberry\",\n self.summer_question.name: \"Swam in the lake\",\n self.season_question.name: self.summer.pk,\n self.city_question.name: [self.nashville.pk, self.boston.pk],\n self.golf_question.name: True\n },\n survey=self.survey\n )\n self.assertTrue(form.is_valid())\n form.save(self.entry.surveyinstance)\n answers = self.entry.surveyinstance.answers.all()\n self.assertEquals(answers.count(), 5)\n self.assertEquals(answers.get(question=self.ice_cream_question).value, \"Strawberry\")\n self.assertEquals(answers.get(question=self.summer_question).value, \"Swam in the lake\")\n self.assertEquals(answers.get(question=self.season_question).value, self.summer.label)\n self.assertTrue(\n self.nashville.label in answers.get(question=self.city_question).value\n )\n self.assertTrue(\n self.boston.label in answers.get(question=self.city_question).value\n )\n self.assertTrue(answers.get(question=self.golf_question).value_boolean)", "metadata": "root.SurveyTests.test_survey_form_save", "header": "['class', 'SurveyTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 100 } ]
[ { "span": "self.assertTrue(\n self.nashville.label in answers.get(question=self.city_question).value\n )", "start_line": 118, "start_column": 8, "end_line": 120, "end_column": 9 }, { "span": "self.assertTrue(\n self.boston.label in answers.get(question=self.city_question).value\n )", "start_line": 121, "start_column": 8, "end_line": 123, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Surv", "ey", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "survey", "\\u", "form", "\\u", "save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Surv", "ey", "Form_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ice", "\\u", "crea", "m", "\\u", "question_", "._", "name_", ":_", "\"", "Stra", "wb", "err", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "summer", "\\u", "question_", "._", "name_", ":_", "\"", "Swa", "m", " ", "in", " ", "the", " ", "lake", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "season", "\\u", "question_", "._", "name_", ":_", "self_", "._", "summer", "_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "city", "\\u", "question_", "._", "name_", ":_", "[_", "self_", "._", "nas", "hv", "ille", "_", "._", "pk_", ",_", "self_", "._", "bos", "ton_", "._", "pk_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gol", "f", "\\u", "question_", "._", "name_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "survey_", "=_", "self_", "._", "survey_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "save_", "(_", "self_", "._", "entry_", "._", "survey", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answers_", "=_", "self_", "._", "entry_", "._", "survey", "instance_", "._", "answers_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "answers_", "._", "count_", "(_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "answers_", "._", "get_", "(_", "question_", "=_", "self_", "._", "ice", "\\u", "crea", "m", "\\u", "question_", ")_", "._", "value_", ",_", "\"", "Stra", "wb", "err", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "answers_", "._", "get_", "(_", "question_", "=_", "self_", "._", "summer", "\\u", "question_", ")_", "._", "value_", ",_", "\"", "Swa", "m", " ", "in", " ", "the", " ", "lake", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "answers_", "._", "get_", "(_", "question_", "=_", "self_", "._", "season", "\\u", "question_", ")_", "._", "value_", ",_", "self_", "._", "summer", "_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "nas", "hv", "ille", "_", "._", "label_", "in_", "answers_", "._", "get_", "(_", "question_", "=_", "self_", "._", "city", "\\u", "question_", ")_", "._", "value_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bos", "ton_", "._", "label_", "in_", "answers_", "._", "get_", "(_", "question_", "=_", "self_", "._", "city", "\\u", "question_", ")_", "._", "value_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "answers_", "._", "get_", "(_", "question_", "=_", "self_", "._",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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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
google/gfw-toolkit/toolkit/cmds/report_org_counts.py
[ { "content": "#!/usr/bin/python\n#\n# Copyright 2014 Google Inc. All Rights Reserved.\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\"\"\"Produce reports showing counts of user by org.\n\nMakes use of the report_users command. Produces multiple csv files\nthat summarize domain user counts by organizational unit.\n\"\"\"\n\nimport sys\n\n# setup_path required to allow imports from component dirs (e.g. utils)\n# and lib (where the OAuth and Google API Python Client modules reside).\nimport setup_path # pylint: disable=unused-import,g-bad-import-order\n\nfrom utils import admin_api_tool_errors\nfrom utils import auth_helper # pylint: disable=unused-import\nfrom utils import cmd_utils\nfrom utils import common_flags\nfrom utils import file_manager\nfrom utils import log_utils\nfrom utils import report_utils\n\n\n_REPORT_USERS_ORGS_FILE_NAME = '_report_users_orgs.csv.tmp'\n_REPORT_ORGS_BY_ACTIVE_FILE_NAME = 'orgs_by_active.csv'\n_REPORT_ORGS_BY_OU_FILE_NAME = 'orgs_by_ou.csv'\n\n\n_REPORT_BY_ACTIVE_HEADER = ['ACTIVE', 'SUSPENDED', 'OU']\n_REPORT_BY_ORG_HEADER = ['OU', 'ACTIVE', 'SUSPENDED']\n_REPORT_FILTER_FIELDS = ['orgUnitPath', 'suspended']\n\n\nFILE_MANAGER = file_manager.FILE_MANAGER\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n main(sys.argv[1:])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def GenerateUserReport(flags):\n \"\"\"Run the command to create the report file.\n\n report_users error-exits if the file is found without --force.\n Instead, re-process the existing file in that situation.\n\n Args:\n flags: Argparse flags object with apps_domain, resume and first_n.\n \"\"\"\n if FILE_MANAGER.FileExists(_REPORT_USERS_ORGS_FILE_NAME) and not flags.force:\n print 'Showing counts from existing file.'\n return\n\n print 'Generating new counts...'\n\n arg_list = [\n '--output_file=%s' % _REPORT_USERS_ORGS_FILE_NAME,\n '--csv_fields=%s' % ','.join(_REPORT_FILTER_FIELDS),\n ]\n for flag_value, flag_string in [\n (flags.apps_domain, '--apps_domain=%s' % flags.apps_domain),\n (flags.force, '--force'),\n (flags.verbose, '--verbose')]:\n if flag_value:\n arg_list.append(flag_string)\n try:\n cmd_utils.RunPyCmd('report_users.py', arg_list)\n except admin_api_tool_errors.AdminAPIToolCmdError as e:\n log_utils.LogError('Unable to generate org data.', e)\n sys.exit(1)", "metadata": "root.GenerateUserReport", "header": "['module', '___EOS___']", "index": 50 }, { "content": "def _ReadAndCountUsersOrgsCSV():\n \"\"\"Helper to read the users org report for summarizing.\n\n Always expects to find a header row since that's how we write it.\n\n Returns:\n Tuple of 2 counters: (#active_users, #suspended_users)\n \"\"\"\n csv_rows = FILE_MANAGER.ReadCsvFile(_REPORT_USERS_ORGS_FILE_NAME)\n if csv_rows[0] != _REPORT_FILTER_FIELDS:\n log_utils.LogError('Unexpected header in file %s. Try running with '\n '--force to generate a new file.' %\n FILE_MANAGER.BuildFullPathToFileName(\n _REPORT_USERS_ORGS_FILE_NAME))\n sys.exit(1)\n\n active_user_count = report_utils.Counter()\n suspended_user_count = report_utils.Counter()\n for org, suspended in csv_rows[1:]:\n if suspended == 'True':\n suspended_user_count.Increment(org)\n else:\n active_user_count.Increment(org)\n return active_user_count, suspended_user_count", "metadata": "root._ReadAndCountUsersOrgsCSV", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def SummarizeUserOrgReport():\n \"\"\"Read the generated csv file and count members in orgs.\n\n Returns:\n Tuple of 2 lists of tuples (OU, #active, #suspended):\n -List of tuples ordered by #active_users descending\n -List of tuples ordered by OU name alphabetically ascending.\n\n For example, a simple result (a domain with 1 Org Unit) might be:\n [(929, 0, '/')], [('/', 929, 0)]\n \"\"\"\n # This is tricky because a domain may be entirely active users, suspended\n # users or (most commonly) a mix of both. Therefore need to handle cases\n # where an entire subdomain is suspended users carefully.\n active_user_counter, suspended_user_counter = _ReadAndCountUsersOrgsCSV()\n # A list of the most common organizations (subdomains) ordered by a count\n # of subdomain members descending.\n list_of_org_data_sorted_by_active_user_descending = []\n for org, active_user_count in active_user_counter.FilterAndSortMostCommon():\n suspended_user_count = suspended_user_counter.data.get(org, 0)\n list_of_org_data_sorted_by_active_user_descending.append(\n (active_user_count, suspended_user_count, org))\n\n # A list of all organizations (subdomains) ordered by name.\n org_unit_names = set(active_user_counter.data.keys() +\n suspended_user_counter.data.keys())\n list_of_org_data_sorted_by_org_unit_name_alphabetically = []\n for org in sorted(org_unit_names):\n active_user_count = active_user_counter.data.get(org, 0)\n suspended_user_count = suspended_user_counter.data.get(org, 0)\n list_of_org_data_sorted_by_org_unit_name_alphabetically.append(\n (org, active_user_count, suspended_user_count))\n return (list_of_org_data_sorted_by_active_user_descending,\n list_of_org_data_sorted_by_org_unit_name_alphabetically)", "metadata": "root.SummarizeUserOrgReport", "header": "['module', '___EOS___']", "index": 108 }, { "content": "def PrintOrgCounts(orgs_by_active, orgs_by_ou):\n \"\"\"Print org groups with related counts of users.\n\n Args:\n orgs_by_active: List of tuples (#active, #suspended, org) order by #active.\n orgs_by_ou: List of tuples (org, #active, #suspended) ordered by ou.\n \"\"\"\n print report_utils.BORDER\n # Order by #active descending.\n print ','.join(_REPORT_BY_ACTIVE_HEADER)\n for active, suspended, org in orgs_by_active:\n print '%d,%d,%s' % (active, suspended, org)\n print report_utils.BORDER\n # Order by OU ascending.\n print ','.join(_REPORT_BY_ORG_HEADER)\n for org, active, suspended in orgs_by_ou:\n print '%s,%d,%d' % (org, active, suspended)\n print report_utils.BORDER", "metadata": "root.PrintOrgCounts", "header": "['module', '___EOS___']", "index": 144 }, { "content": "def WriteOrgCounts(orgs_by_active, orgs_by_ou, flags):\n \"\"\"Write org counts to two csv files for later use.\n\n Args:\n orgs_by_active: List of tuples (#active, #suspended, org) order by #active.\n orgs_by_ou: List of tuples (org, #active, #suspended) ordered by ou.\n flags: Argparse flags object with apps_domain, resume and first_n.\n \"\"\"\n try:\n filename_path = FILE_MANAGER.WriteCSVFile(_REPORT_ORGS_BY_ACTIVE_FILE_NAME,\n orgs_by_active,\n _REPORT_BY_ACTIVE_HEADER,\n overwrite_ok=flags.force)\n print 'Wrote report of org users sorted by active user count: %s.' % (\n filename_path)\n filename_path = FILE_MANAGER.WriteCSVFile(_REPORT_ORGS_BY_OU_FILE_NAME,\n orgs_by_ou,\n _REPORT_BY_ORG_HEADER,\n overwrite_ok=flags.force)\n print 'Wrote report of org users sorted by org-unt count: %s.' % (\n filename_path)\n except admin_api_tool_errors.AdminAPIToolFileError:\n log_utils.LogError('CSV file(s) already exist. Use --force to overwrite.')\n sys.exit(1)", "metadata": "root.WriteOrgCounts", "header": "['module', '___EOS___']", "index": 164 }, { "content": "def AddFlags(arg_parser):\n \"\"\"Handle command line flags unique to this script.\n\n Args:\n arg_parser: object from argparse.ArgumentParser() to accumulate flags.\n \"\"\"\n common_flags.DefineAppsDomainFlagWithDefault(arg_parser)\n common_flags.DefineForceFlagWithDefaultFalse(arg_parser)\n common_flags.DefineVerboseFlagWithDefaultFalse(arg_parser)\n\n arg_parser.add_argument('--csv', action='store_true', default=False,\n help='Output results to a csv file.')", "metadata": "root.AddFlags", "header": "['module', '___EOS___']", "index": 190 }, { "content": "def main(argv):\n \"\"\"Run report_users, parse and print a summary of its results.\"\"\"\n flags = common_flags.ParseFlags(argv, 'Create a report of org counts.',\n AddFlags)\n if flags.csv:\n FILE_MANAGER.ExitIfCannotOverwriteFile(_REPORT_ORGS_BY_ACTIVE_FILE_NAME,\n overwrite_ok=flags.force)\n FILE_MANAGER.ExitIfCannotOverwriteFile(_REPORT_ORGS_BY_OU_FILE_NAME,\n overwrite_ok=flags.force)\n GenerateUserReport(flags)\n orgs_by_active, orgs_by_ou = SummarizeUserOrgReport()\n PrintOrgCounts(orgs_by_active, orgs_by_ou)\n if flags.csv:\n WriteOrgCounts(orgs_by_active, orgs_by_ou, flags)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 204 } ]
[ { "span": "import setup_path ", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 17 }, { "span": "from utils import auth_helper ", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\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_", "\"\"\"", "Produce", " ", "report", "s", " ", "showin", "g", " ", "count", "s", " ", "of", " ", "user", " ", "by", " ", "org", ".", "\\", "10", ";", "\\", "10", ";", "Make", "s", " ", "use", " ", "of", " ", "the", " ", "report", "\\u", "users", " ", "command", ".", " ", "Produce", "s", " ", "multiple", " ", "csv", " ", "files", "\\", "10", ";", "tha", "t", " ", "summarize", " ", "domain", " ", "user", " ", "count", "s", " ", "by", " ", "organization", "al", " ", "unit", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", "\\u", "path", " ", "require", "d", " ", "to", " ", "allow", " ", "import", "s", " ", "from", " ", "component", " ", "dirs", " ", "(", "e", ".", "g", ".", " ", "util", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "lib", " ", "(", "where", " ", "the", " ", "OA", "uth", " ", "and", " ", "Goo", "gle", " ", "API", " ", "Pyth", "on", " ", "Client", " ", "module", "s", " ", "reside", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "setup", "\\u", "path_", "#", " ", "pylint", ":", " ", "disable", "=", "unu", "sed", "-", "import", ",", "g", "-", "bad", "-", "import", "-", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "utils_", "import_", "admin", "\\u", "api", "\\u", "tool", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "auth", "\\u", "helper_", "#", " ", "pylint", ":", " ", "disable", "=", "unu", "sed", "-", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "cmd", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "common", "\\u", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "file", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "log", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "report", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "REPORT", "\\u", "USERS", "\\u", "ORG", "S", "\\u", "FILE", "\\u", "NAME_", "=_", "'\\u", "report", "\\u", "users", "\\u", "orgs", ".", "csv", ".", "tmp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "REPORT", "\\u", "ORG", "S", "\\u", "BY", "\\u", "ACTI", "VE", "\\u", "FILE", "\\u", "NAME_", "=_", "'", "orgs", "\\u", "by", "\\u", "active", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "REPORT", "\\u", "ORG", "S", "\\u", "BY", "\\u", "OU", "\\u", "FILE", "\\u", "NAME_", "=_", "'", "orgs", "\\u", "by", "\\u", "ou", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "REPORT", "\\u", "BY", "\\u", "ACTI", "VE", "\\u", "HEADER_", "=_", "[_", "'", "ACTI", "VE", "'_", ",_", "'", "SUS", "PEND", "ED", "'_", ",_", "'", "OU", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "REPORT", "\\u", "BY", "\\u", "ORG", "\\u", "HEADER_", "=_", "[_", "'", "OU", "'_", ",_", "'", "ACTI", "VE", "'_", ",_", "'", "SUS", "PEND", "ED", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "REPORT", "\\u", "FILTER", "\\u", "FIELDS_", "=_", "[_", "'", "org", "Unit", "Path", "'_", ",_", "'", "suspended", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FILE", "\\u", "MANAGER", "_", "=_", "file", "\\u", "manager_", "._", "FILE", "\\u", "MANAGER", "_", "\\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\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Generate", "User", "Report_", "(_", "flags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "the", " ", "command", " ", "to", " ", "create", " ", "the", " ", "report", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "report", "\\u", "users", " ", "error", "-", "exits", " ", "if", " ", "the", " ", "file", " ", "is", " ", "found", " ", "with", "out", " ", "--", "force", ".", "\\", "10", ";", " ", " ", "Ins", "tea", "d", ",", " ", "re", "-", "process", " ", "the", " ", "exist", "ing", " ", "file", " ", "in", " ", "tha", "t", " ", "situation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "flags", ":", " ", "Arg", "parse", " ", "flags", " ", "object", " ", "with", " ", "apps", "\\u", "domain", ",", " ", "resum", "e", " ", "and", " ", "first", "\\u", "n", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "FILE", "\\u", "MANAGER", "_", "._", "File", "Exists_", "(_", "\\u", "REPORT", "\\u", "USERS", "\\u", "ORG", "S", "\\u", "FILE", "\\u", "NAME_", ")_", "and_", "not_", "flags_", "._", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Show", "ing", " ", "count", "s", " ", "from", " ", "exist", "ing", " ", "file", ".'_", "\\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_", "print_", "'", "Generat", "ing", " ", "new", " ", "count", "s", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arg", "\\u", "list_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "output", "\\u", "file", "=", "%", "s", "'_", "%_", "\\u", "REPORT", "\\u", "USERS", "\\u", "ORG", "S", "\\u", "FILE", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "csv", "\\u", "fields", "=", "%", "s", "'_", "%_", "','_", "._", "join_", "(_", "\\u", "REPORT", "\\u", "FILTER", "\\u", "FIELDS_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "flag", "\\u", "value_", ",_", "flag", "\\u", "string_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "flags_", "._", "apps", "\\u", "domain_", ",_", "'--", "apps", "\\u", "domain", "=", "%", "s", "'_", "%_", "flags_", "._", "apps", "\\u", "domain_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "flags_", "._", "force_", ",_", "'--", "force", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "flags_", "._", "verbose_", ",_", "'--", "verbo", "se", "'_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "flag", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg", "\\u", "list_", "._", "append_", "(_", "flag", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "cmd", "\\u", "utils_", "._", "Run", "Py", "Cmd_", "(_", "'", "report", "\\u", "users", ".", "py", "'_", ",_", "arg", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "admin", "\\u", "api", "\\u", "tool", "\\u", "errors_", "._", "Admi", "n", "API", "Tool", "Cmd", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "\\u", "utils_", "._", "Log", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "generat", "e", " ", "org", " ", "data", ".'_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\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", "Read", "And", "Count", "User", "s", "Org", "s", "CSV_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "to", " ", "read", " ", "the", " ", "users", " ", "org", " ", "report", " ", "for", " ", "summar", "izi", "ng", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Al", "way", "s", " ", "expect", "s", " ", "to", " ", "find", " ", "a", " ", "header", " ", "row", " ", "sinc", "e", " ", "tha", "t", "'", "s", " ", "how", " ", "we", " ", "write", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Tup", "le", " ", "of", " ", "2", " ", "counter", "s", ":", " ", "(", "#", "active", "\\u", "users", ",", " ", "#", "suspended", "\\u", "users", ")", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "\\u", "rows_", "=_", "FILE", "\\u", "MANAGER", "_", "._", "Read", "Cs", "v", "File_", "(_", "\\u", "REPORT", "\\u", "USERS", "\\u", "ORG", "S", "\\u", "FILE", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "csv", "\\u", "rows_", "[_", "0_", "]_", "!=_", "\\u", "REPORT", "\\u", "FILTER", "\\u", "FIELDS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "\\u", "utils_", "._", "Log", "Error_", "(_", "'", "Une", "xpe", "cte", "d", " ", "header", " ", "in", " ", "file", " ", "%", "s", ".", " ", "Tr", "y", " ", "runn", "ing", " ", "with", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "force", " ", "to", " ", "generat", "e", " ", "a", " ", "new", " ", "file", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "FILE", "\\u", "MANAGER", "_", "._", "Build", "Full", "Path", "To", "File", "Name_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "REPORT", "\\u", "USERS", "\\u", "ORG", "S", "\\u", "FILE", "\\u", "NAME_", ")_", ")_", "\\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_", "active", "\\u", "user", "\\u", "count_", "=_", "report", "\\u", "utils_", "._", "Counter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suspended", "\\u", "user", "\\u", "count_", "=_", "report", "\\u", "utils_", "._", "Counter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "org_", ",_", "suspended", "_", "in_", "csv", "\\u", "rows_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "suspended", "_", "==_", "'", "Tru", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suspended", "\\u", "user", "\\u", "count_", "._", "Increment", "_", "(_", "org_", ")_", "\\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 ", " _", "active", "\\u", "user", "\\u", "count_", "._", "Increment", "_", "(_", "org_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "active", "\\u", "user", "\\u", "count_", ",_", "suspended", "\\u", "user", "\\u", "count_", "\\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_", "Summari", "ze", "User", "Org", "Report_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "the", " ", "generat", "ed", " ", "csv", " ", "file", " ", "and", " ", "count", " ", "member", "s", " ", "in", " ", "orgs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Tup", "le", " ", "of", " ", "2", " ", "lists", " ", "of", " ", "tuple", "s", " ", "(", "OU", ",", " ", "#", "active", ",", " ", "#", "suspended", "):", "\\", "10", ";", " ", " ", " ", " ", "-", "List", " ", "of", " ", "tuple", "s", " ", "order", "ed", " ", "by", " ", "#", "active", "\\u", "users", " ", "descend", "ing", "\\", "10", ";", " ", " ", " ", " ", "-", "List", " ", "of", " ", "tuple", "s", " ", "order", "ed", " ", "by", " ", "OU", " ", "name", " ", "alphabetic", "ally", " ", "ascen", "ding", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "a", " ", "simple", " ", "result", " ", "(", "a", " ", "domain", " ", "with", " ", "1", " ", "Org", " ", "Unit", ")", " ", "mig", "ht", " ", "be", ":", "\\", "10", ";", " ", " ", " ", " ", "[(", "929", ",", " ", "0", ",", " ", "'/'", ")]", ",", " ", "[(", "'/'", ",", " ", "929", ",", " ", "0", ")]", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "trick", "y", " ", "bec", "aus", "e", " ", "a", " ", "domain", " ", "may", " ", "be", " ", "entire", "ly", " ", "active", " ", "users", ",", " ", "suspended", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "users", " ", "or", " ", "(", "most", " ", "common", "ly", ")", " ", "a", " ", "mix", " ", "of", " ", "bot", "h", ".", " ", "There", "fore", " ", "need", " ", "to", " ", "handle", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "where", " ", "an", " ", "entire", " ", "subdomain", " ", "is", " ", "suspended", " ", "users", " ", "care", "full", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "active", "\\u", "user", "\\u", "counter_", ",_", "suspended", "\\u", "user", "\\u", "counter_", "=_", "\\u", "Read", "And", "Count", "User", "s", "Org", "s", "CSV_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "the", " ", "most", " ", "common", " ", "organization", "s", " ", "(", "subdomain", "s", ")", " ", "order", "ed", " ", "by", " ", "a", " ", "count_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "subdomain", " ", "member", "s", " ", "descend", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "of", "\\u", "org", "\\u", "data\\u", "sorte", "d\\u", "by", "\\u", "active", "\\u", "user", "\\u", "descend", "ing_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "org_", ",_", "active", "\\u", "user", "\\u", "count_", "in_", "active", "\\u", "user", "\\u", "counter_", "._", "Filter", "And", "Sort", "Mos", "t", "Common_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suspended", "\\u", "user", "\\u", "count_", "=_", "suspended", "\\u", "user", "\\u", "counter_", "._", "data_", "._", "get_", "(_", "org_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "of", "\\u", "org", "\\u", "data\\u", "sorte", "d\\u", "by", "\\u", "active", "\\u", "user", "\\u", "descend", "ing_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "active", "\\u", "user", "\\u", "count_", ",_", "suspended", "\\u", "user", "\\u", "count_", ",_", "org_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "all", " ", "organization", "s", " ", "(", "subdomain", "s", ")", " ", "order", "ed", " ", "by", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "org", "\\u", "unit", "\\u", "names_", "=_", "set_", "(_", "active", "\\u", "user", "\\u", "counter_", "._", "data_", "._", "keys_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "suspended", "\\u", "user", "\\u", "counter_", "._", "data_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "of", "\\u", "org", "\\u", "data\\u", "sorte", "d\\u", "by", "\\u", "org", "\\u", "unit", "\\u", "name", "\\u", "alphabetic", "ally", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "org_", "in_", "sorted_", "(_", "org", "\\u", "unit", "\\u", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "active", "\\u", "user", "\\u", "count_", "=_", "active", "\\u", "user", "\\u", "counter_", "._", "data_", "._", "get_", "(_", "org_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suspended", "\\u", "user", "\\u", "count_", "=_", "suspended", "\\u", "user", "\\u", "counter_", "._", "data_", "._", "get_", "(_", "org_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "of", "\\u", "org", "\\u", "data\\u", "sorte", "d\\u", "by", "\\u", "org", "\\u", "unit", "\\u", "name", "\\u", "alphabetic", "ally", "_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "org_", ",_", "active", "\\u", "user", "\\u", "count_", ",_", "suspended", "\\u", "user", "\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "list", "\\u", "of", "\\u", "org", "\\u", "data\\u", "sorte", "d\\u", "by", "\\u", "active", "\\u", "user", "\\u", "descend", "ing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "of", "\\u", "org", "\\u", "data\\u", "sorte", "d\\u", "by", "\\u", "org", "\\u", "unit", "\\u", "name", "\\u", "alphabetic", "ally", "_", ")_", "\\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_", "Print", "Org", "Counts_", "(_", "orgs", "\\u", "by", "\\u", "active_", ",_", "orgs", "\\u", "by", "\\u", "ou_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Print", " ", "org", " ", "group", "s", " ", "with", " ", "relate", "d", " ", "count", "s", " ", "of", " ", "users", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "orgs", "\\u", "by", "\\u", "active", ":", " ", "List", " ", "of", " ", "tuple", "s", " ", "(", "#", "active", ",", " ", "#", "suspended", ",", " ", "org", ")", " ", "order", " ", "by", " ", "#", "active", ".", "\\", "10", ";", " ", " ", " ", " ", "orgs", "\\u", "by", "\\u", "ou", ":", " ", "List", " ", "of", " ", "tuple", "s", " ", "(", "org", ",", " ", "#", "active", ",", " ", "#", "suspended", ")", " ", "order", "ed", " ", "by", " ", "ou", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "report", "\\u", "utils_", "._", "BORDER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Order", " ", "by", " ", "#", "active", " ", "descend", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "print_", "','_", "._", "join_", "(_", "\\u", "REPORT", "\\u", "BY", "\\u", "ACTI", "VE", "\\u", "HEADER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "active_", ",_", "suspended", "_", ",_", "org_", "in_", "orgs", "\\u", "by", "\\u", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'%", "d", ",%", "d", ",%", "s", "'_", "%_", "(_", "active_", ",_", "suspended", "_", ",_", "org_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "report", "\\u", "utils_", "._", "BORDER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Order", " ", "by", " ", "OU", " ", "ascen", "ding", "._", "\\u\\u\\uNL\\u\\u\\u_", "print_", "','_", "._", "join_", "(_", "\\u", "REPORT", "\\u", "BY", "\\u", "ORG", "\\u", "HEADER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "org_", ",_", "active_", ",_", "suspended", "_", "in_", "orgs", "\\u", "by", "\\u", "ou_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'%", "s", ",%", "d", ",%", "d", "'_", "%_", "(_", "org_", ",_", "active_", ",_", "suspended", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "report", "\\u", "utils_", "._", "BORDER", "_", "\\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_", "Write", "Org", "Counts_", "(_", "orgs", "\\u", "by", "\\u", "active_", ",_", "orgs", "\\u", "by", "\\u", "ou_", ",_", "flags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", " ", "org", " ", "count", "s", " ", "to", " ", "two", " ", "csv", " ", "files", " ", "for", " ", "late", "r", " ", "use", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "orgs", "\\u", "by", "\\u", "active", ":", " ", "List", " ", "of", " ", "tuple", "s", " ", "(", "#", "active", ",", " ", "#", "suspended", ",", " ", "org", ")", " ", "order", " ", "by", " ", "#", "active", ".", "\\", "10", ";", " ", " ", " ", " ", "orgs", "\\u", "by", "\\u", "ou", ":", " ", "List", " ", "of", " ", "tuple", "s", " ", "(", "org", ",", " ", "#", "active", ",", " ", "#", "suspended", ")", " ", "order", "ed", " ", "by", " ", "ou", ".", "\\", "10", ";", " ", " ", " ", " ", "flags", ":", " ", "Arg", "parse", " ", "flags", " ", "object", " ", "with", " ", "apps", "\\u", "domain", ",", " ", "resum", "e", " ", "and", " ", "first", "\\u", "n", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename", "\\u", "path_", "=_", "FILE", "\\u", "MANAGER", "_", "._", "Write", "CSV", "File_", "(_", "\\u", "REPORT", "\\u", "ORG", "S", "\\u", "BY", "\\u", "ACTI", "VE", "\\u", "FILE", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "orgs", "\\u", "by", "\\u", "active_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "REPORT", "\\u", "BY", "\\u", "ACTI", "VE", "\\u", "HEADER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "overwrit", "e\\u", "ok_", "=_", "flags_", "._", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Wro", "te", " ", "report", " ", "of", " ", "org", " ", "users", " ", "sorte", "d", " ", "by", " ", "active", " ", "user", " ", "count", ":", " ", "%", "s", ".'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filename", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename", "\\u", "path_", "=_", "FILE", "\\u", "MANAGER", "_", "._", "Write", "CSV", "File_", "(_", "\\u", "REPORT", "\\u", "ORG", "S", "\\u", "BY", "\\u", "OU", "\\u", "FILE", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "orgs", "\\u", "by", "\\u", "ou_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "REPORT", "\\u", "BY", "\\u", "ORG", "\\u", "HEADER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "overwrit", "e\\u", "ok_", "=_", "flags_", "._", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Wro", "te", " ", "report", " ", "of", " ", "org", " ", "users", " ", "sorte", "d", " ", "by", " ", "org", "-", "unt", " ", "count", ":", " ", "%", "s", ".'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filename", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "admin", "\\u", "api", "\\u", "tool", "\\u", "errors_", "._", "Admi", "n", "API", "Tool", "File", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "\\u", "utils_", "._", "Log", "Error_", "(_", "'", "CSV", " ", "file", "(", "s", ")", " ", "alr", "ead", "y", " ", "exist", ".", " ", "Us", "e", " ", "--", "force", " ", "to", " ", "overwrit", "e", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\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_", "Add", "Flags_", "(_", "arg", "\\u", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", " ", "command", " ", "line", " ", "flags", " ", "unique", " ", "to", " ", "this", " ", "script", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "arg", "\\u", "parser", ":", " ", "object", " ", "from", " ", "argp", "arse", ".", "Arg", "ument", "Parser", "()", " ", "to", " ", "accumulate", " ", "flags", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "flags_", "._", "Define", "App", "s", "Doma", "in", "Fla", "g", "With", "Default_", "(_", "arg", "\\u", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "flags_", "._", "Define", "Force", "Fla", "g", "With", "Default", "False_", "(_", "arg", "\\u", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common", "\\u", "flags_", "._", "Define", "Verbos", "e", "Fla", "g", "With", "Default", "False_", "(_", "arg", "\\u", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arg", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "csv", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Output", " ", "results", " ", "to", " ", "a", " ", "csv", " ", "file", ".'_", ")_", "\\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_", "main_", "(_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "report", "\\u", "users", ",", " ", "parse", " ", "and", " ", "print", " ", "a", " ", "summar", "y", " ", "of", " ", "its", " ", "results", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "common", "\\u", "flags_", "._", "Pars", "e", "Flags_", "(_", "argv_", ",_", "'", "Creat", "e", " ", "a", " ", "report", " ", "of", " ", "org", " ", "count", "s", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Add", "Flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flags_", "._", "csv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "FILE", "\\u", "MANAGER", "_", "._", "Exi", "t", "If", "Cann", "ot", "Over", "write", "File_", "(_", "\\u", "REPORT", "\\u", "ORG", "S", "\\u", "BY", "\\u", "ACTI", "VE", "\\u", "FILE", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "overwrit", "e\\u", "ok_", "=_", "flags_", "._", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FILE", "\\u", "MANAGER", "_", "._", "Exi", "t", "If", "Cann", "ot", "Over", "write", "File_", "(_", "\\u", "REPORT", "\\u", "ORG", "S", "\\u", "BY", "\\u", "OU", "\\u", "FILE", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "overwrit", "e\\u", "ok_", "=_", "flags_", "._", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Generate", "User", "Report_", "(_", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orgs", "\\u", "by", "\\u", "active_", ",_", "orgs", "\\u", "by", "\\u", "ou_", "=_", "Summari", "ze", "User", "Org", "Report_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Print", "Org", "Counts_", "(_", "orgs", "\\u", "by", "\\u", "active_", ",_", "orgs", "\\u", "by", "\\u", "ou_", ")_", "\\u\\u\\uNEWLINE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Deprecated slice method
GrahamDumpleton/wrapt/src/wrapt/wrappers.py
[ { "content": " def __getslice__(self, i, j):\n return self.__wrapped__[i:j]", "metadata": "root.ObjectProxy.__getslice__", "header": "['class', 'ObjectProxy', '(', 'with_metaclass', '(', '_ObjectProxyMetaType', ')', ')', ':', '___EOS___']", "index": 394 }, { "content": " def __setslice__(self, i, j, value):\n self.__wrapped__[i:j] = value", "metadata": "root.ObjectProxy.__setslice__", "header": "['class', 'ObjectProxy', '(', 'with_metaclass', '(', '_ObjectProxyMetaType', ')', ')', ':', '___EOS___']", "index": 397 }, { "content": " def __delslice__(self, i, j):\n del self.__wrapped__[i:j]", "metadata": "root.ObjectProxy.__delslice__", "header": "['class', 'ObjectProxy', '(', 'with_metaclass', '(', '_ObjectProxyMetaType', ')', ')', ':', '___EOS___']", "index": 400 } ]
[ { "span": "def __getslice__(self, i, j):", "start_line": 394, "start_column": 4, "end_line": 394, "end_column": 33 }, { "span": "def __setslice__(self, i, j, value):", "start_line": 397, "start_column": 4, "end_line": 397, "end_column": 40 }, { "span": "def __delslice__(self, i, j):", "start_line": 400, "start_column": 4, "end_line": 400, "end_column": 33 } ]
[]
1
true
[ "[CLS]_", "Dep", "reca", "ted_", "slice_", "method_", "[SEP]_", "class_", "Object", "Proxy_", "(_", "with", "\\u", "metaclass_", "(_", "\\u", "Object", "Pro", "xy", "Meta", "Type_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "gets", "lice", "\\u\\u_", "(_", "self_", ",_", "i_", ",_", "j_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "wrapp", "ed", "\\u\\u_", "[_", "i_", ":_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Object", "Proxy_", "(_", "with", "\\u", "metaclass_", "(_", "\\u", "Object", "Pro", "xy", "Meta", "Type_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "sets", "lice", "\\u\\u_", "(_", "self_", ",_", "i_", ",_", "j_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "wrapp", "ed", "\\u\\u_", "[_", "i_", ":_", "j_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Object", "Proxy_", "(_", "with", "\\u", "metaclass_", "(_", "\\u", "Object", "Pro", "xy", "Meta", "Type_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "dels", "lice", "\\u\\u_", "(_", "self_", ",_", "i_", ",_", "j_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u\\u", "wrapp", "ed", "\\u\\u_", "[_", "i_", ":_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 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, 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, 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, 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, 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 ]
Unreachable code
ufora/ufora/ufora/FORA/python/PurePython/InMemoryExecutorTestCases.py
[ { "content": " def test_slicing_operations_1(self):\n a = \"testing\"\n l = len(a)\n with self.create_executor() as fora:\n results = []\n def f(idx1, idx2):\n try:\n return (\"OK\", a[idx1:idx2])\n except:\n return \"FAIL\"\n\n for idx1 in range(-l - 1, l + 1):\n for idx2 in range(-l - 1, l + 1):\n results = results + [f(idx1, idx2)]\n\n return results\n\n self.equivalentEvaluationTest(f)", "metadata": "root.InMemoryExecutorTestCases.test_slicing_operations_1", "header": "['class', 'InMemoryExecutorTestCases', '(', 'ExecutorTestCases', '.', 'ExecutorTestCases', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_tuple_getitem_exhaustive_1(self):\n sz = 3\n def f():\n x = tuple(range(sz))\n def tryGetItem(ix):\n try:\n return (\"OK\", x[ix])\n except Exception as e:\n return \"except\"\n\n if isinstance(e, ValueError):\n return \"ValueError\"\n elif isinstance(e, IndexError):\n return \"IndexError\"\n elif isinstance(e, TypeError):\n return \"TypeError\"\n raise e\n\n indices = range(-sz, sz) + [sz - 10, sz + 10, 1.0, None]\n\n res = []\n for ix in indices:\n res = res + [tryGetItem(ix)]\n\n return res\n\n self.equivalentEvaluationTest(f)", "metadata": "root.InMemoryExecutorTestCases.test_tuple_getitem_exhaustive_1", "header": "['class', 'InMemoryExecutorTestCases', '(', 'ExecutorTestCases', '.', 'ExecutorTestCases', ')', ':', '___EOS___']", "index": 427 } ]
[ { "span": "self.equivalentEvaluationTest(f)", "start_line": 237, "start_column": 8, "end_line": 237, "end_column": 40 }, { "span": "if isinstance(e, ValueError):", "start_line": 437, "start_column": 20, "end_line": 437, "end_column": 49 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "In", "Memo", "ry", "Execut", "or", "Test", "Cases_", "(_", "Execut", "or", "Test", "Cases_", "._", "Execut", "or", "Test", "Cases_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "slicing", "\\u", "operati", "ons", "\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "\"", "testi", "ng", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "len_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "create", "\\u", "executor_", "(_", ")_", "as_", "fora", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "f_", "(_", "idx1_", ",_", "idx2_", ")_", ":_", "\\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_", "(_", "\"", "OK", "\"_", ",_", "a_", "[_", "idx1_", ":_", "idx2_", "]_", ")_", "\\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_", "\"", "FAIL", "\"_", "\\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_", "idx1_", "in_", "range_", "(_", "-_", "l_", "-_", "1_", ",_", "l_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "idx2_", "in_", "range_", "(_", "-_", "l_", "-_", "1_", ",_", "l_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "=_", "results_", "+_", "[_", "f_", "(_", "idx1_", ",_", "idx2_", ")_", "]_", "\\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_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "equivalent", "Evaluati", "on", "Test_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "Memo", "ry", "Execut", "or", "Test", "Cases_", "(_", "Execut", "or", "Test", "Cases_", "._", "Execut", "or", "Test", "Cases_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tuple", "\\u", "getitem", "\\u", "exhaust", "ive", "\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sz_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "f_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "tuple_", "(_", "range_", "(_", "sz_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "try", "Get", "Item_", "(_", "ix_", ")_", ":_", "\\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_", "(_", "\"", "OK", "\"_", ",_", "x_", "[_", "ix_", "]_", ")_", "\\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 ", " ", "_", "return_", "\"", "except", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "e_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\"", "Value", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "e_", ",_", "Index", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\"", "Index", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "e_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\"", "Type", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "indices_", "=_", "range_", "(_", "-_", "sz_", ",_", "sz_", ")_", "+_", "[_", "sz_", "-_", "10_", ",_", "sz_", "+_", "10_", ",_", "1.0_", ",_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ix_", "in_", "indices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "res_", "+_", "[_", "try", "Get", "Item_", "(_", "ix_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "equivalent", "Evaluati", "on", "Test_", "(_", "f_", ")_", "\\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, 0, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
peterjc/backports.lzma/setup.py
[ { "content": "#!/usr/bin/python -u\n#\n# Python Bindings for XZ/LZMA backported from Python 3.3.0\n#\n# This file copyright (c) 2012 Peter Cock, p.j.a.cock@googlemail.com\n# See other files for separate copyright notices.\n\nimport sys, os\nfrom warnings import warn\n\nfrom distutils import log\nfrom distutils.command.build_ext import build_ext\nfrom distutils.core import setup\nfrom distutils.extension import Extension\n\n# We now extract the version number in backports/lzma/__init__.py\n# We can't use \"from backports import lzma\" then \"lzma.__version__\"\n# as that would tell us the version already installed (if any).\n__version__ = None\nwith open('backports/lzma/__init__.py') as handle:\n for line in handle:\n if (line.startswith('__version__')):\n exec(line.strip())\n break\nif __version__ is None:\n sys.stderr.write(\"Error getting __version__ from backports/lzma/__init__.py\\n\")\n sys.exit(1)\nprint(\"This is backports.lzma version %s\" % __version__)\n\npackages = [\"backports\", \"backports.lzma\"]\nhome = os.path.expanduser(\"~\")\nextens = [Extension('backports/lzma/_lzma',\n ['backports/lzma/_lzmamodule.c'],\n libraries = ['lzma'],\n include_dirs = [os.path.join(home, 'include'), '/opt/local/include', '/usr/local/include'],\n library_dirs = [os.path.join(home, 'lib'), '/opt/local/lib', '/usr/local/lib']\n )]\n\ndescr = \"Backport of Python 3.3's 'lzma' module for XZ/LZMA compressed files.\"\nlong_descr = \"\"\"This is a backport of the 'lzma' module included in Python 3.3 or later\nby Nadeem Vawda and Per Oyvind Karlsen, which provides a Python wrapper for XZ Utils\n(aka LZMA Utils v2) by Igor Pavlov.\n\nIn order to compile this, you will need to install XZ Utils from http://tukaani.org/xz/\n\"\"\"\n\nif sys.version_info < (2,6):\n sys.stderr.write(\"ERROR: Python 2.5 and older are not supported, and probably never will be.\\n\")\n sys.exit(1)\n\nsetup(\n name = \"backports.lzma\",\n version = __version__,\n description = descr,\n author = \"Peter Cock, based on work by Nadeem Vawda and Per Oyvind Karlsen\",\n author_email = \"p.j.a.cock@googlemail.com\",\n url = \"https://github.com/peterjc/backports.lzma\",\n license='3-clause BSD License',\n keywords = \"xz lzma compression decompression\",\n long_description = long_descr,\n classifiers = [\n 'Development Status :: 5 - Production/Stable',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2.6',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3',\n 'Topic :: Software Development :: Libraries :: Python Modules',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: BSD License',\n #'Operating System :: OS Independent',\n 'Topic :: System :: Archiving :: Compression',\n ],\n packages = packages,\n namespace_packages = ['backports'],\n ext_modules = extens,\n cmdclass = {\n 'build_ext': build_ext,\n },\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from warnings import warn", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 25 }, { "span": "from distutils import log", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python", " ", "-", "u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "Bindings", " ", "for", " ", "XZ", "/", "LZ", "MA", " ", "backp", "orte", "d", " ", "from", " ", "Pyth", "on", " ", "3.3", ".0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "copyr", "ight", " ", "(", "c", ")", " ", "2012", " ", "Peter", " ", "Coc", "k", ",", " ", "p", ".", "j", ".", "a", ".", "coc", "k", "@", "google", "mail", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "other", " ", "files", " ", "for", " ", "separate", " ", "copyr", "ight", " ", "notice", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "warnings_", "import_", "warn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "distutils_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "command_", "._", "build", "\\u", "ext_", "import_", "build", "\\u", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "core_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "extension_", "import_", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "now", " ", "extract", " ", "the", " ", "version", " ", "number", " ", "in", " ", "backp", "orts", "/", "lzm", "a", "/\\u", "\\u", "init", "\\u\\u", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "use", " ", "\"", "from", " ", "backp", "orts", " ", "import", " ", "lzm", "a", "\"", " ", "then", " ", "\"", "lzm", "a", ".\\u", "\\u", "version", "\\u\\u\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "tha", "t", " ", "wou", "ld", " ", "tell", " ", "us", " ", "the", " ", "version", " ", "alr", "ead", "y", " ", "install", "ed", " ", "(", "if", " ", "any", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "'", "backp", "orts", "/", "lzm", "a", "/\\u", "\\u", "init", "\\u\\u", ".", "py", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "line_", "._", "startswith_", "(_", "'\\u", "\\u", "version", "\\u\\u'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "line_", "._", "strip_", "(_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "version\\u\\u_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Error", " ", "getti", "ng", " ", "\\u\\u", "version", "\\u\\u", " ", "from", " ", "backp", "orts", "/", "lzm", "a", "/\\u", "\\u", "init", "\\u\\u", ".", "py", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Thi", "s", " ", "is", " ", "backp", "orts", ".", "lzm", "a", " ", "version", " ", "%", "s", "\"_", "%_", "\\u\\u", "version\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "\"", "backp", "orts", "\"_", ",_", "\"", "backp", "orts", ".", "lzm", "a", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "\"~\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext", "ens_", "=_", "[_", "Extension_", "(_", "'", "backp", "orts", "/", "lzm", "a", "/\\u", "lzm", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "backp", "orts", "/", "lzm", "a", "/\\u", "lzm", "amo", "dul", "e", ".", "c", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "libraries_", "=_", "[_", "'", "lzm", "a", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "dirs_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "home_", ",_", "'", "include", "'_", ")_", ",_", "'/", "opt", "/", "local", "/", "include", "'_", ",_", "'/", "usr", "/", "local", "/", "include", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "librar", "y", "\\u", "dirs_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "home_", ",_", "'", "lib", "'_", ")_", ",_", "'/", "opt", "/", "local", "/", "lib", "'_", ",_", "'/", "usr", "/", "local", "/", "lib", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "descr_", "=_", "\"", "Back", "port", " ", "of", " ", "Pyth", "on", " ", "3.3", "'", "s", " ", "'", "lzm", "a", "'", " ", "module", " ", "for", " ", "XZ", "/", "LZ", "MA", " ", "compress", "ed", " ", "files", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "\\u", "descr_", "=_", "\"\"\"", "Thi", "s", " ", "is", " ", "a", " ", "backp", "ort", " ", "of", " ", "the", " ", "'", "lzm", "a", "'", " ", "module", " ", "include", "d", " ", "in", " ", "Pyth", "on", " ", "3.3", " ", "or", " ", "late", "r", "\\", "10", ";", "by", " ", "Na", "dee", "m", " ", "Va", "wda", " ", "and", " ", "Per", " ", "O", "yv", "ind", " ", "Kar", "lse", "n", ",", " ", "whi", "ch", " ", "provide", "s", " ", "a", " ", "Pyth", "on", " ", "wrapp", "er", " ", "for", " ", "XZ", " ", "Ut", "il", "s", "\\", "10", ";", "(", "aka", " ", "LZ", "MA", " ", "Ut", "il", "s", " ", "v2", ")", " ", "by", " ", "Ig", "or", " ", "Pa", "vlo", "v", ".", "\\", "10", ";", "\\", "10", ";", "In", " ", "order", " ", "to", " ", "compile", " ", "this", ",", " ", "you", " ", "will", " ", "need", " ", "to", " ", "install", " ", "XZ", " ", "Ut", "il", "s", " ", "from", " ", "http", "://", "tu", "ka", "ani", ".", "org", "/", "xz", "/", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "2_", ",_", "6_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "ERROR", ":", " ", "Pyth", "on", " ", "2.5", " ", "and", " ", "older", " ", "are", " ", "not", " ", "support", "ed", ",", " ", "and", " ", "probab", "ly", " ", "neve", "r", " ", "will", " ", "be", ".\\\\", "n", "\"_", ")_", "\\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_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "backp", "orts", ".", "lzm", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "descr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "\"", "Peter", " ", "Coc", "k", ",", " ", "based", " ", "on", " ", "work", " ", "by", " ", "Na", "dee", "m", " ", "Va", "wda", " ", "and", " ", "Per", " ", "O", "yv", "ind", " ", "Kar", "lse", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "\"", "p", ".", "j", ".", "a", ".", "coc", "k", "@", "google", "mail", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "https", "://", "git", "hub", ".", "com", "/", "pet", "er", "jc", "/", "backp", "orts", ".", "lzm", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "3", "-", "clause", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "\"", "xz", " ", "lzm", "a", " ", "compress", "ion", " ", "decompress", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "long", "\\u", "descr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "5", " ", "-", " ", "Product", "ion", "/", "Sta", "ble", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Libr", "aries", " ", "::", " ", "Pyth", "on", " ", "Modul", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "System", " ", "::", " ", "Archi", "ving", " ", "::", " ", "Compress", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "packages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespace", "\\u", "packages_", "=_", "[_", "'", "backp", "orts", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ext", "\\u", "modules_", "=_", "ext", "ens_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmdclass_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "build", "\\u", "ext", "'_", ":_", "build", "\\u", "ext_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
apache/libcloud/libcloud/test/loadbalancer/test_gogrid.py
[ { "content": " def test_list_supported_algorithms(self):\n algorithms = self.driver.list_supported_algorithms()\n\n self.assertTrue(Algorithm.ROUND_ROBIN in algorithms)\n self.assertTrue(Algorithm.LEAST_CONNECTIONS in algorithms)", "metadata": "root.GoGridTests.test_list_supported_algorithms", "header": "['class', 'GoGridTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_create_balancer_UNEXPECTED_ERROR(self):\n # Try to create new balancer and attach members with an IP address which\n # does not belong to this account\n GoGridLBMockHttp.type = 'UNEXPECTED_ERROR'\n\n try:\n self.driver.create_balancer(name='test2',\n port=80,\n protocol='http',\n algorithm=Algorithm.ROUND_ROBIN,\n members=(Member(None, '10.1.0.10', 80),\n Member(None, '10.1.0.11', 80))\n )\n except LibcloudError:\n e = sys.exc_info()[1]\n self.assertTrue(\n str(e).find('tried to add a member with an IP address not assigned to your account') != -1)\n else:\n self.fail('Exception was not thrown')", "metadata": "root.GoGridTests.test_create_balancer_UNEXPECTED_ERROR", "header": "['class', 'GoGridTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 74 }, { "content": " def _api_grid_loadbalancer_add(self, method, url, body, headers):\n query = urlparse.urlparse(url).query\n self.assertTrue(query.find('loadbalancer.type=round+robin') != -1)\n\n body = self.fixtures.load('loadbalancer_add.json')\n return (httplib.OK, body, {}, httplib.responses[httplib.OK])", "metadata": "root.GoGridLBMockHttp._api_grid_loadbalancer_add", "header": "['class', 'GoGridLBMockHttp', '(', 'MockHttpTestCase', ')', ':', '___EOS___']", "index": 168 } ]
[ { "span": "self.assertTrue(Algorithm.ROUND_ROBIN in algorithms)", "start_line": 42, "start_column": 8, "end_line": 42, "end_column": 60 }, { "span": "self.assertTrue(Algorithm.LEAST_CONNECTIONS in algorithms)", "start_line": 43, "start_column": 8, "end_line": 43, "end_column": 66 }, { "span": "self.assertTrue(\n str(e).find('tried to add a member with an IP address not assigned to your account') != -1)", "start_line": 89, "start_column": 12, "end_line": 90, "end_column": 107 }, { "span": "self.assertTrue(query.find('loadbalancer.type=round+robin') != -1)", "start_line": 170, "start_column": 8, "end_line": 170, "end_column": 74 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Go", "Grid", "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", "list", "\\u", "support", "ed", "\\u", "algorithms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algorithms_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "support", "ed", "\\u", "algorithms_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Algorithm_", "._", "ROUND", "\\u", "ROB", "IN_", "in_", "algorithms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Algorithm_", "._", "LEA", "ST", "\\u", "CONNECTION", "S_", "in_", "algorithms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Go", "Grid", "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", "create", "\\u", "balancer", "\\u", "UNE", "XP", "ECTED", "\\u", "ERROR_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "create", " ", "new", " ", "balancer", " ", "and", " ", "attach", " ", "member", "s", " ", "with", " ", "an", " ", "IP", " ", "address", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "s", " ", "not", " ", "belo", "ng", " ", "to", " ", "this", " ", "account_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Go", "Grid", "LB", "Moc", "k", "Http_", "._", "type_", "=_", "'", "UNE", "XP", "ECTED", "\\u", "ERROR", "'_", "\\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_", "._", "driver_", "._", "create", "\\u", "balancer", "_", "(_", "name_", "=_", "'", "test", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "80_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protocol_", "=_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "algorithm_", "=_", "Algorithm_", "._", "ROUND", "\\u", "ROB", "IN_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "members_", "=_", "(_", "Member_", "(_", "None_", ",_", "'", "10.1", ".0", ".1", "0", "'_", ",_", "80_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Member_", "(_", "None_", ",_", "'", "10.1", ".0", ".1", "1", "'_", ",_", "80_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Lib", "cloud", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "e_", ")_", "._", "find_", "(_", "'", "trie", "d", " ", "to", " ", "add", " ", "a", " ", "member", " ", "with", " ", "an", " ", "IP", " ", "address", " ", "not", " ", "assign", "ed", " ", "to", " ", "your", " ", "account", "'_", ")_", "!=_", "-_", "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 ", " _", "self_", "._", "fail_", "(_", "'", "Except", "ion", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Go", "Grid", "LB", "Moc", "k", "Http_", "(_", "Moc", "k", "Http", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "api", "\\u", "grid", "\\u", "loadbalancer", "\\u", "add_", "(_", "self_", ",_", "method_", ",_", "url_", ",_", "body_", ",_", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "._", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "query_", "._", "find_", "(_", "'", "loadbalancer", ".", "type", "=", "round", "+", "robi", "n", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "self_", "._", "fixtures_", "._", "load_", "(_", "'", "loadbalancer", "\\u", "add", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "httplib_", "._", "OK_", ",_", "body_", ",_", "{_", "}_", ",_", "httplib_", "._", "responses_", "[_", "httplib_", "._", "OK_", "]_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
baskoopmans/djcommon/djcommon/templatetags/common.py
[ { "content": "# encoding: utf-8\n\nimport re\nimport urllib\n\nfrom django import template\nfrom django.template.defaultfilters import stringfilter\nfrom django.template import Template, Variable, TemplateSyntaxError\nfrom django.http import HttpResponse\nfrom django.db.models.query import QuerySet\n\nfrom django.template.loader_tags import BlockNode, ExtendsNode\nfrom django.template import loader, Context, RequestContext, TextNode\n\nfrom djcommon.helpers import random_slice_list\n\nregister = template.Library()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ncleartags.is_safe = True\n\n\ncut.is_safe = True\n\nreplace.is_safe = True\n\nnowhitespace.is_safe = True\n\ncleanwhitespace.is_safe = True\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def render_block_to_string(template_name, block, dictionary=None, context_instance=None):\n \"\"\"\n Loads the given template_name and renders the given block with the given dictionary as\n context. Returns a string.\n \"\"\"\n import re\n\n dictionary = dictionary or {}\n t = get_template(template_name)\n if context_instance:\n context_instance.update(dictionary)\n else:\n context_instance = Context(dictionary)\n template_block = render_template_block(t, block, context_instance)\n return re.sub(r'\\s+', ' ', template_block)", "metadata": "root.render_block_to_string", "header": "['module', '___EOS___']", "index": 51 } ]
[ { "span": "import re", "start_line": 56, "start_column": 4, "end_line": 56, "end_column": 13 } ]
[ { "span": "import re", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "default", "filters_", "import_", "string", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Template_", ",_", "Variable_", ",_", "Templa", "te", "Syntax", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "query_", "import_", "Query", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "load", "er", "\\u", "tags_", "import_", "Block", "Node_", ",_", "Extend", "s", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "loader_", ",_", "Context_", ",_", "Request", "Context_", ",_", "Text", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dj", "common_", "._", "helpers_", "import_", "random", "\\u", "slice", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register_", "=_", "template_", "._", "Library_", "(_", ")_", "\\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\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clear", "tags_", "._", "is", "\\u", "safe_", "=_", "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\\uDEDENT\\u\\u\\u_", "cut_", "._", "is", "\\u", "safe_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "replace_", "._", "is", "\\u", "safe_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "now", "hit", "espa", "ce_", "._", "is", "\\u", "safe_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clean", "whitespace_", "._", "is", "\\u", "safe_", "=_", "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\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "block", "\\u", "to", "\\u", "string_", "(_", "template", "\\u", "name_", ",_", "block_", ",_", "dictionary_", "=_", "None_", ",_", "context", "\\u", "instance_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", "s", " ", "the", " ", "give", "n", " ", "template", "\\u", "name", " ", "and", " ", "render", "s", " ", "the", " ", "give", "n", " ", "block", " ", "with", " ", "the", " ", "give", "n", " ", "dictionar", "y", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "context", ".", " ", "Return", "s", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dictionary_", "=_", "dictionary_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "get", "\\u", "template_", "(_", "template", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context", "\\u", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "\\u", "instance_", "._", "update_", "(_", "dictionary_", ")_", "\\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 ", " _", "context", "\\u", "instance_", "=_", "Context_", "(_", "dictionary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "template", "\\u", "block_", "=_", "render", "\\u", "template", "\\u", "block_", "(_", "t_", ",_", "block_", ",_", "context", "\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "re_", "._", "sub_", "(_", "r", "'\\\\", "s", "+'_", ",_", "'", " ", "'_", ",_", "template", "\\u", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused import
simpeg/simpeg/SimPEG/Inversion.py
[ { "content": "import SimPEG\nfrom SimPEG import Utils, sp, np\nfrom Optimization import Remember, IterationPrinters, StoppingCriteria\nimport Directives\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseInversion(object):\n \"\"\"\n\n Inversion Class.\n\n \"\"\"\n\n __metaclass__ = Utils.SimPEGMetaClass\n\n name = 'BaseInversion'\n\n debug = False #: Print debugging information\n\n counter = None #: Set this to a SimPEG.Utils.Counter() if you want to count things\n\n\n\n\n", "metadata": "root.BaseInversion", "header": "['module', '___EOS___']", "index": 6 }, { "content": " @property\n def directiveList(self):\n if getattr(self,'_directiveList', None) is None:\n self._directiveList = Directives.DirectiveList(inversion=self)\n return self._directiveList", "metadata": "root.BaseInversion.directiveList", "header": "['class', 'BaseInversion', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": " @directiveList.setter\n def directiveList(self, value):\n if type(value) is list:\n value = Directives.DirectiveList(*value)\n assert isinstance(value, Directives.DirectiveList), 'Must be a DirectiveList'\n self._directiveList = value\n self._directiveList.inversion = self", "metadata": "root.BaseInversion.directiveList", "header": "['class', 'BaseInversion', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": " def __init__(self, invProb, directiveList=[], **kwargs):\n self.directiveList = directiveList\n Utils.setKwargs(self, **kwargs)\n\n self.invProb = invProb\n\n self.opt = invProb.opt\n self.opt.callback = self._optCallback\n\n self.stoppers = [StoppingCriteria.iteration]\n\n # Check if we have inserted printers into the optimization\n if IterationPrinters.phi_d not in self.opt.printers:\n self.opt.printers.insert(1,IterationPrinters.beta)\n self.opt.printers.insert(2,IterationPrinters.phi_d)\n self.opt.printers.insert(3,IterationPrinters.phi_m)", "metadata": "root.BaseInversion.__init__", "header": "['class', 'BaseInversion', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " @Utils.timeIt\n def run(self, m0):\n \"\"\"run(m0)\n\n Runs the inversion!\n\n \"\"\"\n self.invProb.startup(m0)\n self.directiveList.call('initialize')\n self.m = self.opt.minimize(self.invProb.evalFunction, self.invProb.curModel)\n self.directiveList.call('finish')\n\n return self.m", "metadata": "root.BaseInversion.run", "header": "['class', 'BaseInversion', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " def _optCallback(self, xt):\n self.directiveList.call('endIter')", "metadata": "root.BaseInversion._optCallback", "header": "['class', 'BaseInversion', '(', 'object', ')', ':', '___EOS___']", "index": 66 } ]
[ { "span": "import SimPEG", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 13 }, { "span": "from SimPEG import Utils, sp, np", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 32 }, { "span": "from Optimization import Remember, IterationPrinters, StoppingCriteria", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 70 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "Sim", "PE", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Sim", "PE", "G_", "import_", "Utils_", ",_", "sp_", ",_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Optim", "ization_", "import_", "Reme", "mber", "_", ",_", "Iterat", "ion", "Print", "ers_", ",_", "Stopp", "ing", "Criteria", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Directive", "s_", "\\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_", "Base", "Inv", "ersion_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Inv", "ersi", "on", " ", "Class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "metaclass\\u\\u_", "=_", "Utils_", "._", "Sim", "PE", "GM", "eta", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Base", "Inv", "ersi", "on", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "False_", "#", ":", " ", "Print", " ", "debugg", "ing", " ", "information_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "counter_", "=_", "None_", "#", ":", " ", "Set", " ", "this", " ", "to", " ", "a", " ", "Sim", "PE", "G", ".", "Ut", "il", "s", ".", "Counter", "()", " ", "if", " ", "you", " ", "want", " ", "to", " ", "count", " ", "things_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Inv", "ersion_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "directive", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getattr_", "(_", "self_", ",_", "'\\u", "directive", "List", "'_", ",_", "None_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "directive", "List_", "=_", "Directive", "s_", "._", "Directive", "List_", "(_", "inversion", "_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "directive", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Inv", "ersion_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "directive", "List_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "directive", "List_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "value_", ")_", "is_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Directive", "s_", "._", "Directive", "List_", "(_", "*_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "isinstance_", "(_", "value_", ",_", "Directive", "s_", "._", "Directive", "List_", ")_", ",_", "'", "Mus", "t", " ", "be", " ", "a", " ", "Directive", "List", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "directive", "List_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "directive", "List_", "._", "inversion", "_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Inv", "ersion_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "inv", "Prob_", ",_", "directive", "List_", "=_", "[_", "]_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "directive", "List_", "=_", "directive", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Utils_", "._", "set", "Kwargs", "_", "(_", "self_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "inv", "Prob_", "=_", "inv", "Prob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "opt_", "=_", "inv", "Prob_", "._", "opt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "opt_", "._", "callback_", "=_", "self_", "._", "\\u", "opt", "Callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stopp", "ers_", "=_", "[_", "Stopp", "ing", "Criteria", "_", "._", "iteration_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "we", " ", "have", " ", "inserted", " ", "printer", "s", " ", "int", "o", " ", "the", " ", "optimization", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "Iterat", "ion", "Print", "ers_", "._", "phi", "\\u", "d_", "not_", "in_", "self_", "._", "opt_", "._", "printer", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "opt_", "._", "printer", "s_", "._", "insert_", "(_", "1_", ",_", "Iterat", "ion", "Print", "ers_", "._", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "opt_", "._", "printer", "s_", "._", "insert_", "(_", "2_", ",_", "Iterat", "ion", "Print", "ers_", "._", "phi", "\\u", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "opt_", "._", "printer", "s_", "._", "insert_", "(_", "3_", ",_", "Iterat", "ion", "Print", "ers_", "._", "phi", "\\u", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Inv", "ersion_", "(_", "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_", "@_", "Utils_", "._", "time", "It_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "m0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "run", "(", "m", "0", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "the", " ", "inversion", "!", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "inv", "Prob_", "._", "startup_", "(_", "m0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "directive", "List_", "._", "call_", "(_", "'", "initialize", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "m_", "=_", "self_", "._", "opt_", "._", "minimize_", "(_", "self_", "._", "inv", "Prob_", "._", "eval", "Function_", ",_", "self_", "._", "inv", "Prob_", "._", "cur", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "directive", "List_", "._", "call_", "(_", "'", "finish", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Inv", "ersion_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "opt", "Callback_", "(_", "self_", ",_", "xt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "directive", "List_", "._", "call_", "(_", "'", "end", "It", "er", "'_", ")_" ]
[ 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
bolme/pyvision/src/pyvision/analysis/bee.py
[ { "content": " def loadFile(self,filename,sigset_dir=None):\n '''\n Loads a BEE matrix from a file.\n '''\n self.filename = filename\n self.shortname = os.path.basename(filename)\n \n # open the file for reading\n f = open(filename,'rb')\n \n #read the distance matrix header (first four lines of the file)\n \n line = f.readline()\n # Test line endings\n if len(line) != 3 or line[-1] != \"\\x0a\":\n # Note: \\x0a is the \"official\" line ending char as of \n # \\x0d is also supported in the Java and C++ tools but it will cause a failure in this implementation.\n # see IARPA BEST - Challenge Problem Specification and Executable Application Program Interface\n # thanks to Todd Scruggs\n raise ValueError(\"Unsupported line ending. Should two characters followed by LF (0x0A).\")\n # Check Format\n line = line.strip()\n if line not in ['D2','S2','M2']:\n raise ValueError('Unknown matrix Format \"%s\". Should be D2, S2, or M2.'%line)\n \n self.is_distance = True\n if line[0][0] == 'S':\n self.is_distance = False\n\n # read and process line 2 (target sigset)\n line = f.readline().split()\n self.target_filename = os.path.basename(line[0])\n\n # read and process line 3 (query sigset)\n line = f.readline().split()\n self.query_filename = os.path.basename(line[0])\n\n # read and process line 4 (MF n_queries n_targets magic_number)\n line = f.readline().split()\n assert line[0] in ['MF','MB']\n file_type = line[0][1]\n \n self.n_queries = int(line[1])\n self.n_targets = int(line[2])\n \n big_endian = struct.pack(\">I\",0x12345678)\n little_endian = struct.pack(\"<I\",0x12345678)\n \n if line[3] != big_endian and line[3] != little_endian:\n print \"Warning unsupported magic number is BEE matrix: 0x%s\"%binascii.hexlify(line[3])\n \n self.magic_number = struct.unpack_from(\"=I\",line[3])[0]\n if self.magic_number == 0x12345678:\n byteswap = False\n elif self.magic_number == 0x78563412:\n byteswap = True\n else:\n raise ValueError(\"Unknown magic number in similarity matrix.\")\n \n # Read the matrix data\n if file_type=='F':\n self.matrix = np.fromfile(f,dtype=np.float32)\n elif file_type=='B':\n self.matrix = np.fromfile(f,dtype=np.byte)\n else:\n raise TypeError(\"Unknown matrix file_type: %s\"%file_type)\n \n if file_type=='F' and byteswap:\n self.matrix = self.matrix.byteswap()\n assert self.matrix.shape[0] == self.n_targets*self.n_queries\n self.matrix = self.matrix.reshape(self.n_queries,self.n_targets)\n \n # Try to read the sigsets.\n if sigset_dir == None:\n sigset_dir = os.path.dirname(self.filename)\n self.queries = None\n try:\n ss_name = os.path.join(sigset_dir,self.query_filename)\n self.queries = parseSigSet(ss_name)\n assert len(self.queries) == self.n_queries\n except:\n pass\n #print \"Warning: cound not read the query sigset for distance matrix %s\"%self.shortname\n #print \" SigSet File:\",ss_name\n #print \" Expected:\",self.n_queries,\"Read:\",len(self.queries)\n \n self.targets = None\n try:\n ss_name = os.path.join(sigset_dir,self.target_filename)\n self.targets = parseSigSet(ss_name)\n\n assert len(self.targets) == self.n_targets\n except:\n pass\n #print \"Warning: cound not read the target sigset for distance matrix %s\"%self.shortname\n #print \" SigSet File:\",ss_name\n #print \" Expected:\",self.n_targets,\"Read:\",len(self.targets)", "metadata": "root.BEEDistanceMatrix.loadFile", "header": "['class', 'BEEDistanceMatrix', ':', '___EOS___']", "index": 247 }, { "content": " def histogram(self,value_range=None,bins=100,normed=True,mask=None):\n match_scores = self.getMatchScores(mask=mask)\n nonmatch_scores = self.getNonMatchScores(mask=mask)\n if value_range == None:\n value_range = (self.matrix.min(),self.matrix.max())\n\n match_counts,_ = np.histogram(match_scores,range=value_range,bins=bins,normed=normed)\n nonmatch_counts,vals = np.histogram(nonmatch_scores,range=value_range,bins=bins,normed=normed)\n \n hist = pv.Table()\n for i in range(len(match_counts)):\n hist[i,'min'] = vals[i]\n hist[i,'center'] = 0.5*(vals[i]+vals[i+1])\n hist[i,'max'] = vals[i+1]\n hist[i,'match_count'] = match_counts[i]\n hist[i,'nonmatch_count'] = nonmatch_counts[i]\n return hist", "metadata": "root.BEEDistanceMatrix.histogram", "header": "['class', 'BEEDistanceMatrix', ':', '___EOS___']", "index": 568 } ]
[ { "span": "sigset_dir == None:", "start_line": 320, "start_column": 11, "end_line": 320, "end_column": 29 }, { "span": "value_range == None:", "start_line": 571, "start_column": 11, "end_line": 571, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "BE", "ED", "ista", "nce", "Matrix_", ":_", "\\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_", "load", "File_", "(_", "self_", ",_", "filename_", ",_", "sig", "set\\u", "dir_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Load", "s", " ", "a", " ", "BE", "E", " ", "matrix", " ", "from", " ", "a", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filename_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shortname_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "file", " ", "for", " ", "reading_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "filename_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "read", " ", "the", " ", "distance", " ", "matrix", " ", "header", " ", "(", "first", " ", "four", " ", "lines", " ", "of", " ", "the", " ", "file", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "f_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "line", " ", "ending", "s_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "line_", ")_", "!=_", "3_", "or_", "line_", "[_", "-_", "1_", "]_", "!=_", "\"\\\\", "x0", "a", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "\\\\", "x0", "a", " ", "is", " ", "the", " ", "\"", "official", "\"", " ", "line", " ", "ending", " ", "char", " ", "as", " ", "of", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\\\\", "x0", "d", " ", "is", " ", "als", "o", " ", "support", "ed", " ", "in", " ", "the", " ", "Ja", "va", " ", "and", " ", "C", "++", " ", "tool", "s", " ", "but", " ", "it", " ", "will", " ", "caus", "e", " ", "a", " ", "fail", "ure", " ", "in", " ", "this", " ", "implementation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "see", " ", "IA", "RPA", " ", "BES", "T", " ", "-", " ", "Chall", "enge", " ", "Prob", "lem", " ", "Specification", " ", "and", " ", "Executable", " ", "Applica", "tion", " ", "Program", " ", "Interface_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "thanks", " ", "to", " ", "To", "dd", " ", "Scr", "ugg", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Unsu", "ppo", "rted", " ", "line", " ", "ending", ".", " ", " ", "Sho", "ul", "d", " ", "two", " ", "character", "s", " ", "followe", "d", " ", "by", " ", "LF", " ", "(", "0x0", "A", ").\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "Format_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line_", "=_", "line_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "not_", "in_", "[_", "'", "D2", "'_", ",_", "'", "S2", "'_", ",_", "'", "M2", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Un", "know", "n", " ", "matrix", " ", "Format", " ", "\"%", "s", "\".", " ", " ", "Sho", "ul", "d", " ", "be", " ", "D2", ",", " ", "S2", ",", " ", "or", " ", "M2", ".'_", "%_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "is", "\\u", "distance_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "[_", "0_", "]_", "[_", "0_", "]_", "==_", "'", "S", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "is", "\\u", "distance_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "and", " ", "process", " ", "line", " ", "2", " ", "(", "target", " ", "sig", "set", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line_", "=_", "f_", "._", "readline_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "line_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "and", " ", "process", " ", "line", " ", "3", " ", "(", "query", " ", "sig", "set", ")_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "f_", "._", "readline_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "query", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "line_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "and", " ", "process", " ", "line", " ", "4", " ", "(", "MF", " ", "n", "\\u", "querie", "s", " ", "n", "\\u", "target", "s", " ", "magic", "\\u", "number", ")_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "f_", "._", "readline_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "line_", "[_", "0_", "]_", "in_", "[_", "'", "MF", "'_", ",_", "'", "MB", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "type_", "=_", "line_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "n", "\\u", "queries_", "=_", "int_", "(_", "line_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "n", "\\u", "targets_", "=_", "int_", "(_", "line_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "big", "\\u", "endian_", "=_", "struct_", "._", "pack_", "(_", "\">", "I", "\"_", ",_", "0x12", "3456", "78_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "litt", "le", "\\u", "endian_", "=_", "struct_", "._", "pack_", "(_", "\"<", "I", "\"_", ",_", "0x12", "3456", "78_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "line_", "[_", "3_", "]_", "!=_", "big", "\\u", "endian_", "and_", "line_", "[_", "3_", "]_", "!=_", "litt", "le", "\\u", "endian_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Warn", "ing", " ", "unsup", "porte", "d", " ", "magic", " ", "number", " ", "is", " ", "BE", "E", " ", "matrix", ":", " ", "0", "x", "%", "s", "\"_", "%_", "binascii_", "._", "hexlify_", "(_", "line_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "magic", "\\u", "number_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "\"=", "I", "\"_", ",_", "line_", "[_", "3_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "magic", "\\u", "number_", "==_", "0x12", "3456", "78_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes", "wap", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "magic", "\\u", "number_", "==_", "0x78", "563", "412", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes", "wap", "_", "=_", "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 ", " _", "raise_", "Value", "Error_", "(_", "\"", "Un", "know", "n", " ", "magic", " ", "number", " ", "in", " ", "similar", "it", "y", " ", "matrix", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "the", " ", "matrix", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "file", "\\u", "type_", "==_", "'", "F", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "matrix_", "=_", "np_", "._", "fromfile_", "(_", "f_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "file", "\\u", "type_", "==_", "'", "B", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "matrix_", "=_", "np_", "._", "fromfile_", "(_", "f_", ",_", "dtype_", "=_", "np_", "._", "byte_", ")_", "\\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_", "Type", "Error_", "(_", "\"", "Un", "know", "n", " ", "matrix", " ", "file", "\\u", "type", ":", " ", "%", "s", "\"_", "%_", "file", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "file", "\\u", "type_", "==_", "'", "F", "'_", "and_", "bytes", "wap", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "matrix_", "=_", "self_", "._", "matrix_", "._", "bytes", "wap", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "self_", "._", "matrix_", "._", "shape_", "[_", "0_", "]_", "==_", "self_", "._", "n", "\\u", "targets_", "*_", "self_", "._", "n", "\\u", "queries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "matrix_", "=_", "self_", "._", "matrix_", "._", "reshape_", "(_", "self_", "._", "n", "\\u", "queries_", ",_", "self_", "._", "n", "\\u", "targets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "read", " ", "the", " ", "sig", "sets", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sig", "set\\u", "dir_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sig", "set\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "queries_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ss", "\\u", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "sig", "set\\u", "dir_", ",_", "self_", "._", "query", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "queries_", "=_", "parse", "Sig", "Set_", "(_", "ss", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "queries_", ")_", "==_", "self_", "._", "n", "\\u", "queries_", "\\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_", "#", "print", " ", "\"", "Warn", "ing", ":", " ", "cou", "nd", " ", "not", " ", "read", " ", "the", " ", "query", " ", "sig", "set", " ", "for", " ", "distance", " ", "matrix", " ", "%", "s", "\"%", "self", ".", "shortname_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", " ", " ", " ", " ", " ", "Sig", "Set", " ", "File", ":\"", ",", "ss", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", " ", " ", " ", " ", " ", "Expect", "ed", ":\"", ",", "self", ".", "n", "\\u", "querie", "s", ",\"", "Read", ":\"", ",", "len", "(", "self", ".", "querie", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "targets_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ss", "\\u", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "sig", "set\\u", "dir_", ",_", "self_", "._", "target", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "targets_", "=_", "parse", "Sig", "Set_", "(_", "ss", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "self_", "._", "targets_", ")_", "==_", "self_", "._", "n", "\\u", "targets_", "\\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_", "#", "print", " ", "\"", "Warn", "ing", ":", " ", "cou", "nd", " ", "not", " ", "read", " ", "the", " ", "target", " ", "sig", "set", " ", "for", " ", "distance", " ", "matrix", " ", "%", "s", "\"%", "self", ".", "shortname_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", " ", " ", " ", " ", " ", "Sig", "Set", " ", "File", ":\"", ",", "ss", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", " ", " ", " ", " ", " ", "Expect", "ed", ":\"", ",", "self", ".", "n", "\\u", "target", "s", ",\"", "Read", ":\"", ",", "len", "(", "self", ".", "target", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "BE", "ED", "ista", "nce", "Matrix_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "histogram_", "(_", "self_", ",_", "value", "\\u", "range_", "=_", "None_", ",_", "bins_", "=_", "100_", ",_", "normed_", "=_", "True_", ",_", "mask_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match", "\\u", "scores_", "=_", "self_", "._", "get", "Match", "Scores_", "(_", "mask_", "=_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "non", "match", "\\u", "scores_", "=_", "self_", "._", "get", "Non", "Match", "Scores_", "(_", "mask_", "=_", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value", "\\u", "range_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "\\u", "range_", "=_", "(_", "self_", "._", "matrix_", "._", "min_", "(_", ")_", ",_", "self_", "._", "matrix_", "._", "max_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match", "\\u", "counts_", ",_", "\\u_", "=_", "np_", "._", "histogram_", "(_", "match", "\\u", "scores_", ",_", "range_", "=_", "value", "\\u", "range_", ",_", "bins_", "=_", "bins_", ",_", "normed_", "=_", "normed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "non", "match", "\\u", "counts_", ",_", "vals_", "=_", "np_", "._", "histogram_", "(_", "non", "match", "\\u", "scores_", ",_", "range_", "=_", "value", "\\u", "range_", ",_", "bins_", "=_", "bins_", ",_", "normed_", "=_", "normed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hist_", "=_", "pv_", "._", "Table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "match", "\\u", "counts_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hist_", "[_", "i_", ",_", "'", "min", "'_", "]_", "=_", "vals_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist_", "[_", "i_", ",_", "'", "center", "'_", "]_", "=_", "0.5_", "*_", "(_", "vals_", "[_", "i_", "]_", "+_", "vals_", "[_", "i_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist_", "[_", "i_", ",_", "'", "max", "'_", "]_", "=_", "vals_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist_", "[_", "i_", ",_", "'", "match", "\\u", "count", "'_", "]_", "=_", "match", "\\u", "counts_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist_", "[_", "i_", ",_", "'", "non", "match", "\\u", "count", "'_", "]_", "=_", "non", "match", "\\u", "counts_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "hist_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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,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